<?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=Yy3412</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=Yy3412"/>
	<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/wiki/Special:Contributions/Yy3412"/>
	<updated>2026-04-07T07:29:11Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495963</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495963"/>
		<updated>2015-03-13T11:48:47Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= 1.78\sigma^{-11}-2.5*10^{-2}\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=1.52*10^{-5}\sigma^{-11}-8.19*10^{-3}\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=2.05*10^{-6}\sigma^{-11}-3.29*10^{-3}\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up which is undesirable.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
Make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? &lt;br /&gt;
[[File:YY3412 0001.png|300px|thumb|Thermodynamic properties vs. time at 0.001 timestep.]]&lt;br /&gt;
 The simulation reaches the equilibrium.&lt;br /&gt;
 It takes about 0.25 to reach equilibrium.&lt;br /&gt;
&lt;br /&gt;
When you have done this, make a single plot which shows the energy versus time for all of the timesteps Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&lt;br /&gt;
 [[File:YY3412 Equlibrium.png|300px|thumb|Energy vs. time at different timesteps.]]&lt;br /&gt;
 Timestep of 0.0025 is the largest to give&lt;br /&gt;
 acceptable results as it almost provides&lt;br /&gt;
 the same result as the timestep of 0.0001&lt;br /&gt;
 during course of approximation.&lt;br /&gt;
 However, if using both timesteps to simulate&lt;br /&gt;
 same number of steps, timestep of 0.0025&lt;br /&gt;
 will have 2.5 times more of actual simulation&lt;br /&gt;
 time, and is desirable for long time simulation.&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
 The trend showing that there is inverse correlation between Cv/V and density,&lt;br /&gt;
 increasing temperature causing decreasing Cv/V both agree with real condition.&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The rdf of solid is continuous array of sharp spikes but decreasing with increasing r.&lt;br /&gt;
 This sharp spikes suggests that most particles lie in definite locations with only small oscillation.&lt;br /&gt;
 The rdf of liquid is more smooth,with only two slightly sharper peak, meaning less ordered structure.&lt;br /&gt;
 The particles closer to the target particle may still adopt the their initial position while the further particles clear do not,&lt;br /&gt;
 which the probability of finding a particle in different places of long distance is all equal.&lt;br /&gt;
 The rdf of gas only has one sharp peak, which is the position with lowest Lennard-Jones potential,&lt;br /&gt;
 where particles are more likely to stay, also the probability of finding particles in other places further than that is all the same.&lt;br /&gt;
&lt;br /&gt;
In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The first three peaks correspond to face-centered-cubic structure.&lt;br /&gt;
 In solid, the first three peaks have [r,g(r)] as [1.075,3.347],[1.575,0.617] [1.925,1.720], &lt;br /&gt;
 the output file shows the lattice spacing r is1.5874 is close to the r of the second peak (r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ).&lt;br /&gt;
 First peak at r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2/ \sqrt2&amp;lt;/math&amp;gt;,&lt;br /&gt;
 third peak at r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2* \sqrt2&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, in a cubic, if the position of reference particle is at (0,0,0),&lt;br /&gt;
 then particles with distance r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has relative position (0.5,0.5,0) and coordination number is 12;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; has relative position (1,0,0) and the coordination number is 6;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has relative position (1,0,1) and the coordination number is 12.&lt;br /&gt;
 &lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&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\left(t\right)=\frac{dx}{dt}=-A\omega sin\left(\omega t+\phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
 [[File:YY3412 vacf.png|300px|thumb|Velocity autocorrelation function vs. time of gas, liquid and solid.]]&lt;br /&gt;
Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&lt;br /&gt;
&lt;br /&gt;
Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&lt;br /&gt;
 The trapezium rule is &amp;lt;math&amp;gt;\int_{0}^{5000} f\left(x\right)dx=\frac{1}{2}h \left[\left(y_0+y_{5000}\right)+2\left(y_1+y_2+y_{4999}\right)\right]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;h=\left(x_n-x_0\right)/n&amp;lt;/math&amp;gt;.&lt;br /&gt;
 For solid, integration equals to 26.96, for liquid, integration equals to 146.83, integration equals to 3204.02.&lt;br /&gt;
 &lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_vacf.png&amp;diff=495959</id>
		<title>File:YY3412 vacf.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_vacf.png&amp;diff=495959"/>
		<updated>2015-03-13T11:47:10Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495958</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495958"/>
		<updated>2015-03-13T11:45:41Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Velocity Autocorrelation Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= 1.78\sigma^{-11}-2.5*10^{-2}\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=1.52*10^{-5}\sigma^{-11}-8.19*10^{-3}\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=2.05*10^{-6}\sigma^{-11}-3.29*10^{-3}\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up which is undesirable.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
Make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? &lt;br /&gt;
[[File:YY3412 0001.png|300px|thumb|Thermodynamic properties vs. time at 0.001 timestep.]]&lt;br /&gt;
 The simulation reaches the equilibrium.&lt;br /&gt;
 It takes about 0.25 to reach equilibrium.&lt;br /&gt;
&lt;br /&gt;
When you have done this, make a single plot which shows the energy versus time for all of the timesteps Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&lt;br /&gt;
 [[File:YY3412 Equlibrium.png|300px|thumb|Energy vs. time at different timesteps.]]&lt;br /&gt;
 Timestep of 0.0025 is the largest to give&lt;br /&gt;
 acceptable results as it almost provides&lt;br /&gt;
 the same result as the timestep of 0.0001&lt;br /&gt;
 during course of approximation.&lt;br /&gt;
 However, if using both timesteps to simulate&lt;br /&gt;
 same number of steps, timestep of 0.0025&lt;br /&gt;
 will have 2.5 times more of actual simulation&lt;br /&gt;
 time, and is desirable for long time simulation.&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
 The trend showing that there is inverse correlation between Cv/V and density,&lt;br /&gt;
 increasing temperature causing decreasing Cv/V both agree with real condition.&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The rdf of solid is continuous array of sharp spikes but decreasing with increasing r.&lt;br /&gt;
 This sharp spikes suggests that most particles lie in definite locations with only small oscillation.&lt;br /&gt;
 The rdf of liquid is more smooth,with only two slightly sharper peak, meaning less ordered structure.&lt;br /&gt;
 The particles closer to the target particle may still adopt the their initial position while the further particles clear do not,&lt;br /&gt;
 which the probability of finding a particle in different places of long distance is all equal.&lt;br /&gt;
 The rdf of gas only has one sharp peak, which is the position with lowest Lennard-Jones potential,&lt;br /&gt;
 where particles are more likely to stay, also the probability of finding particles in other places further than that is all the same.&lt;br /&gt;
&lt;br /&gt;
In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The first three peaks correspond to face-centered-cubic structure.&lt;br /&gt;
 In solid, the first three peaks have [r,g(r)] as [1.075,3.347],[1.575,0.617] [1.925,1.720], &lt;br /&gt;
 the output file shows the lattice spacing r is1.5874 is close to the r of the second peak (r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ).&lt;br /&gt;
 First peak at r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2/ \sqrt2&amp;lt;/math&amp;gt;,&lt;br /&gt;
 third peak at r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2* \sqrt2&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, in a cubic, if the position of reference particle is at (0,0,0),&lt;br /&gt;
 then particles with distance r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has relative position (0.5,0.5,0) and coordination number is 12;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; has relative position (1,0,0) and the coordination number is 6;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has relative position (1,0,1) and the coordination number is 12.&lt;br /&gt;
 &lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&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\left(t\right)=\frac{dx}{dt}=-A\omega sin\left(\omega t+\phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&lt;br /&gt;
&lt;br /&gt;
Use the trapezium rule to approximate the integral under the velocity autocorrelation function for the solid, liquid, and gas, and use these values to estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. You should make a plot of the running integral in each case. Are they as you expect? Repeat this procedure for the VACF data that you were given from the one million atom simulations. What do you think is the largest source of error in your estimates of D from the VACF?&lt;br /&gt;
 The trapezium rule is &amp;lt;math&amp;gt;\int_{0}^{5000} f\left(x\right)dx=\frac{1}{2}h \left[\left(y_0+y_{5000}\right)+2\left(y_1+y_2+y_{4999}\right)\right]&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;h=\left(x_n-x_0\right)/n&amp;lt;/math&amp;gt;.&lt;br /&gt;
 For solid, integration equals to 26.96, for liquid, integration equals to 146.83, integration equals to 3204.02.&lt;br /&gt;
 &lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495934</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495934"/>
		<updated>2015-03-13T10:26:49Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Atomic Forces */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= 1.78\sigma^{-11}-2.5*10^{-2}\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=1.52*10^{-5}\sigma^{-11}-8.19*10^{-3}\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=2.05*10^{-6}\sigma^{-11}-3.29*10^{-3}\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up which is undesirable.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
Make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? &lt;br /&gt;
[[File:YY3412 0001.png|300px|thumb|Thermodynamic properties vs. time at 0.001 timestep.]]&lt;br /&gt;
 The simulation reaches the equilibrium.&lt;br /&gt;
 It takes about 0.25 to reach equilibrium.&lt;br /&gt;
&lt;br /&gt;
When you have done this, make a single plot which shows the energy versus time for all of the timesteps Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&lt;br /&gt;
 [[File:YY3412 Equlibrium.png|300px|thumb|Energy vs. time at different timesteps.]]&lt;br /&gt;
 Timestep of 0.0025 is the largest to give&lt;br /&gt;
 acceptable results as it almost provides&lt;br /&gt;
 the same result as the timestep of 0.0001&lt;br /&gt;
 during course of approximation.&lt;br /&gt;
 However, if using both timesteps to simulate&lt;br /&gt;
 same number of steps, timestep of 0.0025&lt;br /&gt;
 will have 2.5 times more of actual simulation&lt;br /&gt;
 time, and is desirable for long time simulation.&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
 The trend showing that there is inverse correlation between Cv/V and density,&lt;br /&gt;
 increasing temperature causing decreasing Cv/V both agree with real condition.&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The rdf of solid is continuous array of sharp spikes but decreasing with increasing r.&lt;br /&gt;
 This sharp spikes suggests that most particles lie in definite locations with only small oscillation.&lt;br /&gt;
 The rdf of liquid is more smooth,with only two slightly sharper peak, meaning less ordered structure.&lt;br /&gt;
 The particles closer to the target particle may still adopt the their initial position while the further particles clear do not,&lt;br /&gt;
 which the probability of finding a particle in different places of long distance is all equal.&lt;br /&gt;
 The rdf of gas only has one sharp peak, which is the position with lowest Lennard-Jones potential,&lt;br /&gt;
 where particles are more likely to stay, also the probability of finding particles in other places further than that is all the same.&lt;br /&gt;
&lt;br /&gt;
In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The first three peaks correspond to face-centered-cubic structure.&lt;br /&gt;
 In solid, the first three peaks have [r,g(r)] as [1.075,3.347],[1.575,0.617] [1.925,1.720], &lt;br /&gt;
 the output file shows the lattice spacing r is1.5874 is close to the r of the second peak (r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ).&lt;br /&gt;
 First peak at r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2/ \sqrt2&amp;lt;/math&amp;gt;,&lt;br /&gt;
 third peak at r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2* \sqrt2&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, in a cubic, if the position of reference particle is at (0,0,0),&lt;br /&gt;
 then particles with distance r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has relative position (0.5,0.5,0) and coordination number is 12;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; has relative position (1,0,0) and the coordination number is 6;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has relative position (1,0,1) and the coordination number is 12.&lt;br /&gt;
 &lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&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\left(t\right)=\frac{dx}{dt}=-A\omega sin\left(\omega t+\phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495930</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495930"/>
		<updated>2015-03-13T10:20:24Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Atomic Forces */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= 1.78\sigma^{-11}-2.5*10^{-2}\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=1.52*10^{-5}{\sigma^{-11}-8.19*10^{-3}\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up which is undesirable.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
Make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? &lt;br /&gt;
[[File:YY3412 0001.png|300px|thumb|Thermodynamic properties vs. time at 0.001 timestep.]]&lt;br /&gt;
 The simulation reaches the equilibrium.&lt;br /&gt;
 It takes about 0.25 to reach equilibrium.&lt;br /&gt;
&lt;br /&gt;
When you have done this, make a single plot which shows the energy versus time for all of the timesteps Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&lt;br /&gt;
 [[File:YY3412 Equlibrium.png|300px|thumb|Energy vs. time at different timesteps.]]&lt;br /&gt;
 Timestep of 0.0025 is the largest to give&lt;br /&gt;
 acceptable results as it almost provides&lt;br /&gt;
 the same result as the timestep of 0.0001&lt;br /&gt;
 during course of approximation.&lt;br /&gt;
 However, if using both timesteps to simulate&lt;br /&gt;
 same number of steps, timestep of 0.0025&lt;br /&gt;
 will have 2.5 times more of actual simulation&lt;br /&gt;
 time, and is desirable for long time simulation.&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
 The trend showing that there is inverse correlation between Cv/V and density,&lt;br /&gt;
 increasing temperature causing decreasing Cv/V both agree with real condition.&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The rdf of solid is continuous array of sharp spikes but decreasing with increasing r.&lt;br /&gt;
 This sharp spikes suggests that most particles lie in definite locations with only small oscillation.&lt;br /&gt;
 The rdf of liquid is more smooth,with only two slightly sharper peak, meaning less ordered structure.&lt;br /&gt;
 The particles closer to the target particle may still adopt the their initial position while the further particles clear do not,&lt;br /&gt;
 which the probability of finding a particle in different places of long distance is all equal.&lt;br /&gt;
 The rdf of gas only has one sharp peak, which is the position with lowest Lennard-Jones potential,&lt;br /&gt;
 where particles are more likely to stay, also the probability of finding particles in other places further than that is all the same.&lt;br /&gt;
&lt;br /&gt;
In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The first three peaks correspond to face-centered-cubic structure.&lt;br /&gt;
 In solid, the first three peaks have [r,g(r)] as [1.075,3.347],[1.575,0.617] [1.925,1.720], &lt;br /&gt;
 the output file shows the lattice spacing r is1.5874 is close to the r of the second peak (r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ).&lt;br /&gt;
 First peak at r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2/ \sqrt2&amp;lt;/math&amp;gt;,&lt;br /&gt;
 third peak at r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2* \sqrt2&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, in a cubic, if the position of reference particle is at (0,0,0),&lt;br /&gt;
 then particles with distance r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has relative position (0.5,0.5,0) and coordination number is 12;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; has relative position (1,0,0) and the coordination number is 6;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has relative position (1,0,1) and the coordination number is 12.&lt;br /&gt;
 &lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&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\left(t\right)=\frac{dx}{dt}=-A\omega sin\left(\omega t+\phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495876</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495876"/>
		<updated>2015-03-13T07:38:27Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Calculating heat capacities using statistical physics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up which is undesirable.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
Make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? &lt;br /&gt;
[[File:YY3412 0001.png|300px|thumb|Thermodynamic properties vs. time at 0.001 timestep.]]&lt;br /&gt;
 The simulation reaches the equilibrium.&lt;br /&gt;
 It takes about 0.25 to reach equilibrium.&lt;br /&gt;
&lt;br /&gt;
When you have done this, make a single plot which shows the energy versus time for all of the timesteps Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&lt;br /&gt;
 [[File:YY3412 Equlibrium.png|300px|thumb|Energy vs. time at different timesteps.]]&lt;br /&gt;
 Timestep of 0.0025 is the largest to give&lt;br /&gt;
 acceptable results as it almost provides&lt;br /&gt;
 the same result as the timestep of 0.0001&lt;br /&gt;
 during course of approximation.&lt;br /&gt;
 However, if using both timesteps to simulate&lt;br /&gt;
 same number of steps, timestep of 0.0025&lt;br /&gt;
 will have 2.5 times more of actual simulation&lt;br /&gt;
 time, and is desirable for long time simulation.&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
 The trend showing that there is inverse correlation between Cv/V and density,&lt;br /&gt;
 increasing temperature causing decreasing Cv/V both agree with real condition.&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The rdf of solid is continuous array of sharp spikes but decreasing with increasing r.&lt;br /&gt;
 This sharp spikes suggests that most particles lie in definite locations with only small oscillation.&lt;br /&gt;
 The rdf of liquid is more smooth,with only two slightly sharper peak, meaning less ordered structure.&lt;br /&gt;
 The particles closer to the target particle may still adopt the their initial position while the further particles clear do not,&lt;br /&gt;
 which the probability of finding a particle in different places of long distance is all equal.&lt;br /&gt;
 The rdf of gas only has one sharp peak, which is the position with lowest Lennard-Jones potential,&lt;br /&gt;
 where particles are more likely to stay, also the probability of finding particles in other places further than that is all the same.&lt;br /&gt;
&lt;br /&gt;
In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The first three peaks correspond to face-centered-cubic structure.&lt;br /&gt;
 In solid, the first three peaks have [r,g(r)] as [1.075,3.347],[1.575,0.617] [1.925,1.720], &lt;br /&gt;
 the output file shows the lattice spacing r is1.5874 is close to the r of the second peak (r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ).&lt;br /&gt;
 First peak at r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2/ \sqrt2&amp;lt;/math&amp;gt;,&lt;br /&gt;
 third peak at r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2* \sqrt2&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, in a cubic, if the position of reference particle is at (0,0,0),&lt;br /&gt;
 then particles with distance r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has relative position (0.5,0.5,0) and coordination number is 12;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; has relative position (1,0,0) and the coordination number is 6;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has relative position (1,0,1) and the coordination number is 12.&lt;br /&gt;
 &lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&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\left(t\right)=\frac{dx}{dt}=-A\omega sin\left(\omega t+\phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495867</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495867"/>
		<updated>2015-03-13T06:35:23Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Dynamical properties and the diffusion coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up which is undesirable.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
Make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? &lt;br /&gt;
[[File:YY3412 0001.png|300px|thumb|Thermodynamic properties vs. time at 0.001 timestep.]]&lt;br /&gt;
 The simulation reaches the equilibrium.&lt;br /&gt;
 It takes about 0.25 to reach equilibrium.&lt;br /&gt;
&lt;br /&gt;
When you have done this, make a single plot which shows the energy versus time for all of the timesteps Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&lt;br /&gt;
 [[File:YY3412 Equlibrium.png|300px|thumb|Energy vs. time at different timesteps.]]&lt;br /&gt;
 Timestep of 0.0025 is the largest to give&lt;br /&gt;
 acceptable results as it almost provides&lt;br /&gt;
 the same result as the timestep of 0.0001&lt;br /&gt;
 during course of approximation.&lt;br /&gt;
 However, if using both timesteps to simulate&lt;br /&gt;
 same number of steps, timestep of 0.0025&lt;br /&gt;
 will have 2.5 times more of actual simulation&lt;br /&gt;
 time, and is desirable for long time simulation.&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The rdf of solid is continuous array of sharp spikes but decreasing with increasing r.&lt;br /&gt;
 This sharp spikes suggests that most particles lie in definite locations with only small oscillation.&lt;br /&gt;
 The rdf of liquid is more smooth,with only two slightly sharper peak, meaning less ordered structure.&lt;br /&gt;
 The particles closer to the target particle may still adopt the their initial position while the further particles clear do not,&lt;br /&gt;
 which the probability of finding a particle in different places of long distance is all equal.&lt;br /&gt;
 The rdf of gas only has one sharp peak, which is the position with lowest Lennard-Jones potential,&lt;br /&gt;
 where particles are more likely to stay, also the probability of finding particles in other places further than that is all the same.&lt;br /&gt;
&lt;br /&gt;
In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The first three peaks correspond to face-centered-cubic structure.&lt;br /&gt;
 In solid, the first three peaks have [r,g(r)] as [1.075,3.347],[1.575,0.617] [1.925,1.720], &lt;br /&gt;
 the output file shows the lattice spacing r is1.5874 is close to the r of the second peak (r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ).&lt;br /&gt;
 First peak at r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2/ \sqrt2&amp;lt;/math&amp;gt;,&lt;br /&gt;
 third peak at r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2* \sqrt2&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, in a cubic, if the position of reference particle is at (0,0,0),&lt;br /&gt;
 then particles with distance r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has relative position (0.5,0.5,0) and coordination number is 12;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; has relative position (1,0,0) and the coordination number is 6;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has relative position (1,0,1) and the coordination number is 12.&lt;br /&gt;
 &lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
===Mean Squared Displacement===&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Velocity Autocorrelation Function===&lt;br /&gt;
In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&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\left(t\right)=\frac{dx}{dt}=-A\omega sin\left(\omega t+\phi\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495861</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495861"/>
		<updated>2015-03-13T06:20:25Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Creating the simulation box */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up which is undesirable.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
Make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? &lt;br /&gt;
[[File:YY3412 0001.png|300px|thumb|Thermodynamic properties vs. time at 0.001 timestep.]]&lt;br /&gt;
 The simulation reaches the equilibrium.&lt;br /&gt;
 It takes about 0.25 to reach equilibrium.&lt;br /&gt;
&lt;br /&gt;
When you have done this, make a single plot which shows the energy versus time for all of the timesteps Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&lt;br /&gt;
 [[File:YY3412 Equlibrium.png|300px|thumb|Energy vs. time at different timesteps.]]&lt;br /&gt;
 Timestep of 0.0025 is the largest to give&lt;br /&gt;
 acceptable results as it almost provides&lt;br /&gt;
 the same result as the timestep of 0.0001&lt;br /&gt;
 during course of approximation.&lt;br /&gt;
 However, if using both timesteps to simulate&lt;br /&gt;
 same number of steps, timestep of 0.0025&lt;br /&gt;
 will have 2.5 times more of actual simulation&lt;br /&gt;
 time, and is desirable for long time simulation.&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The rdf of solid is continuous array of sharp spikes but decreasing with increasing r.&lt;br /&gt;
 This sharp spikes suggests that most particles lie in definite locations with only small oscillation.&lt;br /&gt;
 The rdf of liquid is more smooth,with only two slightly sharper peak, meaning less ordered structure.&lt;br /&gt;
 The particles closer to the target particle may still adopt the their initial position while the further particles clear do not,&lt;br /&gt;
 which the probability of finding a particle in different places of long distance is all equal.&lt;br /&gt;
 The rdf of gas only has one sharp peak, which is the position with lowest Lennard-Jones potential,&lt;br /&gt;
 where particles are more likely to stay, also the probability of finding particles in other places further than that is all the same.&lt;br /&gt;
&lt;br /&gt;
In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The first three peaks correspond to face-centered-cubic structure.&lt;br /&gt;
 In solid, the first three peaks have [r,g(r)] as [1.075,3.347],[1.575,0.617] [1.925,1.720], &lt;br /&gt;
 the output file shows the lattice spacing r is1.5874 is close to the r of the second peak (r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ).&lt;br /&gt;
 First peak at r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2/ \sqrt2&amp;lt;/math&amp;gt;,&lt;br /&gt;
 third peak at r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2* \sqrt2&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, in a cubic, if the position of reference particle is at (0,0,0),&lt;br /&gt;
 then particles with distance r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has relative position (0.5,0.5,0) and coordination number is 12;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; has relative position (1,0,0) and the coordination number is 6;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has relative position (1,0,1) and the coordination number is 12.&lt;br /&gt;
 &lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495860</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495860"/>
		<updated>2015-03-13T06:20:00Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Creating the simulation box */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up which is undisirable.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
Make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? &lt;br /&gt;
[[File:YY3412 0001.png|300px|thumb|Thermodynamic properties vs. time at 0.001 timestep.]]&lt;br /&gt;
 The simulation reaches the equilibrium.&lt;br /&gt;
 It takes about 0.25 to reach equilibrium.&lt;br /&gt;
&lt;br /&gt;
When you have done this, make a single plot which shows the energy versus time for all of the timesteps Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&lt;br /&gt;
 [[File:YY3412 Equlibrium.png|300px|thumb|Energy vs. time at different timesteps.]]&lt;br /&gt;
 Timestep of 0.0025 is the largest to give&lt;br /&gt;
 acceptable results as it almost provides&lt;br /&gt;
 the same result as the timestep of 0.0001&lt;br /&gt;
 during course of approximation.&lt;br /&gt;
 However, if using both timesteps to simulate&lt;br /&gt;
 same number of steps, timestep of 0.0025&lt;br /&gt;
 will have 2.5 times more of actual simulation&lt;br /&gt;
 time, and is desirable for long time simulation.&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The rdf of solid is continuous array of sharp spikes but decreasing with increasing r.&lt;br /&gt;
 This sharp spikes suggests that most particles lie in definite locations with only small oscillation.&lt;br /&gt;
 The rdf of liquid is more smooth,with only two slightly sharper peak, meaning less ordered structure.&lt;br /&gt;
 The particles closer to the target particle may still adopt the their initial position while the further particles clear do not,&lt;br /&gt;
 which the probability of finding a particle in different places of long distance is all equal.&lt;br /&gt;
 The rdf of gas only has one sharp peak, which is the position with lowest Lennard-Jones potential,&lt;br /&gt;
 where particles are more likely to stay, also the probability of finding particles in other places further than that is all the same.&lt;br /&gt;
&lt;br /&gt;
In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The first three peaks correspond to face-centered-cubic structure.&lt;br /&gt;
 In solid, the first three peaks have [r,g(r)] as [1.075,3.347],[1.575,0.617] [1.925,1.720], &lt;br /&gt;
 the output file shows the lattice spacing r is1.5874 is close to the r of the second peak (r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ).&lt;br /&gt;
 First peak at r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2/ \sqrt2&amp;lt;/math&amp;gt;,&lt;br /&gt;
 third peak at r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2* \sqrt2&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, in a cubic, if the position of reference particle is at (0,0,0),&lt;br /&gt;
 then particles with distance r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has relative position (0.5,0.5,0) and coordination number is 12;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; has relative position (1,0,0) and the coordination number is 6;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has relative position (1,0,1) and the coordination number is 12.&lt;br /&gt;
 &lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495859</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495859"/>
		<updated>2015-03-13T06:15:12Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Checking equilibration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
Make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? &lt;br /&gt;
[[File:YY3412 0001.png|300px|thumb|Thermodynamic properties vs. time at 0.001 timestep.]]&lt;br /&gt;
 The simulation reaches the equilibrium.&lt;br /&gt;
 It takes about 0.25 to reach equilibrium.&lt;br /&gt;
&lt;br /&gt;
When you have done this, make a single plot which shows the energy versus time for all of the timesteps Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&lt;br /&gt;
 [[File:YY3412 Equlibrium.png|300px|thumb|Energy vs. time at different timesteps.]]&lt;br /&gt;
 Timestep of 0.0025 is the largest to give&lt;br /&gt;
 acceptable results as it almost provides&lt;br /&gt;
 the same result as the timestep of 0.0001&lt;br /&gt;
 during course of approximation.&lt;br /&gt;
 However, if using both timesteps to simulate&lt;br /&gt;
 same number of steps, timestep of 0.0025&lt;br /&gt;
 will have 2.5 times more of actual simulation&lt;br /&gt;
 time, and is desirable for long time simulation.&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The rdf of solid is continuous array of sharp spikes but decreasing with increasing r.&lt;br /&gt;
 This sharp spikes suggests that most particles lie in definite locations with only small oscillation.&lt;br /&gt;
 The rdf of liquid is more smooth,with only two slightly sharper peak, meaning less ordered structure.&lt;br /&gt;
 The particles closer to the target particle may still adopt the their initial position while the further particles clear do not,&lt;br /&gt;
 which the probability of finding a particle in different places of long distance is all equal.&lt;br /&gt;
 The rdf of gas only has one sharp peak, which is the position with lowest Lennard-Jones potential,&lt;br /&gt;
 where particles are more likely to stay, also the probability of finding particles in other places further than that is all the same.&lt;br /&gt;
&lt;br /&gt;
In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The first three peaks correspond to face-centered-cubic structure.&lt;br /&gt;
 In solid, the first three peaks have [r,g(r)] as [1.075,3.347],[1.575,0.617] [1.925,1.720], &lt;br /&gt;
 the output file shows the lattice spacing r is1.5874 is close to the r of the second peak (r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ).&lt;br /&gt;
 First peak at r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2/ \sqrt2&amp;lt;/math&amp;gt;,&lt;br /&gt;
 third peak at r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2* \sqrt2&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, in a cubic, if the position of reference particle is at (0,0,0),&lt;br /&gt;
 then particles with distance r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has relative position (0.5,0.5,0) and coordination number is 12;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; has relative position (1,0,0) and the coordination number is 6;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has relative position (1,0,1) and the coordination number is 12.&lt;br /&gt;
 &lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_Equlibrium.png&amp;diff=495857</id>
		<title>File:YY3412 Equlibrium.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_Equlibrium.png&amp;diff=495857"/>
		<updated>2015-03-13T06:02:33Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495855</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495855"/>
		<updated>2015-03-13T05:54:12Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Checking equilibration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
Make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? &lt;br /&gt;
YY3412 0001.png&lt;br /&gt;
When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The rdf of solid is continuous array of sharp spikes but decreasing with increasing r.&lt;br /&gt;
 This sharp spikes suggests that most particles lie in definite locations with only small oscillation.&lt;br /&gt;
 The rdf of liquid is more smooth,with only two slightly sharper peak, meaning less ordered structure.&lt;br /&gt;
 The particles closer to the target particle may still adopt the their initial position while the further particles clear do not,&lt;br /&gt;
 which the probability of finding a particle in different places of long distance is all equal.&lt;br /&gt;
 The rdf of gas only has one sharp peak, which is the position with lowest Lennard-Jones potential,&lt;br /&gt;
 where particles are more likely to stay, also the probability of finding particles in other places further than that is all the same.&lt;br /&gt;
&lt;br /&gt;
In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The first three peaks correspond to face-centered-cubic structure.&lt;br /&gt;
 In solid, the first three peaks have [r,g(r)] as [1.075,3.347],[1.575,0.617] [1.925,1.720], &lt;br /&gt;
 the output file shows the lattice spacing r is1.5874 is close to the r of the second peak (r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ).&lt;br /&gt;
 First peak at r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2/ \sqrt2&amp;lt;/math&amp;gt;,&lt;br /&gt;
 third peak at r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2* \sqrt2&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, in a cubic, if the position of reference particle is at (0,0,0),&lt;br /&gt;
 then particles with distance r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has relative position (0.5,0.5,0) and coordination number is 12;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; has relative position (1,0,0) and the coordination number is 6;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has relative position (1,0,1) and the coordination number is 12.&lt;br /&gt;
 &lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_0001.png&amp;diff=495854</id>
		<title>File:YY3412 0001.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_0001.png&amp;diff=495854"/>
		<updated>2015-03-13T05:53:42Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495853</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495853"/>
		<updated>2015-03-13T05:43:56Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Structural properties and the radial distribution function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The rdf of solid is continuous array of sharp spikes but decreasing with increasing r.&lt;br /&gt;
 This sharp spikes suggests that most particles lie in definite locations with only small oscillation.&lt;br /&gt;
 The rdf of liquid is more smooth,with only two slightly sharper peak, meaning less ordered structure.&lt;br /&gt;
 The particles closer to the target particle may still adopt the their initial position while the further particles clear do not,&lt;br /&gt;
 which the probability of finding a particle in different places of long distance is all equal.&lt;br /&gt;
 The rdf of gas only has one sharp peak, which is the position with lowest Lennard-Jones potential,&lt;br /&gt;
 where particles are more likely to stay, also the probability of finding particles in other places further than that is all the same.&lt;br /&gt;
&lt;br /&gt;
In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The first three peaks correspond to face-centered-cubic structure.&lt;br /&gt;
 In solid, the first three peaks have [r,g(r)] as [1.075,3.347],[1.575,0.617] [1.925,1.720], &lt;br /&gt;
 the output file shows the lattice spacing r is1.5874 is close to the r of the second peak (r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ).&lt;br /&gt;
 First peak at r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2/ \sqrt2&amp;lt;/math&amp;gt;,&lt;br /&gt;
 third peak at r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has approximate value of &amp;lt;math&amp;gt;r_2* \sqrt2&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, in a cubic, if the position of reference particle is at (0,0,0),&lt;br /&gt;
 then particles with distance r&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; has relative position (0.5,0.5,0) and coordination number is 12;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; has relative position (1,0,0) and the coordination number is 6;&lt;br /&gt;
 particles with distance r&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt; has relative position (1,0,1) and the coordination number is 12.&lt;br /&gt;
 &lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495848</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495848"/>
		<updated>2015-03-13T04:54:22Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Structural properties and the radial distribution function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 The rdf of solid is continuous array of sharp spikes but decreasing with increasing r.&lt;br /&gt;
 This sharp spikes suggests that most particles lie in definite locations with only small oscillation.&lt;br /&gt;
 The rdf of liquid is more smooth,with only two slightly sharper peak, meaning less ordered structure.&lt;br /&gt;
 The particles closer to the target particle may still adopt the their initial position while the further particles clear do not,&lt;br /&gt;
 which the probability of finding a particle in different places of long distance is all equal.&lt;br /&gt;
 The rdf of gas only has one sharp peak, which is the position with lowest Lennard-Jones potential,&lt;br /&gt;
 where particles are more likely to stay, also the probability of finding particles in other places further than that is all the same.&lt;br /&gt;
&lt;br /&gt;
In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
 In solid, the first three peaks have [r,g(r)] as [1.075,3.347], [1.925,1.720], [2.975,1.453]. &lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495847</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495847"/>
		<updated>2015-03-13T04:03:28Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Dynamical properties and the diffusion coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
 The msd plot agrees with the realistic condition.&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495846</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495846"/>
		<updated>2015-03-13T04:02:10Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Dynamical properties and the diffusion coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas from initial position during the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495845</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495845"/>
		<updated>2015-03-13T04:01:13Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Dynamical properties and the diffusion coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 Solid and liquid diffuse less than gas in the same period of time due to their strong intermolecular force.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495844</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495844"/>
		<updated>2015-03-13T03:59:17Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Dynamical properties and the diffusion coefficient */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
Make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 msd.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 msd large.png|300px|thumb|Mean square displacement vs. step of gas, liquid and solid with one million atoms.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The general trend of msd is gas&amp;gt;liquid&amp;gt;solid and msd of gas increases much more with time than other two.&lt;br /&gt;
 The gradient msd of each state is shown in plot above. &lt;br /&gt;
 For gas, &amp;lt;math&amp;gt;D = \frac{1}{6}\frac{\partial\left\langle r^2\left(t\right)\right\rangle}{\partial t}=\frac{1}{6}*0.0222=3.7*10^{-3}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for liquid, &amp;lt;math&amp;gt;D =\frac{1}{6}*0.001=1.7*10^{-4}&amp;lt;/math&amp;gt;;&lt;br /&gt;
 for solid,  &amp;lt;math&amp;gt;D =\frac{1}{6}*0.0003=5.0*10^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_msd.png&amp;diff=495843</id>
		<title>File:YY3412 msd.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_msd.png&amp;diff=495843"/>
		<updated>2015-03-13T03:49:39Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: Yy3412 uploaded a new version of &amp;amp;quot;File:YY3412 msd.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_msd_large.png&amp;diff=495839</id>
		<title>File:YY3412 msd large.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_msd_large.png&amp;diff=495839"/>
		<updated>2015-03-13T03:32:23Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_msd.png&amp;diff=495838</id>
		<title>File:YY3412 msd.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_msd.png&amp;diff=495838"/>
		<updated>2015-03-13T03:23:14Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: Yy3412 uploaded a new version of &amp;amp;quot;File:YY3412 msd.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_msd.png&amp;diff=495837</id>
		<title>File:YY3412 msd.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_msd.png&amp;diff=495837"/>
		<updated>2015-03-13T03:17:34Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495834</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495834"/>
		<updated>2015-03-13T03:08:38Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Structural properties and the radial distribution function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_inte_RDF.png&amp;diff=495833</id>
		<title>File:YY3412 inte RDF.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_inte_RDF.png&amp;diff=495833"/>
		<updated>2015-03-13T03:07:57Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: Yy3412 uploaded a new version of &amp;amp;quot;File:YY3412 inte RDF.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495832</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495832"/>
		<updated>2015-03-13T03:04:53Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Structural properties and the radial distribution function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495831</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495831"/>
		<updated>2015-03-13T03:04:13Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Structural properties and the radial distribution function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495830</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495830"/>
		<updated>2015-03-13T03:02:25Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Structural properties and the radial distribution function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 RDF.png|300px|thumb|Radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 inte RDF.png|300px|thumb|Integrated radial distribution function of gas, liquid and solid.]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_inte_RDF.png&amp;diff=495828</id>
		<title>File:YY3412 inte RDF.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_inte_RDF.png&amp;diff=495828"/>
		<updated>2015-03-13T02:59:10Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_RDF.png&amp;diff=495826</id>
		<title>File:YY3412 RDF.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_RDF.png&amp;diff=495826"/>
		<updated>2015-03-13T02:58:32Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495824</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495824"/>
		<updated>2015-03-13T02:56:45Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Structural properties and the radial distribution function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495816</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495816"/>
		<updated>2015-03-13T02:35:31Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Calculating heat capacities using statistical physics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
 Input script with T=2.0, ρ=0.2[[Media:YY3412 NVT 0.2 2.0.in| here]].&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_NVT_0.2_2.0.in&amp;diff=495815</id>
		<title>File:YY3412 NVT 0.2 2.0.in</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_NVT_0.2_2.0.in&amp;diff=495815"/>
		<updated>2015-03-13T02:34:38Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495814</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495814"/>
		<updated>2015-03-13T02:30:28Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Calculating heat capacities using statistical physics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
 [[File:YY3412 Cv T rho.png|300px|thumb|Plot of Cv vs. temperature at ρ=0.2 and 0.8.]]&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_Cv_T_rho.png&amp;diff=495813</id>
		<title>File:YY3412 Cv T rho.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_Cv_T_rho.png&amp;diff=495813"/>
		<updated>2015-03-13T02:29:41Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495811</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495811"/>
		<updated>2015-03-13T02:27:16Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Calculating heat capacities using statistical physics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495726</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495726"/>
		<updated>2015-03-12T23:37:55Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 The ideal gas law is more validate to the real situation at high temperature and low pressure.&lt;br /&gt;
 The discrepancy of density on the plot decrease as temperature increases and pressure decreases,&lt;br /&gt;
 which agrees with the validate condition of ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495462</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495462"/>
		<updated>2015-03-12T17:14:37Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law&amp;lt;ref name=&amp;quot;VDW equation&amp;quot;&amp;gt; TL Hill; Introduction to Statistical Thermodynamics. Addison-Wesley, Reading (1960) p280&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495461</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495461"/>
		<updated>2015-03-12T17:12:44Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
 Both simulated densities at different pressures are lower than calculated from ideal gas law. &lt;br /&gt;
 The densities are simulated with temperature above the critical temperature, thus the atoms are in fluid state.&lt;br /&gt;
 The properties at fluid state are better described by Van der Waals equation instead of the ideal gas law.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495445</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495445"/>
		<updated>2015-03-12T16:19:02Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p ideal gas law.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with comparison with density calculated from ideal gas law]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_rho_T_p_ideal_gas_law.png&amp;diff=495444</id>
		<title>File:YY3412 rho T p ideal gas law.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_rho_T_p_ideal_gas_law.png&amp;diff=495444"/>
		<updated>2015-03-12T16:18:20Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495419</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495419"/>
		<updated>2015-03-12T16:03:29Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495405</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495405"/>
		<updated>2015-03-12T15:56:51Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px|thumb|Plot of density vs. temperature at p=2.4 and 2.6 with error bar in both x and y directions.]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY N(CH3)4+ MO22.JPG|300px]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_rho_T_p_error_bar.png&amp;diff=495404</id>
		<title>File:YY3412 rho T p error bar.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_rho_T_p_error_bar.png&amp;diff=495404"/>
		<updated>2015-03-12T15:56:22Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: Yy3412 uploaded a new version of &amp;amp;quot;File:YY3412 rho T p error bar.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495381</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495381"/>
		<updated>2015-03-12T15:46:32Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! with error bar !! with ρ calculated from ideal gas law&lt;br /&gt;
|-&lt;br /&gt;
|[[File:YY3412 rho T p error bar.png|300px]]&lt;br /&gt;
&lt;br /&gt;
|[[File:YY N(CH3)4+ MO22.JPG|300px]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_rho_T_p_error_bar.png&amp;diff=495380</id>
		<title>File:YY3412 rho T p error bar.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:YY3412_rho_T_p_error_bar.png&amp;diff=495380"/>
		<updated>2015-03-12T15:45:35Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495318</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495318"/>
		<updated>2015-03-12T14:57:49Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
 {| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &lt;br /&gt;
! with error bar !! without error bar &lt;br /&gt;
|-&lt;br /&gt;
|[N(CH&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;)&amp;lt;sub&amp;gt;4&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;+&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|[[File:YY N(CH3)4+ MO22.JPG|300px]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
 The density is calculated from ideal gas law in this way,&lt;br /&gt;
 &amp;lt;math&amp;gt;pV=nRT&amp;lt;/math&amp;gt;, as &amp;lt;math&amp;gt;n=N*N_A&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=N*N_ART&amp;lt;/math&amp;gt;.&lt;br /&gt;
 As&amp;lt;math&amp;gt;N_A*R=k_B&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;pV=Nk_BT&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Therefore, &amp;lt;math&amp;gt;\rho=\frac{N}{V}=\frac{p}{k_BT}=\frac{p}{T}&amp;lt;/math&amp;gt; as &amp;lt;math&amp;gt;k_B= 1&amp;lt;/math&amp;gt; in reduced unit.&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495286</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495286"/>
		<updated>2015-03-12T14:37:57Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Plotting the Equations of State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495277</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495277"/>
		<updated>2015-03-12T14:34:44Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Velocity Verlet Algorithm */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. &lt;br /&gt;
 After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range. &lt;br /&gt;
&lt;br /&gt;
Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically?&lt;br /&gt;
 First,we are simulating with classical particle approximation.&lt;br /&gt;
 In the classical physical system, the potential energy and kinetic energy will interchange with each other,&lt;br /&gt;
 i.e. the total energy is constant.&lt;br /&gt;
 Also, we use statistical thermodynamics to calculate macroscopic properties from microscopic properties.&lt;br /&gt;
 The simulation takes part in NVE ensemble if no ensemble is specified.&lt;br /&gt;
 Thus in NVE ensemble the total energy does not change.&lt;br /&gt;
 However, the total energy does fluctuates during the course of simulation due to the numerical approximation. &lt;br /&gt;
 The simulation is valid if the fluctuation falls in a small enough range (e.g. &amp;lt;math&amp;gt;\pm1%&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Why do you think the error in the position changes with time in the way that it does?&lt;br /&gt;
 Each new position is calculted using iteration, i.e. using the result from the previous calculation.&lt;br /&gt;
 We will have error during mathematical approximation, and the error will be carried forward to the next position, &lt;br /&gt;
 resulting the increasing error in longer time.&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right)&amp;lt;/math&amp;gt;. Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495191</id>
		<title>Rep:Mod:YY3412simulation</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:Mod:YY3412simulation&amp;diff=495191"/>
		<updated>2015-03-12T13:52:41Z</updated>

		<summary type="html">&lt;p&gt;Yy3412: /* Velocity Verlet Algorithm */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Third year simulation experiment=&lt;br /&gt;
==Introduction to molecular dynamics simulation==&lt;br /&gt;
===Velocity Verlet Algorithm===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;:  Experiment with different values of the timestep. What sort of a timestep do you need to use to ensure that the total energy does not change by more than 1% over the course of your &amp;quot;simulation&amp;quot;? Why do you think it is important to monitor the total energy of a physical system when modelling its behaviour numerically? Why do you think the error in the position changes with time in the way that it does?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 The initial total energy is 0.5, 1% change is between 0.495 and 0.505. After testing with different values of timestep, only the ones equal to or less than 0.2 fall in that range.&lt;br /&gt;
 First we are simulating with&lt;br /&gt;
&lt;br /&gt;
===Atomic Forces===&lt;br /&gt;
For a single Lennard-Jones interaction, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\epsilon \left( \frac{\sigma^{12}}{r^{12}} - \frac{\sigma^6}{r^6} \right)&amp;lt;/math&amp;gt;, find the separation, &amp;lt;math&amp;gt;r_0&amp;lt;/math&amp;gt;, at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
 As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; is the distance at which the  potential energy between the two particles is zero, &lt;br /&gt;
 the separation &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt; at which the potential energy is zero.&lt;br /&gt;
&lt;br /&gt;
What is the force at this separation?&lt;br /&gt;
&lt;br /&gt;
 The Lennard-Jones force is &amp;lt;math&amp;gt;F=-\frac{d\phi}{dr}=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. When &amp;lt;math&amp;gt;r_0=\sigma&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;F=\frac{24\epsilon}{\sigma}\left(2-1\right)=\frac{24\epsilon}{\sigma}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Find the equilibrium separation, &amp;lt;math&amp;gt;r_{eq}&amp;lt;/math&amp;gt;, and work out the well depth (&amp;lt;math&amp;gt;\phi\left(r_{eq}\right)&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
 At equilibrium separation, &amp;lt;math&amp;gt;F=0=\frac{24\epsilon}{r_0}\left[2\left(\frac{\sigma}{r_0}\right)^{13}-\left(\frac{\sigma}{r_0}\right)^{7}\right]&amp;lt;/math&amp;gt;. As &amp;lt;math&amp;gt;\sigma&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\epsilon&amp;lt;/math&amp;gt; cannot be 0, thus &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Substitute &amp;lt;math&amp;gt;r_{eq}=2^{1/6}\sigma&amp;lt;/math&amp;gt; into &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;, we can get &amp;lt;math&amp;gt;\phi\left(r_{eq}\right)=-\epsilon&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Evaluate the integrals &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r&amp;lt;/math&amp;gt; when &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 When &amp;lt;math&amp;gt;\sigma = \epsilon = 1.0&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;\phi\left(r\right) = 4\left( \frac{1}{r^{12}} - \frac{1}{r^6} \right)&amp;lt;/math&amp;gt;. &lt;br /&gt;
 Therefore &amp;lt;math&amp;gt;\int \phi\left(r\right)\mathrm{d}r=4\left[\left(-\frac{1}{11}r^{-11}\right)-\left(-\frac{1}{5}r^{-5}\right)\right]=-\frac{4}{11}r^{-11}+\frac{4}{5}r^{-5}+k&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus &amp;lt;math&amp;gt;\int_{2\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2\sigma\right)^{-11}-\frac{4}{5}\left(2\sigma\right)^{-5}=\frac{1}{5632}\sigma^{-11}-\frac{1}{40}\sigma^{-5}= \beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;, &lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{2.5\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(2.5\sigma\right)^{-11}-\frac{4}{5}\left(2.5\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;,&lt;br /&gt;
      &amp;lt;math&amp;gt;\int_{3\sigma}^\infty \phi\left(r\right)\mathrm{d}r=0+\frac{4}{11}\left(3\sigma\right)^{-11}-\frac{4}{5}\left(3\sigma\right)^{-5}=\beta\sigma^{-11}-\beta\sigma^{-5}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Periodic Boundary Conditions===&lt;br /&gt;
Estimate the number of water molecules in 1ml of water under standard conditions. Estimate the volume of &amp;lt;math&amp;gt;10000&amp;lt;/math&amp;gt; water molecules under standard conditions.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;math&amp;gt;1\mathrm{mL}*1\mathrm{gmL^{-1}}=1\mathrm{g}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;1\mathrm{g}/18\mathrm{gmol^{-1}}=\frac{1}{18}\mathrm{mol}&amp;lt;/math&amp;gt; water, &amp;lt;math&amp;gt;\frac{1}{18}\mathrm{mol}*6.02*10^{23}\mathrm{mol^{-1}}=3.35*10^{22}&amp;lt;/math&amp;gt; molecules of water.&lt;br /&gt;
 &amp;lt;math&amp;gt;10000/6.02*10^{23}\mathrm{mol^{-1}}=1.66*10^{-20}\mathrm{mol}&amp;lt;/math&amp;gt; of water, &amp;lt;math&amp;gt;1.66*10^{-20}\mathrm{mol}*18\mathrm{gmol^{-1}}=2.99*10^{-19}\mathrm{g}&amp;lt;/math&amp;gt; water &amp;lt;math&amp;gt;=2.99*10^{-19}\mathrm{mL}&amp;lt;/math&amp;gt; water.&lt;br /&gt;
&lt;br /&gt;
Consider an atom at position &amp;lt;math&amp;gt;\left(0.5, 0.5, 0.5\right)&amp;lt;/math&amp;gt; in a cubic simulation box which runs from &amp;lt;math&amp;gt;\left(0, 0, 0\right)&amp;lt;/math&amp;gt; to &amp;lt;math&amp;gt;\left(1, 1, 1\right)&amp;lt;/math&amp;gt;. In a single timestep, it moves along the vector &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;. At what point does it end up, &#039;&#039;after the periodic boundary conditions have been applied&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
 As the direction of moving is &amp;lt;math&amp;gt;\left(0.7, 0.6, 0.2\right)&amp;lt;/math&amp;gt;, the x-direction moves the fastest and will reach the boundary first.&lt;br /&gt;
 The time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; required for the atom to move to the boundary can therefore be expressed as &amp;lt;math&amp;gt;0.5+0.7t=1.0&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Thus at &amp;lt;math&amp;gt;t=0.7&amp;lt;/math&amp;gt;, the duplicate atom will enter the central box at &amp;lt;math&amp;gt;\left(0.0,0.9,0.6\right)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Reduced Units===&lt;br /&gt;
The Lennard-Jones parameters for argon are &amp;lt;math&amp;gt;\sigma = 0.34\mathrm{nm}, \epsilon\ /\ k_B= 120 \mathrm{K}&amp;lt;/math&amp;gt;. If the LJ cutoff is &amp;lt;math&amp;gt;r^* = 3.2&amp;lt;/math&amp;gt;, what is it in real units? What is the well depth in &amp;lt;math&amp;gt;\mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;? What is the reduced temperature &amp;lt;math&amp;gt;T^* = 1.5&amp;lt;/math&amp;gt; in real units?&lt;br /&gt;
&lt;br /&gt;
 Distance &amp;lt;math&amp;gt;r=\sigma*r^*=0.34\mathrm{nm}*3.2=1.09\mathrm{nm}&amp;lt;/math&amp;gt;.&lt;br /&gt;
 Well depth is equal to &amp;lt;math&amp;gt;-\epsilon&amp;lt;/math&amp;gt;, thus &amp;lt;math&amp;gt;E=\epsilon*E^*=0.997 \mathrm{kJ\ mol}^{-1}*\left(-0.997\right)=-0.994 \mathrm{kJ\ mol}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
 Temperature &amp;lt;math&amp;gt;T=T^**\left(\epsilon\ /\ k_B\right)= 1.5*120 \mathrm{K}=180\mathrm{K}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==Equilibration==&lt;br /&gt;
===Creating the simulation box===&lt;br /&gt;
Why do you think giving atoms random starting coordinates causes problems in simulations?&lt;br /&gt;
 If the atoms are giving randon initial positions, some of them might turn out to be too close from each other (distance smaller than ).&lt;br /&gt;
 They will repel each other until they are enough far apart, which results in release of plenty of potential energy to stablise.&lt;br /&gt;
 This potential energy then changes to kinetic energy and heat the whole system up.&lt;br /&gt;
&lt;br /&gt;
Satisfy yourself that this lattice spacing corresponds to a number density of lattice points of 0.8. Consider instead a face-centred cubic lattice with a lattice point number density of 1.2. What is the side length of the cubic unit cell?&lt;br /&gt;
&lt;br /&gt;
 Number density equals number of lattice points per unit volume and the number of lattice point of primitive cubic system is 1,&lt;br /&gt;
 therefore unit volume=number of lattice points/number density=1/0.8=1.25. &lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.0772.&lt;br /&gt;
 &lt;br /&gt;
 For face-centred cubic lattice, the number of lattice point of a unit cell is 4.Therefore unit volume=4/1.2=3.33.&lt;br /&gt;
 Lattice spacing=(unit volume)&amp;lt;sup&amp;gt;1/3&amp;lt;/sup&amp;gt;=1.4933.&lt;br /&gt;
&lt;br /&gt;
Consider again the face-centred cubic lattice from the previous task. How many atoms would be created by the create_atoms command if you had defined that lattice instead?&lt;br /&gt;
&lt;br /&gt;
 Number of unit cells is 1000 (10*10*10) and 4 lattice points per unit cell, therefore 4000 atoms on the 4000 lattice points of 1000 unit cells.&lt;br /&gt;
&lt;br /&gt;
===Setting the properties of the atoms===&lt;br /&gt;
Using the [http://lammps.sandia.gov/doc/Section_commands.html#cmd_5 LAMMPS manual], find the purpose of the following commands in the input script:&lt;br /&gt;
 &#039;&#039;&#039;mass 1 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;mass&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;mass I value&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;mass command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/mass.html&amp;lt;/ref&amp;gt; where &#039;&#039;&#039;I&#039;&#039;&#039; is the atom type and &#039;&#039;&#039;value&#039;&#039;&#039; is the mass of the atom in reduced units.&lt;br /&gt;
 The mass can be set for one or more atom type, by just numbering or using * as wild-card. &lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_style lj/cut 3.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_style&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_style style args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_style command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_style.html&amp;lt;/ref&amp;gt;. There are plenty of &#039;&#039;&#039;styles&#039;&#039;&#039; describing the interaction between two atoms.&lt;br /&gt;
 As we are modelling the interaction pairs of atoms in simple liquid, we just use Lennard-Jones potential to calculate the interaction, i.e. using &#039;&#039;&#039;pair_style lj/cut&#039;&#039;&#039; command.&lt;br /&gt;
 The &#039;&#039;&#039;cut&#039;&#039;&#039; in &#039;&#039;&#039;args&#039;&#039;&#039; means &#039;cutoff&#039; distance, which means that any pair interaction are ignored if their distance is beyond &#039;cutoff&#039; distance (3.0 in this case).&lt;br /&gt;
 Also the &#039;cutoff&#039; distance must be smaller than half of the box length or some same interactions would be taken into account twice.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;pair_coeff * * 1.0 1.0&#039;&#039;&#039;&lt;br /&gt;
 The &#039;&#039;&#039;pair_coeff&#039;&#039;&#039; command has syntax as &#039;&#039;&#039;pair_coeff I J args&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;pair_coeff command&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_coeff.html&amp;lt;/ref&amp;gt; and are used to define coefficients after pair_style lj/cut command&amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 &#039;&#039;&#039;I,J&#039;&#039;&#039; are the type of atoms that are interacting with each other, and two single asterisk (* *) means that both interacting atom can be chosen from all atoms.&lt;br /&gt;
 &#039;&#039;&#039;1.0 1.0&#039;&#039;&#039; is the &#039;&#039;&#039;args&#039;&#039;&#039;, which means &amp;lt;math&amp;gt;\sigma=\epsilon=1.0&amp;lt;/math&amp;gt; in this case&amp;lt;ref name=&amp;quot;pair_style args&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/pair_lj.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Given that we are specifying &amp;lt;math&amp;gt;\mathbf{x}_i\left(0\right)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\mathbf{v}_i\left(0\right)&amp;lt;/math&amp;gt;, which integration algorithm are we going to use?&lt;br /&gt;
&lt;br /&gt;
 We are going to use Velocity Verlet Algorithm.&lt;br /&gt;
&lt;br /&gt;
===Running the simulation===&lt;br /&gt;
&lt;br /&gt;
Look at the lines below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
### SPECIFY TIMESTEP ###&lt;br /&gt;
variable timestep equal 0.001&lt;br /&gt;
variable n_steps equal floor(100/${timestep})&lt;br /&gt;
variable n_steps equal floor(100/0.001)&lt;br /&gt;
timestep ${timestep}&lt;br /&gt;
timestep 0.001&lt;br /&gt;
&lt;br /&gt;
### RUN SIMULATION ###&lt;br /&gt;
run ${n_steps}&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The second line (starting &amp;quot;variable timestep...&amp;quot;) tells LAMMPS that if it encounters the text ${timestep} on a subsequent line, it should replace it by the value given. In this case, the value ${timestep} is always replaced by 0.001. In light of this, what do you think the purpose of these lines is? Why not just write:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
timestep 0.001&lt;br /&gt;
run 100000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 The lines below ### SPECIFY TIMESTEP ### tells the software that the timestep equal 0.001 per step, the simulation time is 100, and thus there are 100000 steps to run. &lt;br /&gt;
 As we need to compare the results with same simulation time, therefore if we change timestep to 0.002 per step and just write &#039;&#039;&#039;run 100000&#039;&#039;&#039;,&lt;br /&gt;
 we will end up with a simulation of &amp;lt;math&amp;gt;0.002*100000=200&amp;lt;/math&amp;gt; steps which we do not want.&lt;br /&gt;
 If we use lines below ### SPECIFY TIMESTEP ###, we will result in simulation time of 100 whatever timestep we choose.&lt;br /&gt;
&lt;br /&gt;
===Checking equilibration===&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make plots of the energy, temperature, and pressure, against time for the 0.001 timestep experiment (attach a picture to your report). Does the simulation reach equilibrium? How long does this take? When you have done this, make a single plot which shows the energy versus time for all of the timesteps (again, attach a picture to your report). Choosing a timestep is a balancing act: the shorter the timestep, the more accurately the results of your simulation will reflect the physical reality; short timesteps, however, mean that the same number of simulation steps cover a shorter amount of actual time, and this is very unhelpful if the process you want to study requires observation over a long time. Of the five timesteps that you used, which is the largest to give acceptable results? Which one of the five is a &#039;&#039;particularly&#039;&#039; bad choice? Why?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Running simulations under specific conditions==&lt;br /&gt;
===Temperature and Pressure Control===&lt;br /&gt;
Choose 5 temperatures and two pressures . This gives ten phase points &amp;amp;mdash; five temperatures at each pressure. Create 10 copies of npt.in, and modify each to run a simulation at one of your chosen &amp;lt;math&amp;gt;\left(p, T\right)&amp;lt;/math&amp;gt; points. You should be able to use the results of the previous section to choose a timestep. &lt;br /&gt;
 The five temperatures are 1.6, 1.8, 2.0, 2.2, 2.4 and the two pressures are 2.4 and 2.6. The timestep chosen is 0.0025.&lt;br /&gt;
&lt;br /&gt;
====Thermostats and Barostats====&lt;br /&gt;
We need to choose &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; so that the temperature is correct &amp;lt;math&amp;gt;T = \mathfrak{T}&amp;lt;/math&amp;gt; if we multiply every velocity &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt;. We can write two equations:&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; (1)&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; (2)&lt;br /&gt;
&lt;br /&gt;
Solve these to determine &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;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}= \frac{1}{2} \gamma^2\sum_i m_i v_i^2 = \frac{3}{2} N k_B \mathfrak{T}&amp;lt;/math&amp;gt; (3)&lt;br /&gt;
 (3) divided by (1) results in &amp;lt;math&amp;gt;\gamma^2= \frac{\mathfrak{T}}{T}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\gamma=\sqrt{\frac{\mathfrak{T}}{T}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
====Examining the Input Script====&lt;br /&gt;
&lt;br /&gt;
Use the [http://lammps.sandia.gov/doc/fix_ave_time.html manual page] to find out the importance of the three numbers &#039;&#039;100 1000 100000&#039;&#039;. How often will values of the temperature, etc., be sampled for the average? How many measurements contribute to the average? Looking to the following line, how much time will you simulate?&lt;br /&gt;
&lt;br /&gt;
 100 is Nevery = use input values every this many timesteps; 1000 is Nrepeat = # of times to use input values for calculating averages;&lt;br /&gt;
 100000 is Nfreq = calculate averages every this many timesteps&amp;lt;ref name=&amp;quot;average&amp;quot;&amp;gt; http://lammps.sandia.gov/doc/fix_ave_time.html&amp;lt;/ref&amp;gt;.&lt;br /&gt;
 In this case, the software calculate and display the temperature, etc. after 100000 timesteps (i.e. only at the end of the simulation), &lt;br /&gt;
 the average thermodynamic properties are calculated from 1000 inputs, which are taken every 100 timesteps (the 100th, the 200th, the 300th, etc.).&lt;br /&gt;
&lt;br /&gt;
====Plotting the Equations of State====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: When your simulations have finished, download the log files as before. At the end of the log file, LAMMPS will output the values and errors for the pressure, temperature, and density &amp;lt;math&amp;gt;\left(\frac{N}{V}\right)&amp;lt;/math&amp;gt;. Use software of your choice to plot the density as a function of temperature for both of the pressures that you simulated.  Your graph(s) should include error bars in both the x and y directions. You should also include a line corresponding to the density predicted by the ideal gas law at that pressure. Is your simulated density lower or higher? Justify this. Does the discrepancy increase or decrease with pressure?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Calculating heat capacities using statistical physics==&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: As in the last section, you need to run simulations at ten phase points. In this section, we will be in density-temperature &amp;lt;math&amp;gt;\left(\rho^*, T^*\right)&amp;lt;/math&amp;gt; phase space, rather than pressure-temperature phase space. The two densities required at &amp;lt;math&amp;gt;0.2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;0.8&amp;lt;/math&amp;gt;, and the temperature range is &amp;lt;math&amp;gt;2.0, 2.2, 2.4, 2.6, 2.8&amp;lt;/math&amp;gt;. Plot &amp;lt;math&amp;gt;C_V/V&amp;lt;/math&amp;gt; as a function of temperature, where &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; is the volume of the simulation cell, for both of your densities (on the same graph). Is the trend the one you would expect? Attach an example of one of your input scripts to your report.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Structural properties and the radial distribution function==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: perform simulations of the Lennard-Jones system in the three phases. When each is complete, download the trajectory and calculate &amp;lt;math&amp;gt;g(r)&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;\int g(r)\mathrm{d}r&amp;lt;/math&amp;gt;. Plot the RDFs for the three systems on the same axes, and attach a copy to your report. Discuss qualitatively the differences between the three RDFs, and what this tells you about the structure of the system in each phase. In the solid case, illustrate which lattice sites the first three peaks correspond to. What is the lattice spacing? What is the coordination number for each of the first three peaks?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Dynamical properties and the diffusion coefficient==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: make a plot for each of your simulations (solid, liquid, and gas), showing the mean squared displacement (the &amp;quot;total&amp;quot; MSD) as a function of timestep. Are these as you would expect? Estimate &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; in each case. Be careful with the units! Repeat this procedure for the MSD data that you were given from the one million atom simulations.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: In the theoretical section at the beginning, the equation for the evolution of the position of a 1D harmonic oscillator as a function of time was given. Using this, evaluate the normalised velocity autocorrelation function for a 1D harmonic oscillator (it is analytic!):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C\left(\tau\right) = \frac{\int_{-\infty}^{\infty} v\left(t\right)v\left(t + \tau\right)\mathrm{d}t}{\int_{-\infty}^{\infty} v^2\left(t\right)\mathrm{d}t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Be sure to show your working in your writeup. On the same graph, with x range 0 to 500, plot &amp;lt;math&amp;gt;C\left(\tau\right)&amp;lt;/math&amp;gt; with &amp;lt;math&amp;gt;\omega = 1/2\pi&amp;lt;/math&amp;gt; and the VACFs from your liquid and solid simulations. What do the minima in the VACFs for the liquid and solid system represent? Discuss the origin of the differences between the liquid and solid VACFs. The harmonic oscillator VACF is very different to the Lennard Jones solid and liquid. Why is this? Attach a copy of your plot to your writeup.&#039;&#039;&#039;&lt;br /&gt;
----&lt;br /&gt;
References and citations&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Yy3412</name></author>
	</entry>
</feed>