<?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=Kbg15</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=Kbg15"/>
	<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/wiki/Special:Contributions/Kbg15"/>
	<updated>2026-04-07T08:04:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659707</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659707"/>
		<updated>2018-02-02T15:59:59Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Results and Discussion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis.&amp;lt;ref&amp;gt;T. Nakagawa, &#039;&#039;Molecular Physics&#039;&#039;, 1996, &#039;&#039;&#039;88&#039;&#039;&#039;, 1635–1644.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton.&amp;lt;ref&amp;gt;J.-P. Hansen and L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1969, &#039;&#039;&#039;184&#039;&#039;&#039;, 151–161.&amp;lt;/ref&amp;gt; Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|570x570px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|570x570px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|670x670px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.&amp;lt;ref&amp;gt;P. Flowers, K. Theopold, R. Langley, W. R. Robinson, M. Blaser, S. Bott, D. Carpenetti, A. Eklund, E. El-Giar, D. Frantz, P. Hooker, G. Kaminski, J. Look, C. Martinez, T. Milliken, V. Moravec, J. D. Powell, T. Sorensen and A. Soult, &#039;&#039;Chemistry&#039;&#039;, OpenStax, Rice University, Houston, TX, 2017.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I - Theory behind simulations (Q&amp;amp;A)==&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator.&amp;lt;ref&amp;gt;R. A. Serway and J. W. Jewett, &#039;&#039;Physics for scientists and engineers&#039;&#039;, Thomson/Brooks/Cole, Australia, 2004.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide.&amp;lt;ref&amp;gt;J. E. Jones, &#039;&#039;Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences&#039;&#039;, 1924, &#039;&#039;&#039;106&#039;&#039;&#039;, 463–477.&amp;lt;/ref&amp;gt; The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space.&amp;lt;ref&amp;gt;P. Kosinski and A. C. Hoffmann, &#039;&#039;Physical Review E&#039;&#039;, 2011, &#039;&#039;&#039;84&#039;&#039;&#039;.&amp;lt;/ref&amp;gt; Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm&amp;lt;ref&amp;gt;L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1967, &#039;&#039;&#039;159&#039;&#039;&#039;, 98–103.&amp;lt;/ref&amp;gt; or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used.&amp;lt;ref&amp;gt;J. Schmid, &#039;&#039;The Journal of Educational Research&#039;&#039;, 1947, &#039;&#039;&#039;41&#039;&#039;&#039;, 311–313.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.&lt;br /&gt;
&lt;br /&gt;
== Appendix II- Sample of LAMMPS input in the NVE ensemble ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659559</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659559"/>
		<updated>2018-01-31T11:32:52Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Abstract */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis.&amp;lt;ref&amp;gt;T. Nakagawa, &#039;&#039;Molecular Physics&#039;&#039;, 1996, &#039;&#039;&#039;88&#039;&#039;&#039;, 1635–1644.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton.&amp;lt;ref&amp;gt;J.-P. Hansen and L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1969, &#039;&#039;&#039;184&#039;&#039;&#039;, 151–161.&amp;lt;/ref&amp;gt; Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.&amp;lt;ref&amp;gt;P. Flowers, K. Theopold, R. Langley, W. R. Robinson, M. Blaser, S. Bott, D. Carpenetti, A. Eklund, E. El-Giar, D. Frantz, P. Hooker, G. Kaminski, J. Look, C. Martinez, T. Milliken, V. Moravec, J. D. Powell, T. Sorensen and A. Soult, &#039;&#039;Chemistry&#039;&#039;, OpenStax, Rice University, Houston, TX, 2017.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I - Theory behind simulations (Q&amp;amp;A)==&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator.&amp;lt;ref&amp;gt;R. A. Serway and J. W. Jewett, &#039;&#039;Physics for scientists and engineers&#039;&#039;, Thomson/Brooks/Cole, Australia, 2004.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide.&amp;lt;ref&amp;gt;J. E. Jones, &#039;&#039;Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences&#039;&#039;, 1924, &#039;&#039;&#039;106&#039;&#039;&#039;, 463–477.&amp;lt;/ref&amp;gt; The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space.&amp;lt;ref&amp;gt;P. Kosinski and A. C. Hoffmann, &#039;&#039;Physical Review E&#039;&#039;, 2011, &#039;&#039;&#039;84&#039;&#039;&#039;.&amp;lt;/ref&amp;gt; Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm&amp;lt;ref&amp;gt;L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1967, &#039;&#039;&#039;159&#039;&#039;&#039;, 98–103.&amp;lt;/ref&amp;gt; or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used.&amp;lt;ref&amp;gt;J. Schmid, &#039;&#039;The Journal of Educational Research&#039;&#039;, 1947, &#039;&#039;&#039;41&#039;&#039;&#039;, 311–313.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.&lt;br /&gt;
&lt;br /&gt;
== Appendix II- Sample of LAMMPS input in the NVE ensemble ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659553</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659553"/>
		<updated>2018-01-31T11:22:31Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Extension: Velocity Autocorrelation Function, VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis.&amp;lt;ref&amp;gt;T. Nakagawa, &#039;&#039;Molecular Physics&#039;&#039;, 1996, &#039;&#039;&#039;88&#039;&#039;&#039;, 1635–1644.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton.&amp;lt;ref&amp;gt;J.-P. Hansen and L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1969, &#039;&#039;&#039;184&#039;&#039;&#039;, 151–161.&amp;lt;/ref&amp;gt; Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.&amp;lt;ref&amp;gt;P. Flowers, K. Theopold, R. Langley, W. R. Robinson, M. Blaser, S. Bott, D. Carpenetti, A. Eklund, E. El-Giar, D. Frantz, P. Hooker, G. Kaminski, J. Look, C. Martinez, T. Milliken, V. Moravec, J. D. Powell, T. Sorensen and A. Soult, &#039;&#039;Chemistry&#039;&#039;, OpenStax, Rice University, Houston, TX, 2017.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I - Theory behind simulations (Q&amp;amp;A)==&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator.&amp;lt;ref&amp;gt;R. A. Serway and J. W. Jewett, &#039;&#039;Physics for scientists and engineers&#039;&#039;, Thomson/Brooks/Cole, Australia, 2004.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide.&amp;lt;ref&amp;gt;J. E. Jones, &#039;&#039;Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences&#039;&#039;, 1924, &#039;&#039;&#039;106&#039;&#039;&#039;, 463–477.&amp;lt;/ref&amp;gt; The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space.&amp;lt;ref&amp;gt;P. Kosinski and A. C. Hoffmann, &#039;&#039;Physical Review E&#039;&#039;, 2011, &#039;&#039;&#039;84&#039;&#039;&#039;.&amp;lt;/ref&amp;gt; Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm&amp;lt;ref&amp;gt;L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1967, &#039;&#039;&#039;159&#039;&#039;&#039;, 98–103.&amp;lt;/ref&amp;gt; or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used.&amp;lt;ref&amp;gt;J. Schmid, &#039;&#039;The Journal of Educational Research&#039;&#039;, 1947, &#039;&#039;&#039;41&#039;&#039;&#039;, 311–313.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.&lt;br /&gt;
&lt;br /&gt;
== Appendix II- Sample of LAMMPS input in the NVE ensemble ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659548</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659548"/>
		<updated>2018-01-31T11:18:38Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Appendix I */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis.&amp;lt;ref&amp;gt;T. Nakagawa, &#039;&#039;Molecular Physics&#039;&#039;, 1996, &#039;&#039;&#039;88&#039;&#039;&#039;, 1635–1644.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton.&amp;lt;ref&amp;gt;J.-P. Hansen and L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1969, &#039;&#039;&#039;184&#039;&#039;&#039;, 151–161.&amp;lt;/ref&amp;gt; Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.&amp;lt;ref&amp;gt;P. Flowers, K. Theopold, R. Langley, W. R. Robinson, M. Blaser, S. Bott, D. Carpenetti, A. Eklund, E. El-Giar, D. Frantz, P. Hooker, G. Kaminski, J. Look, C. Martinez, T. Milliken, V. Moravec, J. D. Powell, T. Sorensen and A. Soult, &#039;&#039;Chemistry&#039;&#039;, OpenStax, Rice University, Houston, TX, 2017.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix II. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I - Theory behind simulations (Q&amp;amp;A)==&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator.&amp;lt;ref&amp;gt;R. A. Serway and J. W. Jewett, &#039;&#039;Physics for scientists and engineers&#039;&#039;, Thomson/Brooks/Cole, Australia, 2004.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide.&amp;lt;ref&amp;gt;J. E. Jones, &#039;&#039;Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences&#039;&#039;, 1924, &#039;&#039;&#039;106&#039;&#039;&#039;, 463–477.&amp;lt;/ref&amp;gt; The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space.&amp;lt;ref&amp;gt;P. Kosinski and A. C. Hoffmann, &#039;&#039;Physical Review E&#039;&#039;, 2011, &#039;&#039;&#039;84&#039;&#039;&#039;.&amp;lt;/ref&amp;gt; Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm&amp;lt;ref&amp;gt;L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1967, &#039;&#039;&#039;159&#039;&#039;&#039;, 98–103.&amp;lt;/ref&amp;gt; or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used.&amp;lt;ref&amp;gt;J. Schmid, &#039;&#039;The Journal of Educational Research&#039;&#039;, 1947, &#039;&#039;&#039;41&#039;&#039;&#039;, 311–313.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.&lt;br /&gt;
&lt;br /&gt;
== Appendix II - Derivation of the VACF of SHM ==&lt;br /&gt;
&lt;br /&gt;
== Appendix III - Sample of LAMMPS input in the NVE ensemble ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659546</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659546"/>
		<updated>2018-01-31T11:16:45Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Appendix I */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis.&amp;lt;ref&amp;gt;T. Nakagawa, &#039;&#039;Molecular Physics&#039;&#039;, 1996, &#039;&#039;&#039;88&#039;&#039;&#039;, 1635–1644.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton.&amp;lt;ref&amp;gt;J.-P. Hansen and L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1969, &#039;&#039;&#039;184&#039;&#039;&#039;, 151–161.&amp;lt;/ref&amp;gt; Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.&amp;lt;ref&amp;gt;P. Flowers, K. Theopold, R. Langley, W. R. Robinson, M. Blaser, S. Bott, D. Carpenetti, A. Eklund, E. El-Giar, D. Frantz, P. Hooker, G. Kaminski, J. Look, C. Martinez, T. Milliken, V. Moravec, J. D. Powell, T. Sorensen and A. Soult, &#039;&#039;Chemistry&#039;&#039;, OpenStax, Rice University, Houston, TX, 2017.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I==&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator.&amp;lt;ref&amp;gt;R. A. Serway and J. W. Jewett, &#039;&#039;Physics for scientists and engineers&#039;&#039;, Thomson/Brooks/Cole, Australia, 2004.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide.&amp;lt;ref&amp;gt;J. E. Jones, &#039;&#039;Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences&#039;&#039;, 1924, &#039;&#039;&#039;106&#039;&#039;&#039;, 463–477.&amp;lt;/ref&amp;gt; The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space.&amp;lt;ref&amp;gt;P. Kosinski and A. C. Hoffmann, &#039;&#039;Physical Review E&#039;&#039;, 2011, &#039;&#039;&#039;84&#039;&#039;&#039;.&amp;lt;/ref&amp;gt; Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm&amp;lt;ref&amp;gt;L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1967, &#039;&#039;&#039;159&#039;&#039;&#039;, 98–103.&amp;lt;/ref&amp;gt; or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used.&amp;lt;ref&amp;gt;J. Schmid, &#039;&#039;The Journal of Educational Research&#039;&#039;, 1947, &#039;&#039;&#039;41&#039;&#039;&#039;, 311–313.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.&lt;br /&gt;
&lt;br /&gt;
== Appendix II - Sample of LAMMPS input in the NVE ensemble ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659545</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659545"/>
		<updated>2018-01-31T11:16:29Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Results and Discussion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis.&amp;lt;ref&amp;gt;T. Nakagawa, &#039;&#039;Molecular Physics&#039;&#039;, 1996, &#039;&#039;&#039;88&#039;&#039;&#039;, 1635–1644.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton.&amp;lt;ref&amp;gt;J.-P. Hansen and L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1969, &#039;&#039;&#039;184&#039;&#039;&#039;, 151–161.&amp;lt;/ref&amp;gt; Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.&amp;lt;ref&amp;gt;P. Flowers, K. Theopold, R. Langley, W. R. Robinson, M. Blaser, S. Bott, D. Carpenetti, A. Eklund, E. El-Giar, D. Frantz, P. Hooker, G. Kaminski, J. Look, C. Martinez, T. Milliken, V. Moravec, J. D. Powell, T. Sorensen and A. Soult, &#039;&#039;Chemistry&#039;&#039;, OpenStax, Rice University, Houston, TX, 2017.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I==&lt;br /&gt;
&lt;br /&gt;
== Appendix II - Sample of LAMMPS input in the NVE ensemble ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659543</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659543"/>
		<updated>2018-01-31T11:12:49Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Appendix II */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis.&amp;lt;ref&amp;gt;T. Nakagawa, &#039;&#039;Molecular Physics&#039;&#039;, 1996, &#039;&#039;&#039;88&#039;&#039;&#039;, 1635–1644.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton.&amp;lt;ref&amp;gt;J.-P. Hansen and L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1969, &#039;&#039;&#039;184&#039;&#039;&#039;, 151–161.&amp;lt;/ref&amp;gt; Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator.&amp;lt;ref&amp;gt;R. A. Serway and J. W. Jewett, &#039;&#039;Physics for scientists and engineers&#039;&#039;, Thomson/Brooks/Cole, Australia, 2004.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide.&amp;lt;ref&amp;gt;J. E. Jones, &#039;&#039;Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences&#039;&#039;, 1924, &#039;&#039;&#039;106&#039;&#039;&#039;, 463–477.&amp;lt;/ref&amp;gt; The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space.&amp;lt;ref&amp;gt;P. Kosinski and A. C. Hoffmann, &#039;&#039;Physical Review E&#039;&#039;, 2011, &#039;&#039;&#039;84&#039;&#039;&#039;.&amp;lt;/ref&amp;gt; Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm&amp;lt;ref&amp;gt;L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1967, &#039;&#039;&#039;159&#039;&#039;&#039;, 98–103.&amp;lt;/ref&amp;gt; or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used.&amp;lt;ref&amp;gt;J. Schmid, &#039;&#039;The Journal of Educational Research&#039;&#039;, 1947, &#039;&#039;&#039;41&#039;&#039;&#039;, 311–313.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.&amp;lt;ref&amp;gt;P. Flowers, K. Theopold, R. Langley, W. R. Robinson, M. Blaser, S. Bott, D. Carpenetti, A. Eklund, E. El-Giar, D. Frantz, P. Hooker, G. Kaminski, J. Look, C. Martinez, T. Milliken, V. Moravec, J. D. Powell, T. Sorensen and A. Soult, &#039;&#039;Chemistry&#039;&#039;, OpenStax, Rice University, Houston, TX, 2017.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I==&lt;br /&gt;
&lt;br /&gt;
== Appendix II - Sample of LAMMPS input in the NVE ensemble ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659541</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659541"/>
		<updated>2018-01-31T11:11:54Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Appendix II */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis.&amp;lt;ref&amp;gt;T. Nakagawa, &#039;&#039;Molecular Physics&#039;&#039;, 1996, &#039;&#039;&#039;88&#039;&#039;&#039;, 1635–1644.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton.&amp;lt;ref&amp;gt;J.-P. Hansen and L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1969, &#039;&#039;&#039;184&#039;&#039;&#039;, 151–161.&amp;lt;/ref&amp;gt; Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator.&amp;lt;ref&amp;gt;R. A. Serway and J. W. Jewett, &#039;&#039;Physics for scientists and engineers&#039;&#039;, Thomson/Brooks/Cole, Australia, 2004.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide.&amp;lt;ref&amp;gt;J. E. Jones, &#039;&#039;Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences&#039;&#039;, 1924, &#039;&#039;&#039;106&#039;&#039;&#039;, 463–477.&amp;lt;/ref&amp;gt; The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space.&amp;lt;ref&amp;gt;P. Kosinski and A. C. Hoffmann, &#039;&#039;Physical Review E&#039;&#039;, 2011, &#039;&#039;&#039;84&#039;&#039;&#039;.&amp;lt;/ref&amp;gt; Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm&amp;lt;ref&amp;gt;L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1967, &#039;&#039;&#039;159&#039;&#039;&#039;, 98–103.&amp;lt;/ref&amp;gt; or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used.&amp;lt;ref&amp;gt;J. Schmid, &#039;&#039;The Journal of Educational Research&#039;&#039;, 1947, &#039;&#039;&#039;41&#039;&#039;&#039;, 311–313.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.&amp;lt;ref&amp;gt;P. Flowers, K. Theopold, R. Langley, W. R. Robinson, M. Blaser, S. Bott, D. Carpenetti, A. Eklund, E. El-Giar, D. Frantz, P. Hooker, G. Kaminski, J. Look, C. Martinez, T. Milliken, V. Moravec, J. D. Powell, T. Sorensen and A. Soult, &#039;&#039;Chemistry&#039;&#039;, OpenStax, Rice University, Houston, TX, 2017.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I==&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659540</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659540"/>
		<updated>2018-01-31T11:11:39Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis.&amp;lt;ref&amp;gt;T. Nakagawa, &#039;&#039;Molecular Physics&#039;&#039;, 1996, &#039;&#039;&#039;88&#039;&#039;&#039;, 1635–1644.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton.&amp;lt;ref&amp;gt;J.-P. Hansen and L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1969, &#039;&#039;&#039;184&#039;&#039;&#039;, 151–161.&amp;lt;/ref&amp;gt; Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator.&amp;lt;ref&amp;gt;R. A. Serway and J. W. Jewett, &#039;&#039;Physics for scientists and engineers&#039;&#039;, Thomson/Brooks/Cole, Australia, 2004.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide.&amp;lt;ref&amp;gt;J. E. Jones, &#039;&#039;Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences&#039;&#039;, 1924, &#039;&#039;&#039;106&#039;&#039;&#039;, 463–477.&amp;lt;/ref&amp;gt; The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space.&amp;lt;ref&amp;gt;P. Kosinski and A. C. Hoffmann, &#039;&#039;Physical Review E&#039;&#039;, 2011, &#039;&#039;&#039;84&#039;&#039;&#039;.&amp;lt;/ref&amp;gt; Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm&amp;lt;ref&amp;gt;L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1967, &#039;&#039;&#039;159&#039;&#039;&#039;, 98–103.&amp;lt;/ref&amp;gt; or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used.&amp;lt;ref&amp;gt;J. Schmid, &#039;&#039;The Journal of Educational Research&#039;&#039;, 1947, &#039;&#039;&#039;41&#039;&#039;&#039;, 311–313.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.&amp;lt;ref&amp;gt;P. Flowers, K. Theopold, R. Langley, W. R. Robinson, M. Blaser, S. Bott, D. Carpenetti, A. Eklund, E. El-Giar, D. Frantz, P. Hooker, G. Kaminski, J. Look, C. Martinez, T. Milliken, V. Moravec, J. D. Powell, T. Sorensen and A. Soult, &#039;&#039;Chemistry&#039;&#039;, OpenStax, Rice University, Houston, TX, 2017.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I==&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659537</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659537"/>
		<updated>2018-01-31T11:08:12Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis.&amp;lt;ref&amp;gt;T. Nakagawa, &#039;&#039;Molecular Physics&#039;&#039;, 1996, &#039;&#039;&#039;88&#039;&#039;&#039;, 1635–1644.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton.&amp;lt;ref&amp;gt;J.-P. Hansen and L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1969, &#039;&#039;&#039;184&#039;&#039;&#039;, 151–161.&amp;lt;/ref&amp;gt; Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator.&amp;lt;ref&amp;gt;R. A. Serway and J. W. Jewett, &#039;&#039;Physics for scientists and engineers&#039;&#039;, Thomson/Brooks/Cole, Australia, 2004.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide.&amp;lt;ref&amp;gt;J. E. Jones, &#039;&#039;Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences&#039;&#039;, 1924, &#039;&#039;&#039;106&#039;&#039;&#039;, 463–477.&amp;lt;/ref&amp;gt; The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space.&amp;lt;ref&amp;gt;P. Kosinski and A. C. Hoffmann, &#039;&#039;Physical Review E&#039;&#039;, 2011, &#039;&#039;&#039;84&#039;&#039;&#039;.&amp;lt;/ref&amp;gt; Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm&amp;lt;ref&amp;gt;L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1967, &#039;&#039;&#039;159&#039;&#039;&#039;, 98–103.&amp;lt;/ref&amp;gt; or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used.&amp;lt;ref&amp;gt;J. Schmid, &#039;&#039;The Journal of Educational Research&#039;&#039;, 1947, &#039;&#039;&#039;41&#039;&#039;&#039;, 311–313.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.&amp;lt;ref&amp;gt;P. Flowers, K. Theopold, R. Langley, W. R. Robinson, M. Blaser, S. Bott, D. Carpenetti, A. Eklund, E. El-Giar, D. Frantz, P. Hooker, G. Kaminski, J. Look, C. Martinez, T. Milliken, V. Moravec, J. D. Powell, T. Sorensen and A. Soult, &#039;&#039;Chemistry&#039;&#039;, OpenStax, Rice University, Houston, TX, 2017.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659534</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659534"/>
		<updated>2018-01-31T11:06:08Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Aims and Objectives */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis.&amp;lt;ref&amp;gt;T. Nakagawa, &#039;&#039;Molecular Physics&#039;&#039;, 1996, &#039;&#039;&#039;88&#039;&#039;&#039;, 1635–1644.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton.&amp;lt;ref&amp;gt;J.-P. Hansen and L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1969, &#039;&#039;&#039;184&#039;&#039;&#039;, 151–161.&amp;lt;/ref&amp;gt; Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator.&amp;lt;ref&amp;gt;R. A. Serway and J. W. Jewett, &#039;&#039;Physics for scientists and engineers&#039;&#039;, Thomson/Brooks/Cole, Australia, 2004.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide.&amp;lt;ref&amp;gt;J. E. Jones, &#039;&#039;Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences&#039;&#039;, 1924, &#039;&#039;&#039;106&#039;&#039;&#039;, 463–477.&amp;lt;/ref&amp;gt; The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm&amp;lt;ref&amp;gt;L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1967, &#039;&#039;&#039;159&#039;&#039;&#039;, 98–103.&amp;lt;/ref&amp;gt; or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used.&amp;lt;ref&amp;gt;J. Schmid, &#039;&#039;The Journal of Educational Research&#039;&#039;, 1947, &#039;&#039;&#039;41&#039;&#039;&#039;, 311–313.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.&amp;lt;ref&amp;gt;P. Flowers, K. Theopold, R. Langley, W. R. Robinson, M. Blaser, S. Bott, D. Carpenetti, A. Eklund, E. El-Giar, D. Frantz, P. Hooker, G. Kaminski, J. Look, C. Martinez, T. Milliken, V. Moravec, J. D. Powell, T. Sorensen and A. Soult, &#039;&#039;Chemistry&#039;&#039;, OpenStax, Rice University, Houston, TX, 2017.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659526</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659526"/>
		<updated>2018-01-31T11:02:13Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis. &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton.&amp;lt;ref&amp;gt;J.-P. Hansen and L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1969, &#039;&#039;&#039;184&#039;&#039;&#039;, 151–161.&amp;lt;/ref&amp;gt; Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator.&amp;lt;ref&amp;gt;R. A. Serway and J. W. Jewett, &#039;&#039;Physics for scientists and engineers&#039;&#039;, Thomson/Brooks/Cole, Australia, 2004.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide.&amp;lt;ref&amp;gt;J. E. Jones, &#039;&#039;Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences&#039;&#039;, 1924, &#039;&#039;&#039;106&#039;&#039;&#039;, 463–477.&amp;lt;/ref&amp;gt; The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm&amp;lt;ref&amp;gt;L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1967, &#039;&#039;&#039;159&#039;&#039;&#039;, 98–103.&amp;lt;/ref&amp;gt; or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used.&amp;lt;ref&amp;gt;J. Schmid, &#039;&#039;The Journal of Educational Research&#039;&#039;, 1947, &#039;&#039;&#039;41&#039;&#039;&#039;, 311–313.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659523</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659523"/>
		<updated>2018-01-31T11:00:29Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension,&amp;lt;ref&amp;gt;H. Löwen, &#039;&#039;Computer Simulations in Condensed Matter Systems: From Materials to Chemical Biology Volume 2 Lecture Notes in Physics&#039;&#039;, 139–161.&amp;lt;/ref&amp;gt; computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding&amp;lt;ref&amp;gt;M. Levitt and A. Warshel, &#039;&#039;Nature&#039;&#039;, 1975, &#039;&#039;&#039;253&#039;&#039;&#039;, 694–698.&amp;lt;/ref&amp;gt;, DNA coiling, uncoiling and supercoiling&amp;lt;ref&amp;gt;P. Šelepová and J. Kypr, &#039;&#039;Biopolymers&#039;&#039;, 1985, &#039;&#039;&#039;24&#039;&#039;&#039;, 867–882.&amp;lt;/ref&amp;gt; could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid.&amp;lt;ref&amp;gt;K. Aim, J. Kolafa, I. Nezbeda and H. L. Vörtler, &#039;&#039;Fluid Phase Equilibria&#039;&#039;, 1993, &#039;&#039;&#039;83&#039;&#039;&#039;, 15–22.&amp;lt;/ref&amp;gt; These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis. &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods.&amp;lt;ref&amp;gt;S. V. Parter, &#039;&#039;Numerical methods for partial differential equations: proceedings of an advanced seminar conducted by the Mathematics Research Center, the University of Wisconsin, Madison, October 23-25, 1978&#039;&#039;, Acad. Press, New York, 1982.&amp;lt;/ref&amp;gt; One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton. Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator.&amp;lt;ref&amp;gt;R. A. Serway and J. W. Jewett, &#039;&#039;Physics for scientists and engineers&#039;&#039;, Thomson/Brooks/Cole, Australia, 2004.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide.&amp;lt;ref&amp;gt;J. E. Jones, &#039;&#039;Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences&#039;&#039;, 1924, &#039;&#039;&#039;106&#039;&#039;&#039;, 463–477.&amp;lt;/ref&amp;gt; The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm&amp;lt;ref&amp;gt;L. Verlet, &#039;&#039;Physical Review&#039;&#039;, 1967, &#039;&#039;&#039;159&#039;&#039;&#039;, 98–103.&amp;lt;/ref&amp;gt; or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used.&amp;lt;ref&amp;gt;J. Schmid, &#039;&#039;The Journal of Educational Research&#039;&#039;, 1947, &#039;&#039;&#039;41&#039;&#039;&#039;, 311–313.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations.&amp;lt;ref&amp;gt;P. W. Atkins, &#039;&#039;Shriver &amp;amp; Atkins inorganic chemistry&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature.&amp;lt;ref&amp;gt;Y. A. Çengel and M. A. Boles, &#039;&#039;Thermodynamics: an engineering approach&#039;&#039;, McGraw-Hill Connect Learn Succeed, New York, 2011.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere.&amp;lt;ref&amp;gt;D. Chandler, &#039;&#039;Introduction to modern statistical mechanics&#039;&#039;, Oxford Univ. Press, New York, NY, 2009.&amp;lt;/ref&amp;gt; &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;ref&amp;gt;W. Brostow, &#039;&#039;Chemical Physics Letters&#039;&#039;, 1977, &#039;&#039;&#039;49&#039;&#039;&#039;, 285–288.&amp;lt;/ref&amp;gt;&amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&amp;lt;ref&amp;gt;S. M. Lindsay, &#039;&#039;Introduction to nanoscience&#039;&#039;, Oxford University Press, Oxford, 2010.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below.&amp;lt;ref&amp;gt;D. C. Wallace, &#039;&#039;Physical Review E&#039;&#039;, 1998, &#039;&#039;&#039;58&#039;&#039;&#039;, 538–545.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==Appendix I==&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659496</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659496"/>
		<updated>2018-01-31T10:33:14Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension, computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding, DNA coiling and uncoiling could be simulated to allow scientists to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid. These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis. &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods. One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton. Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877).&amp;lt;ref&amp;gt;T. C. O’Connor, J. Andzelm and M. O. Robbins, &#039;&#039;The Journal of Chemical Physics&#039;&#039;, 2015, &#039;&#039;&#039;142&#039;&#039;&#039;, 024903.&amp;lt;/ref&amp;gt;]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas.&amp;lt;ref&amp;gt;Cengel, Yunus A.; Boles, Michael A. &#039;&#039;Thermodynamics: An Engineering Approach&#039;&#039; (4th ed.). p. 89. ISBN 0-07-238332-1.&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659492</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659492"/>
		<updated>2018-01-31T10:25:38Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Computer simulation has become a powerful and useful tool to estimate and solve complicated real problems in life. From building a bridge to designing a stable colloidal suspension, computer simulation is the best estimate before actual trial. Thousands and millions of  combinations could have been tried in a computer simulation to screen worthless attempts, and save up cost of money and time in random trials. For example in designing a new milk, the concentration of fat in the milk could have been simulated to check the colloidal stability of the milk, what concentration is the best to delay separation/nucleation of fat in water. Therefore, CEO of a milk product company does not need to associate huge amount of budget and resources to randomly test the different fat concentrations, but just need to test those which gave acceptable results from computer simulation. Moreover, protein folding, DNA coiling and uncoiling could be simulated to allow scientist to understand processes such as translation and transcription, enzymatic activities and antibodies mechanisms. These processes could not be observed under a microscope, but by understanding the molecular forces and the structure of the molecules, models could be built to replicate what the nature does in computer simulation. &lt;br /&gt;
&lt;br /&gt;
Different thermodynamic parameters have been estimated using computational simulation of Lennard-Jones fluid. These values were compared with the experimental values to convey experiments out from the lab, into computers. Scientists were trying to use their understanding from the physical phenomena and equations to replicate and simulate a model that represents the reality. This method opened a door to scientists to obtain &amp;quot;experimental&amp;quot; values from computational analysis rather than a lab analysis. &lt;br /&gt;
&lt;br /&gt;
Numerical algorithms are useful to solve complicated mathematical equations in computer. From a complicated Schrodinger&#039;s equation to a simple harmonic oscillator could be solved using numerical methods. One of those algorithms is the Verlet algorithm which solves the position and velocity using some second order approximations. These powerful algorithms help mankind solve complicated mathematical equations as long as the conditions are reasonable giving relatively small errors. &lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton. Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659438</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659438"/>
		<updated>2018-01-31T09:01:41Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Simulation box and parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton. Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using Python numpy.trapz function.&lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659436</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659436"/>
		<updated>2018-01-31T09:01:17Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Simulation box and parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton. Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep was chosen to give reasonable results and short actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using python numpy.trapz function.  &lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659435</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659435"/>
		<updated>2018-01-31T08:59:02Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Verlet algorithm to estimate 1-D simple harmonic oscillation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;\frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton. Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep gives reasonable results and shorten the actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using python numpy.trapz function.  &lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659434</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659434"/>
		<updated>2018-01-31T08:58:46Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Verlet algorithm to estimate 1-D simple harmonic oscillation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy &amp;lt;math&amp;gt;frac{1}{2} mv^2&amp;lt;/math&amp;gt; and the potential energy &amp;lt;math&amp;gt;\frac{1}{2} kx^2&amp;lt;/math&amp;gt;, with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton. Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep gives reasonable results and shorten the actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using python numpy.trapz function.  &lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659432</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659432"/>
		<updated>2018-01-31T08:56:09Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy (1/2 mv^2) and the potential energy (1/2 kx^2), with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton. Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep gives reasonable results and shorten the actual simulation time. 1 atom type (Type 1 atom) with mass 1.0 was used. The pair interactions between particles were the Lennard-Jones potential with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. The pair coefficient was set as 1.0 for all the simulations. Graphs were plotted in both Excel and Python, whereas curve fitting was done by polyfit in Python and trend line in Excel. Trapezium rule and running integrals were compiled using python numpy.trapz function.  &lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659425</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659425"/>
		<updated>2018-01-31T08:48:56Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Verlet algorithm to estimate 1-D simple harmonic oscillation ===&lt;br /&gt;
The analytical displacement of the displacement was set as a cosine function. The error was calculated from the absolute difference between the analytical displacement and the displacement obtained from the algorithm. The total energy of the system was the sum of the kinetic energy (1/2 mv^2) and the potential energy (1/2 kx^2), with both x and v parameters estimated from the algorithm. The peaks of the absolute error were linear fitted using Excel while the percentage error for each time step used were fitted to a quadratic equation using Excel. The percentage error was calculated using maxima-minima/maxima.&lt;br /&gt;
&lt;br /&gt;
=== Simulation box and parameters ===&lt;br /&gt;
For simulations of liquid and gas, simple cubic lattice structure was used as the initial system, whereas face-centred cubic structure was used in solid simulations. The densities of the liquid simulation used were 0.2 and 0.8 whereas 1.2 for solid simulation and 0.01 for gas simulaiton. Wide range of temperatures were used in different simulations. If not specified, the timestep of the simulations was set to 0.025. This timestep gives reasonable results and shorten the actual simulation time. &lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659421</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659421"/>
		<updated>2018-01-31T08:33:21Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
=== Sample LAMMPS input script for the NVE ensemble to calculate the specific heat capacity ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect the reality. The Verlet algorithm was used to estimate the behaviour of the systems. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved more like ideal gas by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates a solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, and explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659420</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659420"/>
		<updated>2018-01-31T08:29:06Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
Simple LAMMPS input script was comprehended and was used to simulate systems which reflect reality. The Verlet algorithm was used to estimate the behaviour of the system. Simulation results such as the total energy, temperature, density, mean square displacement (MSD) and velocity autocorrelation function (VACF) were used to estimate the heat capacity, duration for the system to reach equilibrium, the diffusion coefficient, the lattice spacing of the matter, coordination spheres and the coordination numbers. Real gas behaved like ideal gas better by increasing the temperature and decreasing the pressure of the system. The properties of the states of matter were reflected from the simulation results. For example, small integral VACF or constant plateau MSD indicates solid system. Thermodynamic equations were satisfied from the simulation results, thus estimated parameters such as the diffusion coefficient, explained the behaviour of MSD over time and the deviation of results from the ideal gas equations.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659419</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659419"/>
		<updated>2018-01-31T08:15:35Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Abstract */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
The research achieved the usage of computational simulation to estimate thermodynamic properties of real life systems, such as the heat capacity, diffusion coefficient, internal energy, total energy and etc. These properties explain the nature of states (solid, liquid and gas), and instil the law of thermodynamics. The simulation also reinforce the deviation of behaviours of real gas from the ideal gas. For example, the decrease of pressure and increase of temperature of a system are good approaches to mimic ideal gas system. Lennard-Jones interaction was used as a primary basis of the simulation to provide first order approximations of the reality of system. A lot of thermodynamic equations were used to explain the simulation results, such as the Einstein relation in Brownian motion, Stokes-Einstein equation, velocity autocorrelation coefficient, and the ideal gas laws, thus further reinforce the applications of these equations both in the simulation and in real life.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
# To understand the computational algorithms in solving complex differential equations.&lt;br /&gt;
# To simulate particles with preset interaction type in a system, and obtain results from it. &lt;br /&gt;
# To use simulation results in estimating thermodynamic quantities.&lt;br /&gt;
# To compare and contrast the properties of real gas from simulation and ideal gas.&lt;br /&gt;
# To differentiate the states of matter from the diffusion coefficients which were calculated from simulation.&lt;br /&gt;
# To relate and apply thermodynamic equations in solving real life problems. &lt;br /&gt;
# To understand basic LAMMPS input coding for computational simulation. &lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659416</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659416"/>
		<updated>2018-01-31T07:57:17Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Extension: Velocity Autocorrelation Function, VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. Error from the estimate of diffusion coefficient from integral of VACF could be arising from the trapezium rule. A larger possible error is due to the most contributing part to the integral of VACF comes from the earlier part of the simulation which the system might not reach equilibrium yet. This error which came from the nature of the integration algorithm contributes largely to the contradiction of the estimated diffusion coefficient from integral VACF and ones from mean square displacement which uses later part of the simulation.  &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659413</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659413"/>
		<updated>2018-01-31T07:52:05Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. Due to the nature of the harmonic oscillator, the VACF is a regular cosine function. The large velocity towards one direction will cancelled out with another velocity pointing towards the opposite direction. Therefore, particles under simple harmonic motion can never disappear from the system. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 16:&#039;&#039;&#039; Graphs of running integral of VACF against time]]The areas under the curves used in estimating the diffusion coefficient were calculated using the trapezium rule. The running integral of the VACF against time is also plotted in Figure 16. The integral of VACF for solid initially is high, but quickly reduces and plateau at zero showing the cancelling effect of the opposite direction velocities against the initial velocities. However, the running integral for liquid starts at the same point but increases and plateau, showing flow properties with diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659408</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659408"/>
		<updated>2018-01-31T07:40:36Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Extension: Velocity Autocorrelation Function, VACF */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D = \frac{1}{3}\int_0^\infty \mathrm{d}\tau \left\langle\mathbf{v}\left(0\right)\cdot\mathbf{v}\left(\tau\right)\right\rangle&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|left|thumb|500x500px]]&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659407</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659407"/>
		<updated>2018-01-31T07:39:22Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Extension: Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function, VACF ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM.  ]]The normalised velocity autocorrelation function is described as the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It can be used to estimate the diffusion coefficient using the equation below. &lt;br /&gt;
&lt;br /&gt;
The velocity of a simple harmonic oscillator is described as the equation below. This equation is obtained by assuming the displacement as a cosine function of time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Substituting the velocity into the VACF, cosine function is obtained. The proof is shown in Appendix I. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The graphs of the VACF vs time for solid, liquid and simple harmonic oscillator are plotted in Figure 15. For solid, due to the high activation energy to remove a particle from the coordination spheres, the particles can only vibrate. Particles moving at high initial velocity to a direction moves backward in an opposite direction with a negative sign. Therefore, the particles show no net movement throughout the simulation. For liquid, the particles have smaller activation energy to move away from the coordination spheres. Liquid hence exhibit flow properties. The high initial velocity decreases to zero but particles never move backward, causing a net movement of particles. This give rise to the diffusion coefficient. Due to the fact that the integral of the VACF in solid will causes the positive phase cancelling out the negative phase, the diffusion coefficient which is directly proportional to the integral is very close to zero. This statement further proves the inability of particle flow in solid. For liquid, the integral gives a net positive value, resulting a diffusion coefficient which explains the flow property of liquid. The diffusion coefficient estimated using VACF is tabulated below. &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 2:&#039;&#039;&#039; Estimated diffusion coefficient from the integral of VACF&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.02276&lt;br /&gt;
|0.02276&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|45.05&lt;br /&gt;
|39.16&lt;br /&gt;
|}  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|left|thumb|500x500px]]&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659402</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659402"/>
		<updated>2018-01-31T07:23:43Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Extension: Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function ===&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM. ]]&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory17kbg15.png|left|thumb|500x500px]]&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Liquidsimulationtheory17kbg15.png&amp;diff=659401</id>
		<title>File:Liquidsimulationtheory17kbg15.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Liquidsimulationtheory17kbg15.png&amp;diff=659401"/>
		<updated>2018-01-31T07:22:10Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659333</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659333"/>
		<updated>2018-01-31T04:22:00Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Extension: Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function ===&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory16kbg15.png|thumb|501x501px|&#039;&#039;&#039;Figure 15:&#039;&#039;&#039; Graphs of VACF vs time for solid, liquid and simple harmonic oscillator, SHM. ]]&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Liquidsimulationtheory16kbg15.png&amp;diff=659327</id>
		<title>File:Liquidsimulationtheory16kbg15.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Liquidsimulationtheory16kbg15.png&amp;diff=659327"/>
		<updated>2018-01-31T04:18:25Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659271</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659271"/>
		<updated>2018-01-31T02:44:10Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Extension: Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function ===&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659268</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659268"/>
		<updated>2018-01-31T02:40:51Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Extension: Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function ===&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(\omega \tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659267</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659267"/>
		<updated>2018-01-31T02:40:27Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Extension: Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function ===&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}=cos(/omega /tau)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659266</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659266"/>
		<updated>2018-01-31T02:39:46Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Extension: Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function ===&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;v=-sin(\omega t)&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} -sin(\omega t)\times-sin(\omega (t+\tau))\mathrm{d}t}{\int_{-\infty}^{\infty} (-sin(\omega t))^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659262</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659262"/>
		<updated>2018-01-31T02:36:57Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. The general trend of the diffusion coefficients is logical with solid has the smallest diffusion coefficient and gas has the largest diffusion coefficient. For the unit of the diffusion coefficient, since the distance is recorded in reduced unit, the mean square displacement is in reduce unit as well which is unit-less. Therefore, the diffusion coefficient has the unit of inverse time.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension: Velocity Autocorrelation Function ===&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659261</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659261"/>
		<updated>2018-01-31T02:30:08Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Diffusion coefficient and Mean Square Displacement (MSD) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=\frac{3kT}{m}t^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659260</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659260"/>
		<updated>2018-01-31T02:29:33Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Diffusion coefficient and Mean Square Displacement (MSD) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;x^2&amp;gt;=3kT/m t^2&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659259</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659259"/>
		<updated>2018-01-31T02:29:16Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Diffusion coefficient and Mean Square Displacement (MSD) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-left: auto; margin-right: auto; border: none;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Cells left-aligned, table centered&#039;&#039;&#039;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;x^2&amp;gt;=3kT/m t^2&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659258</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659258"/>
		<updated>2018-01-31T02:28:08Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Diffusion coefficient and Mean Square Displacement (MSD) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Cells left-aligned, table centered&#039;&#039;&#039;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;x^2&amp;gt;=3kT/m t^2&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659256</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659256"/>
		<updated>2018-01-31T02:27:08Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Diffusion coefficient and Mean Square Displacement (MSD) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px|&#039;&#039;&#039;Figure 14:&#039;&#039;&#039; Graphs of mean square displacement vs time for solid, liquid and gas.]]&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&#039;&#039;&#039;Table 1:&#039;&#039;&#039; Estimated diffusion coefficient from the graphs in Figure 14 using Einstein relation&lt;br /&gt;
!State&lt;br /&gt;
!Diffusion coefficient from 1 million particles&lt;br /&gt;
!Diffusion coefficient from thousands of particles&lt;br /&gt;
|-&lt;br /&gt;
|Solid&lt;br /&gt;
|0.0000003352&lt;br /&gt;
|0.000002004&lt;br /&gt;
|-&lt;br /&gt;
|Liquid&lt;br /&gt;
|0.006434&lt;br /&gt;
|0.006569&lt;br /&gt;
|-&lt;br /&gt;
|Gas&lt;br /&gt;
|0.2316&lt;br /&gt;
|0.5714&lt;br /&gt;
|}&lt;br /&gt;
From Figure 14, the graphs of mean square displacement vs time of solid liquid and gas were plotted. The mean square displacement plateau at a value in solid. This value arises from the vibration of particles in the lattice. Due to the high activation energy to remove an atom from solid lattice, the relaxation time is very large, giving rise to a very small diffusion coefficient in solid. Therefore, from the equation above, the gradient of the graph is very close to zero. In liquid, the graph is linear, giving rise to a constant gradient and a constant value of diffusion coefficient. The temperature used for both of the graphs in liquid was the same, giving rise to the same diffusion coefficient. For gas, the particle separation is too large, giving rise to Ballistic motion described from the equation below. The kinematic motion gives rise to a quadratic relation between MSD and time, which in other word means there is negligible activation energy to move particle from one place to another. The difference in the curves generated from different number of particles is because of the different temperature used in the simulation. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;x^2&amp;gt;=3kT/m t^2&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659250</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659250"/>
		<updated>2018-01-31T02:06:41Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Diffusion coefficient and Mean Square Displacement (MSD) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory15kbg15.png|centre|thumb|999x999px]]&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Liquidsimulationtheory15kbg15.png&amp;diff=659249</id>
		<title>File:Liquidsimulationtheory15kbg15.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Liquidsimulationtheory15kbg15.png&amp;diff=659249"/>
		<updated>2018-01-31T02:06:27Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: Kbg15 uploaded a new version of File:Liquidsimulationtheory15kbg15.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Liquidsimulationtheory15kbg15.png&amp;diff=659247</id>
		<title>File:Liquidsimulationtheory15kbg15.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Liquidsimulationtheory15kbg15.png&amp;diff=659247"/>
		<updated>2018-01-31T02:03:13Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659181</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659181"/>
		<updated>2018-01-30T23:23:03Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Diffusion coefficient and Mean Square Displacement (MSD) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension, which equals to 3 in 3-d space and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}= \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659176</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659176"/>
		<updated>2018-01-30T23:14:08Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Diffusion coefficient and Mean Square Displacement (MSD) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where d is the dimension and D is the diffusion coefficient. &lt;br /&gt;
&lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659175</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659175"/>
		<updated>2018-01-30T23:12:47Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Diffusion coefficient and Mean Square Displacement (MSD) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
Where d is the dimension and D is the diffusion coefficient. &lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&amp;lt;math&amp;gt;D=\frac{k_BT}{6\pi\eta r}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659174</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659174"/>
		<updated>2018-01-30T23:12:29Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Diffusion coefficient and Mean Square Displacement (MSD) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;&amp;lt;/math&amp;gt; is related to the time in equation below.&lt;br /&gt;
&amp;lt;math&amp;gt;&amp;lt;x^2&amp;gt;=2dDt&amp;lt;/math&amp;gt;&lt;br /&gt;
Where d is the dimension and D is the diffusion coefficient. &lt;br /&gt;
The diffusion coefficient, D is related to the Stokes-Einstein equation as follow, &lt;br /&gt;
&amp;lt;math&amp;gt;\frac{k_BT}{6\pi\eta r}&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659173</id>
		<title>Rep:LiquidSimulationkbg15</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:LiquidSimulationkbg15&amp;diff=659173"/>
		<updated>2018-01-30T23:10:00Z</updated>

		<summary type="html">&lt;p&gt;Kbg15: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Aims and Objectives==&lt;br /&gt;
&lt;br /&gt;
==Methods==&lt;br /&gt;
An example of the LAMMPS input script is attached as below, for density = 0.2 and temperature = 2.0.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
variable density equal 0.2&lt;br /&gt;
variable temperature equal 2.0&lt;br /&gt;
variable timestep equal 0.002&lt;br /&gt;
&lt;br /&gt;
lattice sc ${density}&lt;br /&gt;
region box block 0 15 0 15 0 15&lt;br /&gt;
create_box 1 box&lt;br /&gt;
create_atoms 1 box&lt;br /&gt;
&lt;br /&gt;
mass 1 1.0&lt;br /&gt;
pair_style lj/cut/opt 3.0&lt;br /&gt;
pair_coeff 1 1 1.0 1.0&lt;br /&gt;
neighbor 2.0 bin&lt;br /&gt;
&lt;br /&gt;
velocity all create ${temperature} 12345 dist gaussian rot yes mom yes&lt;br /&gt;
&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
fix nve all nve&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step time etotal temp press&lt;br /&gt;
thermo 10&lt;br /&gt;
&lt;br /&gt;
dump traj all custom 1000 output-1 id x y z&lt;br /&gt;
&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
variable tdamp equal ${timestep}*100&lt;br /&gt;
fix nvt all nvt temp ${temperature} ${temperature} ${tdamp}&lt;br /&gt;
run 10000&lt;br /&gt;
unfix nvt&lt;br /&gt;
fix nve all nve&lt;br /&gt;
reset_timestep 0&lt;br /&gt;
&lt;br /&gt;
thermo_style custom step atoms etotal temp vol density&lt;br /&gt;
variable temp equal temp&lt;br /&gt;
variable temp2 equal temp*temp&lt;br /&gt;
variable etotal equal etotal&lt;br /&gt;
variable etotal2 equal etotal*etotal&lt;br /&gt;
variable N2 equal atoms*atoms&lt;br /&gt;
fix aves all ave/time 100 1000 100000 v_temp v_etotal v_temp2 v_etotal2&lt;br /&gt;
run 100000&lt;br /&gt;
&lt;br /&gt;
variable avetemp equal f_aves[1]&lt;br /&gt;
variable var equal (f_aves[4]-f_aves[2]*f_aves[2])&lt;br /&gt;
variable heatcap equal ${N2}*(${var}/f_aves[3])&lt;br /&gt;
&lt;br /&gt;
print &amp;quot;Averages&amp;quot;&lt;br /&gt;
print &amp;quot;--------&amp;quot;&lt;br /&gt;
print &amp;quot;Ave Temperature: ${avetemp}&amp;quot;&lt;br /&gt;
print &amp;quot;Heat Capacity: ${heatcap}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Results and Discussion ==&lt;br /&gt;
&lt;br /&gt;
=== Numerical integration using Verlet algorithm in 1-D simple harmonic oscillator ===&lt;br /&gt;
1-D simple harmonic oscillator was used as a model to demonstrate the error of quantities calculated from the Verlet algorithm. From &#039;&#039;&#039;Figure 1&#039;&#039;&#039;, the values of the displacement x(t) calculated from Verlet algorithm was very close to the analytical values. The fluctuations of the total energy and error in displacement were plotted and related. When the error of the displacement at the local minima, the total energy of the system is at the local maxima. This phenomena could be explained by comparing with the analytical value of the total energy of a 1-D harmonic oscillator. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; E= \frac{1}{2}mv^2 + \frac{1}{2}kx^2 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
where E is the total energy of the 1-D harmonic oscillator. m is the mass, v is the velocity, k is the force constant and x is the displacement. &lt;br /&gt;
&lt;br /&gt;
By implying the relationships between displacement, velocity and time of the simple harmonic oscillator:  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; x= A cos(\omega t + \phi)  &amp;lt;/math&amp;gt; ;  &amp;lt;math&amp;gt; v=- A sin(\omega t + \phi)  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While m, k, A is 1, these equations give rise to the total energy of the system as a constant of 0.5. This result shows the first law of thermodynamic by conserving the total energy of the system. Therefore, fluctuation of the total energy in the system is because of the error from the Verlet algorithm. The total energy is closer to the analytical value when the error of the displacement is smaller, which normally happens with a small timestep.&lt;br /&gt;
&lt;br /&gt;
[[File:Simulationtheory1-kbg15.png|thumb|&#039;&#039;&#039;Figure 1:&#039;&#039;&#039; Verlet Algorithm gave rise to error in both the total energy and displacement of the 1-D simple harmonic oscillator. The error became more significant with the increase of timestep.  |centre|700x700px]]   &lt;br /&gt;
&lt;br /&gt;
By estimating the maxima of the displacement error-time graph, the maxima were fitted against time. A very strong positive correlation was obtained from the fitting with a constant time interval of 3.1 in &#039;&#039;&#039;Figure 2&#039;&#039;&#039;, which allows us to predict time of the next maxima with its corresponding magnitude.   &lt;br /&gt;
&lt;br /&gt;
The percentage difference of energy from it&#039;s maxima (true value in SHM) was used to represent the percentage error of the total energy of the system. The relationship between the percentage error of the total energy and timestep was determined. The percentage error of the total energy increases with timestep. Therefore, the larger the timestep, the more deviated the system is from reality, and conservation of energy is disobeyed at large timestep. Any system with percentage error of total energy more than 1% is avoided, which give rise to the usage of timestep of less than 0.2.  &lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulation4kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 2:&#039;&#039;&#039; Error in the displacement of 1-D harmonic oscillator calculated from Verlet algorithm oscillates. The peak (local maxima) happens with a fix time interval (3.1 s for this case) and the magnitude of the local maxima varies linearly with time.|left]][[File:Liquidsimulationtheory2kbg15.png|thumb|575x575px|&#039;&#039;&#039;Figure 3:&#039;&#039;&#039; Plot of percentage error of the total energy vs timestep. By changing the timestep, the magnitude of the fluctuation of total energy of the system gets larger with larger timestep. Quadratic relationship between percentage error of the total energy and timestep was obtained. ]]               &lt;br /&gt;
&lt;br /&gt;
By monitoring the total energy of the system, the conservation of energy is ensured to satisfy the first law of thermodynamics. The less the fluctuation of the total energy of the system, the better the system is in describing the reality which is bounded by the first law of thermodynamics. &lt;br /&gt;
&lt;br /&gt;
=== Analysing Lennard-Jones potential ===&lt;br /&gt;
[[File:Liquidsimulationtheory5kbg15.png|thumb|&#039;&#039;&#039;Figure 4:&#039;&#039;&#039; Comparison of a Lennard-Jones potential and Morse potentials with α scaled to fit the second derivative at the minimum (κ = 1), and obtained from fitting MP2 calculations (κ = 0.877). cite]]&lt;br /&gt;
Lennard-Jones potential is used to estimate the interaction between particles in a simulation. It is a rough estimate of the pair interaction which most of the neutral atoms or molecules abide. The Lennard-Jones potential is described as:   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt;is the depth of the potential well, &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the finite distance at which the potential is zero and &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; is the distance between particles.&lt;br /&gt;
&lt;br /&gt;
Differentiating the equation gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which the negative of this represents the force, as &amp;lt;math&amp;gt;\mathbf{F} = - \frac{\mathrm{d}\phi\left(\mathbf{r}\right)}{\mathrm{d}\mathbf{r}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At &amp;lt;math&amp;gt;r=\sigma&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi\left(\sigma\right)=0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi&#039;\left(\sigma\right) = 4\epsilon \left( - \frac{6}{\sigma} \right)&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\mathbf{F}=\frac{24\epsilon}{\sigma} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The positive sign of the force suggests that the force is repulsive. The repulsive term dominates when &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets closer to zero, and the equation diverges at &amp;lt;math&amp;gt;r=0&amp;lt;/math&amp;gt; due to the Pauli exclusion principle, which suggests that two particles could not be at the same space at the same time. &lt;br /&gt;
&lt;br /&gt;
The equilibrium distance, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt; is defined as the distance which &amp;lt;math&amp;gt;\mathbf{F}=0&amp;lt;/math&amp;gt;. Hence, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\phi&#039;\left(r\right) = 4\epsilon \left( - \frac{12\sigma^{12}}{r^{13}} + \frac{6\sigma^6}{r^7} \right) = 0 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which gives rise to &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma \approx 1.12 \sigma&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Integrating the potential gives, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r = 4\epsilon \left( - \frac{\sigma^{12}}{11 r^{11}} + \frac{\sigma^6}{6 r^5} \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As the equation converges at &amp;lt;math&amp;gt;r=\infty&amp;lt;/math&amp;gt;, the area under the curve gets smaller as &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; gets larger. Therefore, when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r= -0.02066 &amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.006811 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r = -0.002741 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In simulations, we define the cut-off point of the Lennard-Jones potential to ease the process of simulation as potential greater than the cut-off point is negligible.&lt;br /&gt;
&lt;br /&gt;
For example, the Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, this represents potential at &amp;lt;math&amp;gt;r &amp;gt; 3.2 \sigma = 1.088\mathrm{nm}&amp;lt;/math&amp;gt; is consider as zero. &lt;br /&gt;
&lt;br /&gt;
The well depth of the potential is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\epsilon = k_B\times120\mathrm{K} \approx 0.9977\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the reduced temperature, &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; is &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T = 1.5 \times 120\mathrm{K} = 180\mathrm{K} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Simulation box ===&lt;br /&gt;
The number of particles in a small volume is still relatively large for computer to process. For example, 1 mL of water contains &amp;lt;math&amp;gt;3.346\times10^{22}&amp;lt;/math&amp;gt; particles. For computer to simulate this amount of particles with their respective interactions will take ages. On the other hand, by simulating 10 000 water molecules, it only represents a volume of &amp;lt;math&amp;gt;2.99\times10^{-19}&amp;lt;/math&amp;gt; mL, which is too small to estimate bulk water. Therefore, the solution is to simulate 10 000 water molecules in a box and replicates &amp;lt;math&amp;gt;3.33\times10^{18}&amp;lt;/math&amp;gt; boxes side by side to generate 1 mL of water. These boxes are bound to the periodic boundary conditions. Atoms leaving the box will reenter the box from the opposite side to conserve the number of atoms in the box. For example, an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt; which moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt; will reenter the box from the opposite side and end up at position &amp;lt;math&amp;gt;\left(0.2, 0.1, 0.7\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Moreover, initial positions of the particles are not given randomly in the simulation box because two particles might end up at the same position or positions which they are very close to each other. This case causes the particles to disobey the Pauli exclusion principle, or causes the initial potential between particles to be extremely large. As particles take up space, hard sphere model suggests particles as impenetrable spheres that cannot overlap in space. Therefore, particles initial positions are being set in a lattice space. Initially, particles are being arranged in lattice model such as simple cubic and face-centred cubic lattice, then they are allowed to move and reach equilibrium after some time. For example, the following LAMMPS input &amp;lt;pre&amp;gt;lattice sc 0.8&amp;lt;/pre&amp;gt; generates simple cubic lattice with number density of 0.8. Since each unit cell in the simple cubic lattice has 1 atom, the volume of the unit cell must be 1.25, giving rise to the length of each side of the unit cell to be 1.077. For lattice fcc 1.2, each unit cell in the face-centred cubic lattice has 4 atoms, the volume of the unit cell is hence 3.33, giving rise to the side length of the unit cell to be 1.49. The following LAMMPS input&amp;lt;pre&amp;gt;&lt;br /&gt;
region box block 0 10 0 10 0 10&lt;br /&gt;
create_box 1 box&amp;lt;/pre&amp;gt; generates 10 unit cells in each of the x, y and z direction. Therefore, 1000 unit cells were generated, and 1000 atoms will be generated in simple cubic lattice, but 4000 atoms will be generated in face-centred cubic lattice. The following LAMMPS input&lt;br /&gt;
&amp;lt;pre&amp;gt;mass 1 1.0&lt;br /&gt;
pair_style lj/cut 3.0&lt;br /&gt;
pair_coeff * * 1.0 1.0&amp;lt;/pre&amp;gt;specifies the mass of type 1 atoms as 1.0, with Lennard-Jones potential without Coulombic interaction between particles with a cutoff at &amp;lt;math&amp;gt;r^* = 3&amp;lt;/math&amp;gt;. Pairwise forcefield coefficients are specified in the script as well, with the asterisks representing all types of atoms with coefficients of 1.0. This command would mean that all atoms have the same affinity towards one another. Increasing the coefficients will simply means increasing the affinity of the molecules, increasing their interaction strength. &lt;br /&gt;
&lt;br /&gt;
After setting up the particles&#039; initial positions and forcefield (which specifies particles&#039; initial velocity), Verlet algorithm or Leapfrog integration could be used to estimate the consecutive particles&#039; positions and velocities.&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input, &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
&amp;lt;/pre&amp;gt;define a new variable timestep, allowing us to change the timestep manually from the script. This variable is defined for convenience as it is called in the next line to compute the number of steps by itself from the timestep. Therefore, users do not need to change both the timesteps and the number of steps by themselves because the two of them are related, changing one of them will hence be sufficient. &lt;br /&gt;
&lt;br /&gt;
=== Equilibration ===&lt;br /&gt;
[[File:Liquidsimulationtheory6kbg15.png|thumb|705x705px|&#039;&#039;&#039;Figure 5:&#039;&#039;&#039; Total energy, temperature and pressure vs time graphs from simulation result for timestep of 0.001]]From Figure 5, the system reaches equilibrium after some time, showing a constant fluctuation in the total energy, temperature and pressure. This constant fluctuation of total energy shows that the system has reached equilibrium and the fluctuation in the total energy could be explained from the error which origins from the Verlet algorithm as shown from the section above. In order to show the fluctuation has no positive or negative correlation (a constant straight line), the product moment correlation coefficient of the fitting of the later points is used. &lt;br /&gt;
[[File:Liquidsimulationtheory7kbg15.png|left|thumb|655x655px|&#039;&#039;&#039;Figure 6:&#039;&#039;&#039; Line fitting of the equilibrium region with the corresponding upper and lower limits and the comparison of the squared product moment correlation coefficient (PMCC) with the starting time used in the line fitting for timestep of 0.001.]]                   &lt;br /&gt;
&lt;br /&gt;
Figure 6 shows if all the points from the graphs were used in line fitting, a line with negative PMCC will be obtained, which explains the graph&#039;s negative correlation. When the starting time used for line fitting is at 0.36, the PMCC is closest to zero which shows no positive or negative correlation. This time is when the system reaches equilibrium. After 0.36, the PMCC rises again due to the slight positive correlation of the graph.  &lt;br /&gt;
[[File:Liquidsimulationtheory8kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 7:&#039;&#039;&#039; Total energy vs time graphs for different timesteps]]&lt;br /&gt;
From Figure 7, 5 different timesteps were used in the simulation, but the largest timestep used, 0.015 shows a positive correlation instead of no correlation. Therefore, it is the worst choice of representation of reality because it does not reaches equilibrium, and the total energy diverges. This phenomenon could be explained from the error of the Verlet algorithm. Due to the nature of the Verlet algorithm which gives error while predicting the future value, when the timestep is sufficiently large, the error is too large, giving rise to larger error in the future values. The system hence move further and further away from the reality. The largest timestep from the 5 which gives acceptable result is 0.01, which is advantageous in observing the system for a long time using a short simulation time.  &lt;br /&gt;
&lt;br /&gt;
=== Isobaric-isothermal (NpT) ensemble ===&lt;br /&gt;
&lt;br /&gt;
From equipartition theorem, the total kinetic energy of a 3 dimension system is described as equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i v_i^2 = \frac{3}{2} N k_B T&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, due to the nature of the simulation, the temperature will fluctuates, and hence we modified the equation slightly with &amp;lt;math&amp;gt;\mathfrak{T}&amp;lt;/math&amp;gt; as our target temperature and &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; as a correction. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\frac{1}{2}\sum_i m_i \left(\gamma v_i\right)^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The two equations were used to solve &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;, giving rise to the equation below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following LAMMPS input&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;fix aves all ave/time 100 1000 100000 v_dens v_temp v_press v_dens2 v_temp2 v_press2&lt;br /&gt;
run 100000 &amp;lt;/pre&amp;gt;specify the averaging method of the variables (dens, temp, press, dens2, temp2 and press2). The three numbers 100, 1000 and 100 000 represents the value taken in every interval, number of values used in averaging, and the final averaged quantities generated on timesteps respectively. In layman term, the above input is a systematic sampling method which select values in every 100 data for example, the 100th data, 200th data, 300th data up to the 100 000th data, giving rise to 1000 measurements used to generate the average, and the total average is generated on the 100000th data. The following input line giving the number of steps in the simulation, with timestep of 0.075, a total time of 7500 (100 000*0.075) will be generated.&lt;br /&gt;
&lt;br /&gt;
For ideal gas, the density changes with temperature according to the equation below. The simulation situations at different pressures were compared with the ideal gas situations. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; \rho=\frac{PM}{RT} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt; is the density, P is the pressure, M is the molar mass, R is the gas constant and T is the temperature.&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory9kbg15.png|left|thumb|577x577px|&#039;&#039;&#039;Figure 8:&#039;&#039;&#039; Graphs of density vs temperature with simulation and ideal situation at different values of pressure, p&lt;br /&gt;
Error in density is too small to be observable in the errorbar.  &lt;br /&gt;
]]&lt;br /&gt;
[[File:Liquidsimulationtheory10kbg15.png|thumb|577x577px|&#039;&#039;&#039;Figure 9:&#039;&#039;&#039; Graphs of density vs temperature with simulation situation and ideal gas situation at pressure, p = 5 for a larger temperature range.]]&lt;br /&gt;
&lt;br /&gt;
From the graphs in Figure 8 and Figure 9, the simulated density is lower than the ideal gas density. However, at high temperatures, both graphs are converging to same density. This trend could be explained by the interaction between particles in the simulation. Ideal gas ignores all the interactions between particles and assuming particles&#039; volume is neglected. These assumptions were not included in the simulation, hence giving rise to repulsion between particles. Therefore, the inter-particle spacing gets larger, giving rise to a lower simulated density. However, the interaction becomes more negligible at higher temperatures, causing the particles in the simulation behaves more ideally, which hence explains the convergence of the two lines at high temperatures. The discrepancy between the densities of the simulated density and the ideal gas density is larger at high pressure because at higher pressure, the repulsion between the particles are more significant than the repulsion at lower pressure. Therefore, at high temperature and low pressure, particles behave like ideal gas. (cite) &lt;br /&gt;
&lt;br /&gt;
=== Microcanonical (NVE) ensemble and the specific heat capacity ===&lt;br /&gt;
&lt;br /&gt;
[[File:Liquidsimulationtheory11kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 10:&#039;&#039;&#039; Graphs of heat capacity / volume, C$_V$/V vs temperature at different densities. ]]For ideal gas, the internal energy, U is the sum of the kinetic energy and potential energy between all particles. Due to the fact that the potential energy is zero in ideal gas, the average kinetic energy follows the equipartition principle, giving rise to the equation below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; U = \frac{3}{2} NkT &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where N is the number of particles, k is the Boltzmann constant, and T is the temperature. &lt;br /&gt;
&lt;br /&gt;
Since the thermodynamic representation of the specific heat capacity at constant volume is the partial derivative of the internal energy respect to temperature at constant volume, the heat capacity of ideal gas hence follows the equation below. For reduced form of this quantity, the Boltzmann constant is equal to 1 and the number of particles and volume are constant in the ensemble, the specific heat capacity of ideal gas is hence a constant regardless of the temperature. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C_V = \left( \frac{\partial U}{\partial T} \right)_{V} = \frac{3}{2}Nk &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the section above, we noticed that in the simulation, particles deviates from the ideal behaviour. Therefore, in Figure 10, the quantity &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; decreases with temperature.&lt;br /&gt;
&lt;br /&gt;
Due to similar argument from the section above, simulated particles have interaction between one another and take up space, they repel each other, and cause the larger heat capacity compared to the ideal gas. The larger heat capacity explains more energy is needed to raise the temperature of the system as energy is used to break interactions between particles, allowing them to access higher translational states. Hence, the larger the heat capacity, the more deviated from ideal behaviour the system is. As particles behave ideally and high temperature and low pressure, increasing the temperature decreases the heat capacity; whereas increasing the density increases the pressure, which therefore increases the heat capacity.  &lt;br /&gt;
&lt;br /&gt;
=== Radial distribution function of different states ===&lt;br /&gt;
[[File:Liquidsimulationtheory12kbg15.png|thumb|510x510px|&#039;&#039;&#039;Figure 11:&#039;&#039;&#039; Radial distribution funciton, g(r) for different states. ]]&lt;br /&gt;
The radial distribution function, g(r) describes the density or in other word probability of finding a particle at a radial thin shell away from the centre of a particle with radius, r. the initial g(r) for all three states before r*=1 is zero, because no particles could be possibly found in that region. The g(r) of gas increases rapidly after r*=1 and reaches it&#039;s maximum before decreases and plateau at 1. This behaviour could be explained as gas particles have a single coordination sphere at the radius which gives the peak of g(r). This is the distance which the Van der Waals forces are the strongest, and it quickly decays to bulk density of gas, giving rise to the plateau of g(r) at 1 for larger particle separation. For g(r) of liquid, few peaks could be seen before the plateau, which signifies the few coordination spheres before the bulk density of liquid. The interaction strength between particles in liquid is larger, giving rise to first, second and even third coordination spheres. The peaks get smaller due to the depleted probability of finding particles outside the first coordination sphere which is caused by repulsion by the first coordination sphere. &lt;br /&gt;
[[File:Liquidsimulationtheory13kbg15.png|left|thumb|650x650px|&#039;&#039;&#039;Figure 12:&#039;&#039;&#039; The lattice packing in face-centred cubic unit cell.]]&lt;br /&gt;
However, in face-centred cubic solid, the infinite regular packing of the unit cells give rise to constant intervals of the peaks in the g(r). The peaks occur at &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt;represents the lattice packing of the solid. By imagine the black dot on the upper right back corner of the cubic unit cell in Figure 12, the three red particles closest to the black dot give rise to the first coordination sphere, which the distance is &amp;lt;math&amp;gt;\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;is the lattice spacing. A total of 12 red dots surround the black dot in repeating unit cells. The second coordination sphere will be the closest three black particles, which the distance is &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;from the black dot. A total of 6 black dots surround the black dot in repeating unit cells. The third coordination sphere will be the other three red dots, which the distance is &amp;lt;math&amp;gt;\sqrt{\frac{3}{2}} a&amp;lt;/math&amp;gt; away from the black dot, with a total of 12 red dots surround the black dot in repeating unit cells. By knowing &amp;lt;math&amp;gt;\sigma =\frac{1}{\sqrt 2} a&amp;lt;/math&amp;gt;, the distance of the coordination spheres from a particle will be &amp;lt;math&amp;gt;1\sigma&amp;lt;/math&amp;gt;,&amp;lt;math&amp;gt;\sqrt2\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\sqrt3\sigma&amp;lt;/math&amp;gt; as shown. The lattice spacing, hence is equal to the distance of the second coordination sphere from a particle with &amp;lt;math&amp;gt;r^*=\sqrt2 \approx 1.414&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Liquidsimulationtheory14kbg15.png|thumb|500x500px|&#039;&#039;&#039;Figure 13:&#039;&#039;&#039; Graphs of &amp;lt;math&amp;gt;\int g(r) dr&amp;lt;/math&amp;gt; against &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; for different states]]&lt;br /&gt;
Moreover, the coordination number could be predicted using the integration of g(r) in spherical coordinates, which gives rise to the probability of finding particles in that distance away from a particle, then multiply by the number density to get the coordination number, n(r) as shown in equation below. &amp;lt;math&amp;gt;n(r)=\rho \int_0^{r&#039;}g(r)4\pi r^2dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;However, the number of particles, N is directly proportional to the integral of g(r) as shown in equation below. Therefore, the graphs in Figure 13 shows that the curvature of graph is largest in solid and smallest in gas. This is due to the large density of particles in solid, which gives rise to large number of particles in the sphere with radius r. Relatively smaller density of liquid has smaller curvature in the graph whereas the least dense gas state has a smallest curvature of the curve. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt; N \propto \int g(r) dr &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Diffusion coefficient and Mean Square Displacement (MSD) ===&lt;br /&gt;
In the Einstein&#039;s relation for Brownian motion, the mean square displacement, &amp;lt;x^2&amp;gt; is related to the time in equation below. &lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
==References==&lt;/div&gt;</summary>
		<author><name>Kbg15</name></author>
	</entry>
</feed>