<?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=Aa15712</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=Aa15712"/>
	<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/wiki/Special:Contributions/Aa15712"/>
	<updated>2026-05-18T00:00:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481303</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481303"/>
		<updated>2015-01-30T13:17:10Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
The purpose of this exercise was to model a low temperature 2D lattice of a para-magnetic solid.  In particular the cross-over point of the enthalpic and entropic regimes was studied using a Monte Carlo simulation. Please note that all temperatures and energies stated in this exercise are in reduced units of Kb. Heat capacity is therefore in units of Kb^-1.&lt;br /&gt;
 &lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: &lt;br /&gt;
&lt;br /&gt;
 2D: E= -0.5*J*N*4 &lt;br /&gt;
 3D: E=-0.5*J*N*6   &lt;br /&gt;
&lt;br /&gt;
both also yield the general equation: &lt;br /&gt;
&lt;br /&gt;
 E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical basis since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|400px|||Figure showing that the energy and magnetisation are calculated correctly]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Results from Ilanmin.py&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! Screenshot of ILanim.py&lt;br /&gt;
! Values returned from Statistics function&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Nas Ilanim Final Good.png|500px]]&lt;br /&gt;
| [[File:Nas Ilanim Final Stats.PNG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG | This is a caption]]&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Number of cycles required to reach equilibrium&#039;&#039;&#039;&lt;br /&gt;
|[[File:Period converge Eq.PNG]]&lt;br /&gt;
| NA- suggests that either the simulation temperature was above the Curie Temperature so no spontaneous magnetisation could occur or equilibrium was not reached in the time scope of this basic investigation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Typical prints from Ilfinalframe.py&#039;&#039;&#039;&lt;br /&gt;
|[[File:Typical 2 0,1K.png|thumb|right| 2x2 @ 0.1Kb]]&lt;br /&gt;
|[[File:Typical 2 2,5K.png|thumb|right| 2x2 @ 2.5Kb]]&lt;br /&gt;
|[[File:Typical 16 1K.png|thumb|right| 16x16 @ 1Kb]]&lt;br /&gt;
|[[File:48 0.1K.png|thumb|right| 48x48 @ 0.1Kb]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The modification of IsingLattice.py allowed the user to modify the number of cycles that could be discarded before average values began to be calculated. For scanning different temperatures for the largest lattice sizes, a period of discard of 100000 was chosen. This represented a balance between ensuring the lattice could reach equilibrium, whilst also maintaining a realistic calculation time.&lt;br /&gt;
&lt;br /&gt;
=== Temperature plots for various different lattice sizes===&lt;br /&gt;
&lt;br /&gt;
Energy and magnetisation calculations at different temperatures were carried out for various lattice sizes. Each simulation was carried out in the range of 0.1 to 5.0 with a resolution step of 0.1. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Temperature plots from Iltemperaturerange.py&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;2x2 Lattice&amp;lt;/center&amp;gt; &lt;br /&gt;
| &amp;lt;center&amp;gt;4x4 Lattice&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:2x2 rerun.png|400px| 2x2]]&lt;br /&gt;
|[[File:4x4 rerun.png|400px| 2x2]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;8x8 Lattice&amp;lt;/center&amp;gt; &lt;br /&gt;
|&amp;lt;center&amp;gt;16x16 Lattice&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:8x8 rerun.png|400px| 16x16]]&lt;br /&gt;
|[[File:16x16 rerun.png|400px| 48x48]]&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &amp;lt;center&amp;gt;32x32&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|&amp;lt;center&amp;gt;[[File:32x32 rerun.png|400px| 48x48]]&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Combined plots of magnetisation and energy against temperature&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;Combined Magnetism Plot&amp;lt;/center&amp;gt;&lt;br /&gt;
|&amp;lt;center&amp;gt;Combined Energy Plot&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Combined Magnetism.png| 450px]]&lt;br /&gt;
|[[File:Combined Temperature Graph.png| 450px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We see from the combined graph of energy per spin against temperature that as the lattice size increases the profile of the curves converge to the same profile. The smallest of the lattices we studied that converges to this profile is the 8x8 system, therefore this is the smallest system to display the long range fluctuations.&lt;br /&gt;
&lt;br /&gt;
==Calculating Heat Capacities==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of the system can be calculated from the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}[E]}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variance can be calculated from subtracting the sum of each value squared from the total sum of the energies squared. This has units of K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;. Noting that T has reduced units of K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;, the units of C must be K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Heat capacity per spin against temperature for various lattice sizes&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;[[File:Combined Heat Capacity plots.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|The heat capacity maxima, which correspond to the Schottky anomaly, can be seen to migrate to smaller values for larger lattice sizes.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Locating the Curie Temperature==&lt;br /&gt;
&lt;br /&gt;
For this part of the experiment we analysed data that had been generated in C++. The step was compare our own generated data to that given. Comparison of the two sets showed relatively strong agreement suggesting that the experimental technique is easily repeatable and reliable.  &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Comparison of Nas&#039; and Niall&#039;s heat capacities of a 16x16 lattice&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;[[File:My Cv vs Nials 16x16.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Relatively good agreement of data. Great detail could be achieved for my results if a smaller temperature step had been used for the calculation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We now needed to fit a polynomial to our results in order to acquire an accurate estimate for the Tc for each lattice. This was first done by fitting a polynomial to the whole range of data which produced a poor match. This was improved by increasing the degree of polynomial used in the fitting process.However a greater improvement could be found by restricting the region of data to be fitted to the peak region. The table below shows a selection of fits with different degrees of polynomials and peak restriction. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;C fits for Niall&#039;s data on a 16x16 Lattice&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;3rd Order Fit&amp;lt;/center&amp;gt; &lt;br /&gt;
|&amp;lt;center&amp;gt;3rd Order Fit - peak restriction&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Nialls 16x16 3rd order fit.png|400px| 2x2]]&lt;br /&gt;
|[[File:Nialls 16x16 3rd order peak fit 1.8-2.8.png|400px| 2x2]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;6th Order Fit&amp;lt;/center&amp;gt; &lt;br /&gt;
|&amp;lt;center&amp;gt;7th Order - peak restriction&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Nialls 16x16 6th order fit.png| 400px]]&lt;br /&gt;
|[[File:Nialls 16x16 7th order peak fit 1.8-2.8.png|400px| 48x48]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;10th Order&amp;lt;/center&amp;gt; &lt;br /&gt;
|&amp;lt;center&amp;gt;10th Order - peak restriction&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Nialls 16x16 10th order fit.png| 400px]]&lt;br /&gt;
|[[File:Nialls 16x16 10th order peak fit 1.8-2.8.png|400px| 48x48]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Using higher order polynomials may be expected to give better fits for the heat capacity. However np.polyval is inaccurate for high order polynomials larger than 10 due to rounding errors in its calculation. Therefore a polynomial of 10 was the maximum used for our fits.&lt;br /&gt;
&lt;br /&gt;
The final step of our study is to determine the Curie temperature of an infinite lattice. This can be done using the following relation: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;T_{C, L} = \frac{A}{L} + T_{C,\infty}&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;T_{C, L}&amp;lt;/math&amp;gt; is the Curie temperature of an &amp;lt;math&amp;gt;L\times L&amp;lt;/math&amp;gt;lattice, &amp;lt;math&amp;gt;T_{C,\infty}&amp;lt;/math&amp;gt; is the Curie temperature of an infinite lattice, and &amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; is a constant in which we are not especially interested.&lt;br /&gt;
&lt;br /&gt;
Therefore by plotting our Cmaxes for each lattice size against 1/L we can find a best fit line and interpolate the Y intercept, which will be our T&amp;lt;sub&amp;gt;c&amp;lt;/sub&amp;gt; infinity. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Determination of T&amp;lt;sub&amp;gt;c infinity&amp;lt;/sub&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;[[File:Tinfinity.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|By calculation we find that T&amp;lt;sub&amp;gt;c infinity&amp;lt;/sub&amp;gt; =  2.2868351&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The value for this reported in literature is 2.269185 &amp;lt;ref name=&amp;quot;tcref&amp;quot; /&amp;gt; . This is relatively good agreement from quite a crude model and demonstrates the power of statistical modelling for physical systems. I was surprised how we were able to replicate published results to good agreement with a very simple approach. The most likely source of error comes from the variable results at the phase transition. This in turn may give an inaccurate value for Cmax for each lattice. This could be improved by running more repeats around the phase transition and also by running many more lattice sizes. This will mean the final best fit line is more accurate, yielding a more accurate result.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;tcref&amp;quot;&amp;gt; doi:10.1016/j.jcp.2009.03.018&amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Tinfinity.png&amp;diff=481302</id>
		<title>File:Tinfinity.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Tinfinity.png&amp;diff=481302"/>
		<updated>2015-01-30T13:02:51Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481301</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481301"/>
		<updated>2015-01-30T12:57:01Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: /* The effect of Temperature on our Lattices */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
The purpose of this exercise was to model a low temperature 2D lattice of a para-magnetic solid.  In particular the cross-over point of the enthalpic and entropic regimes was studied using a Monte Carlo simulation. Please note that all temperatures and energies stated in this exercise are in reduced units of Kb. Heat capacity is therefore in units of Kb^-1.&lt;br /&gt;
 &lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: &lt;br /&gt;
&lt;br /&gt;
 2D: E= -0.5*J*N*4 &lt;br /&gt;
 3D: E=-0.5*J*N*6   &lt;br /&gt;
&lt;br /&gt;
both also yield the general equation: &lt;br /&gt;
&lt;br /&gt;
 E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical basis since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|400px|||Figure showing that the energy and magnetisation are calculated correctly]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Results from Ilanmin.py&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! Screenshot of ILanim.py&lt;br /&gt;
! Values returned from Statistics function&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Nas Ilanim Final Good.png|500px]]&lt;br /&gt;
| [[File:Nas Ilanim Final Stats.PNG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG | This is a caption]]&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Number of cycles required to reach equilibrium&#039;&#039;&#039;&lt;br /&gt;
|[[File:Period converge Eq.PNG]]&lt;br /&gt;
| NA- suggests that either the simulation temperature was above the Curie Temperature so no spontaneous magnetisation could occur or equilibrium was not reached in the time scope of this basic investigation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Typical prints from Ilfinalframe.py&#039;&#039;&#039;&lt;br /&gt;
|[[File:Typical 2 0,1K.png|thumb|right| 2x2 @ 0.1Kb]]&lt;br /&gt;
|[[File:Typical 2 2,5K.png|thumb|right| 2x2 @ 2.5Kb]]&lt;br /&gt;
|[[File:Typical 16 1K.png|thumb|right| 16x16 @ 1Kb]]&lt;br /&gt;
|[[File:48 0.1K.png|thumb|right| 48x48 @ 0.1Kb]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The modification of IsingLattice.py allowed the user to modify the number of cycles that could be discarded before average values began to be calculated. For scanning different temperatures for the largest lattice sizes, a period of discard of 100000 was chosen. This represented a balance between ensuring the lattice could reach equilibrium, whilst also maintaining a realistic calculation time.&lt;br /&gt;
&lt;br /&gt;
=== Temperature plots for various different lattice sizes===&lt;br /&gt;
&lt;br /&gt;
Energy and magnetisation calculations at different temperatures were carried out for various lattice sizes. Each simulation was carried out in the range of 0.1 to 5.0 with a resolution step of 0.1. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Temperature plots from Iltemperaturerange.py&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;2x2 Lattice&amp;lt;/center&amp;gt; &lt;br /&gt;
| &amp;lt;center&amp;gt;4x4 Lattice&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:2x2 rerun.png|400px| 2x2]]&lt;br /&gt;
|[[File:4x4 rerun.png|400px| 2x2]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;8x8 Lattice&amp;lt;/center&amp;gt; &lt;br /&gt;
|&amp;lt;center&amp;gt;16x16 Lattice&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:8x8 rerun.png|400px| 16x16]]&lt;br /&gt;
|[[File:16x16 rerun.png|400px| 48x48]]&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &amp;lt;center&amp;gt;32x32&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|&amp;lt;center&amp;gt;[[File:32x32 rerun.png|400px| 48x48]]&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Combined plots of magnetisation and energy against temperature&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;Combined Magnetism Plot&amp;lt;/center&amp;gt;&lt;br /&gt;
|&amp;lt;center&amp;gt;Combined Energy Plot&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Combined Magnetism.png| 450px]]&lt;br /&gt;
|[[File:Combined Temperature Graph.png| 450px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We see from the combined graph of energy per spin against temperature that as the lattice size increases the profile of the curves converge to the same profile. The smallest of the lattices we studied that converges to this profile is the 8x8 system, therefore this is the smallest system to display the long range fluctuations.&lt;br /&gt;
&lt;br /&gt;
==Calculating Heat Capacities==&lt;br /&gt;
&lt;br /&gt;
The heat capacity of the system can be calculated from the following equation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;C = \frac{\partial E}{\partial T} = \frac{\mathrm{Var}[E]}{k_B T^2}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The variance can be calculated from subtracting the sum of each value squared from the total sum of the energies squared. This has units of K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;. Noting that T has reduced units of K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;, the units of C must be K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;-1&amp;lt;/sup&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Heat capacity per spin against temperature for various lattice sizes&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;[[File:Combined Heat Capacity plots.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|The heat capacity maxima, which correspond to the Schottky anomaly, can be seen to migrate to smaller values for larger lattice sizes.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Locating the Curie Temperature==&lt;br /&gt;
&lt;br /&gt;
For this part of the experiment we analysed data that had been generated in C++. The step was compare our own generated data to that given. Comparison of the two sets showed relatively strong agreement suggesting that the experimental technique is easily repeatable and reliable.  &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Comparison of Nas&#039; and Niall&#039;s heat capacities of a 16x16 lattice&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;[[File:My Cv vs Nials 16x16.png|500px]]&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Relatively good agreement of data. Great detail could be achieved for my results if a smaller temperature step had been used for the calculation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We now needed to fit a polynomial to our results in order to acquire an accurate estimate for the Tc for each lattice. This was first done by fitting a polynomial to the whole range of data which produced a poor match. This was improved by increasing the degree of polynomial used in the fitting process.However a greater improvement could be found by restricting the region of data to be fitted to the peak region. The table below shows a selection of fits with different degrees of polynomials and peak restriction. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;C fits for Niall&#039;s data on a 16x16 Lattice&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;3rd Order Fit&amp;lt;/center&amp;gt; &lt;br /&gt;
|&amp;lt;center&amp;gt;3rd Order Fit - peak restriction&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Nialls 16x16 3rd order fit.png|400px| 2x2]]&lt;br /&gt;
|[[File:Nialls 16x16 3rd order peak fit 1.8-2.8.png|400px| 2x2]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;6th Order Fit&amp;lt;/center&amp;gt; &lt;br /&gt;
|&amp;lt;center&amp;gt;7th Order - peak restriction&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Nialls 16x16 6th order fit.png| 400px]]&lt;br /&gt;
|[[File:Nialls 16x16 7th order peak fit 1.8-2.8.png|400px| 48x48]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;10th Order&amp;lt;/center&amp;gt; &lt;br /&gt;
|&amp;lt;center&amp;gt;10th Order - peak restriction&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Nialls 16x16 10th order fit.png| 400px]]&lt;br /&gt;
|[[File:Nialls 16x16 10th order peak fit 1.8-2.8.png|400px| 48x48]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Using higher order polynomials may be expected to give better fits for the heat capacity. However np.polyval is inaccurate for high order polynomials larger than 10 due to rounding errors in its calculation. Therefore a polynomial of 10 was the maximum used for our fits.&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nialls_16x16_10th_order_peak_fit_1.8-2.8.png&amp;diff=481300</id>
		<title>File:Nialls 16x16 10th order peak fit 1.8-2.8.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nialls_16x16_10th_order_peak_fit_1.8-2.8.png&amp;diff=481300"/>
		<updated>2015-01-30T12:51:35Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nialls_16x16_7th_order_peak_fit_1.8-2.8.png&amp;diff=481299</id>
		<title>File:Nialls 16x16 7th order peak fit 1.8-2.8.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nialls_16x16_7th_order_peak_fit_1.8-2.8.png&amp;diff=481299"/>
		<updated>2015-01-30T12:51:11Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nialls_16x16_3rd_order_peak_fit_1.8-2.8.png&amp;diff=481298</id>
		<title>File:Nialls 16x16 3rd order peak fit 1.8-2.8.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nialls_16x16_3rd_order_peak_fit_1.8-2.8.png&amp;diff=481298"/>
		<updated>2015-01-30T12:50:41Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nialls_16x16_10th_order_fit.png&amp;diff=481297</id>
		<title>File:Nialls 16x16 10th order fit.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nialls_16x16_10th_order_fit.png&amp;diff=481297"/>
		<updated>2015-01-30T12:49:23Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nialls_16x16_6th_order_fit.png&amp;diff=481296</id>
		<title>File:Nialls 16x16 6th order fit.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nialls_16x16_6th_order_fit.png&amp;diff=481296"/>
		<updated>2015-01-30T12:48:40Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nialls_16x16_3rd_order_fit.png&amp;diff=481295</id>
		<title>File:Nialls 16x16 3rd order fit.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nialls_16x16_3rd_order_fit.png&amp;diff=481295"/>
		<updated>2015-01-30T12:47:05Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:My_Cv_vs_Nials_16x16.png&amp;diff=481294</id>
		<title>File:My Cv vs Nials 16x16.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:My_Cv_vs_Nials_16x16.png&amp;diff=481294"/>
		<updated>2015-01-30T12:33:11Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Combined_Heat_Capactiy_plots.png&amp;diff=481293</id>
		<title>File:Combined Heat Capactiy plots.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Combined_Heat_Capactiy_plots.png&amp;diff=481293"/>
		<updated>2015-01-30T12:24:26Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481292</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481292"/>
		<updated>2015-01-30T12:11:03Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: /* Temperature plots for various different lattice sizes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
The purpose of this exercise was to model a low temperature 2D lattice of a para-magnetic solid.  In particular the cross-over point of the enthalpic and entropic regimes was studied using a Monte Carlo simulation. Please note that all temperatures and energies stated in this exercise are in reduced units of Kb. Heat capacity is therefore in units of Kb^-1.&lt;br /&gt;
 &lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: &lt;br /&gt;
&lt;br /&gt;
 2D: E= -0.5*J*N*4 &lt;br /&gt;
 3D: E=-0.5*J*N*6   &lt;br /&gt;
&lt;br /&gt;
both also yield the general equation: &lt;br /&gt;
&lt;br /&gt;
 E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical basis since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|400px|||Figure showing that the energy and magnetisation are calculated correctly]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Results from Ilanmin.py&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! Screenshot of ILanim.py&lt;br /&gt;
! Values returned from Statistics function&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Nas Ilanim Final Good.png|500px]]&lt;br /&gt;
| [[File:Nas Ilanim Final Stats.PNG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG | This is a caption]]&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Number of cycles required to reach equilibrium&#039;&#039;&#039;&lt;br /&gt;
|[[File:Period converge Eq.PNG]]&lt;br /&gt;
| NA- suggests that either the simulation temperature was above the Curie Temperature so no spontaneous magnetisation could occur or equilibrium was not reached in the time scope of this basic investigation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Typical prints from Ilfinalframe.py&#039;&#039;&#039;&lt;br /&gt;
|[[File:Typical 2 0,1K.png|thumb|right| 2x2 @ 0.1Kb]]&lt;br /&gt;
|[[File:Typical 2 2,5K.png|thumb|right| 2x2 @ 2.5Kb]]&lt;br /&gt;
|[[File:Typical 16 1K.png|thumb|right| 16x16 @ 1Kb]]&lt;br /&gt;
|[[File:48 0.1K.png|thumb|right| 48x48 @ 0.1Kb]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The modification of IsingLattice.py allowed the user to modify the number of cycles that could be discarded before average values began to be calculated. For scanning different temperatures for the largest lattice sizes, a period of discard of 100000 was chosen. This represented a balance between ensuring the lattice could reach equilibrium, whilst also maintaining a realistic calculation time.&lt;br /&gt;
&lt;br /&gt;
=== Temperature plots for various different lattice sizes===&lt;br /&gt;
&lt;br /&gt;
Energy and magnetisation calculations at different temperatures were carried out for various lattice sizes.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Temperature plots from Iltemperaturerange.py&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;2x2 Lattice&amp;lt;/center&amp;gt; &lt;br /&gt;
| &amp;lt;center&amp;gt;4x4 Lattice&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:2x2 rerun.png|400px| 2x2]]&lt;br /&gt;
|[[File:4x4 rerun.png|400px| 2x2]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;8x8 Lattice&amp;lt;/center&amp;gt; &lt;br /&gt;
|&amp;lt;center&amp;gt;16x16 Lattice&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:8x8 rerun.png|400px| 16x16]]&lt;br /&gt;
|[[File:16x16 rerun.png|400px| 48x48]]&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &amp;lt;center&amp;gt;32x32&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|&amp;lt;center&amp;gt;[[File:32x32 rerun.png|400px| 48x48]]&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Combined plots of magnetisation and energy against temperature&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;Combined Magnetism Plot&amp;lt;/center&amp;gt;&lt;br /&gt;
|&amp;lt;center&amp;gt;Combined Energy Plot&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Combined Magnetism.png| 450px]]&lt;br /&gt;
|[[File:Combined Temperature Graph.png| 450px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
We see from the combined graph of energy per spin against temperature that as the lattice size increases the profile of the curves converge to the same profile. The smallest of the lattices we studied that converges to this profile is the 8x8 system, therefore this is the smallest system to display the long range fluctuations.&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481289</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481289"/>
		<updated>2015-01-30T12:03:36Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: /* Nas&amp;#039; CMP Comp */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
The purpose of this exercise was to model a low temperature 2D lattice of a para-magnetic solid.  In particular the cross-over point of the enthalpic and entropic regimes was studied using a Monte Carlo simulation. Please note that all temperatures and energies stated in this exercise are in reduced units of Kb. Heat capacity is therefore in units of Kb^-1.&lt;br /&gt;
 &lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: &lt;br /&gt;
&lt;br /&gt;
 2D: E= -0.5*J*N*4 &lt;br /&gt;
 3D: E=-0.5*J*N*6   &lt;br /&gt;
&lt;br /&gt;
both also yield the general equation: &lt;br /&gt;
&lt;br /&gt;
 E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical basis since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|400px|||Figure showing that the energy and magnetisation are calculated correctly]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Results from Ilanmin.py&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! Screenshot of ILanim.py&lt;br /&gt;
! Values returned from Statistics function&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Nas Ilanim Final Good.png|500px]]&lt;br /&gt;
| [[File:Nas Ilanim Final Stats.PNG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG | This is a caption]]&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Number of cycles required to reach equilibrium&#039;&#039;&#039;&lt;br /&gt;
|[[File:Period converge Eq.PNG]]&lt;br /&gt;
| NA- suggests that either the simulation temperature was above the Curie Temperature so no spontaneous magnetisation could occur or equilibrium was not reached in the time scope of this basic investigation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Typical prints from Ilfinalframe.py&#039;&#039;&#039;&lt;br /&gt;
|[[File:Typical 2 0,1K.png|thumb|right| 2x2 @ 0.1Kb]]&lt;br /&gt;
|[[File:Typical 2 2,5K.png|thumb|right| 2x2 @ 2.5Kb]]&lt;br /&gt;
|[[File:Typical 16 1K.png|thumb|right| 16x16 @ 1Kb]]&lt;br /&gt;
|[[File:48 0.1K.png|thumb|right| 48x48 @ 0.1Kb]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The modification of IsingLattice.py allowed the user to modify the number of cycles that could be discarded before average values began to be calculated. For scanning different temperatures for the largest lattice sizes, a period of discard of 100000 was chosen. This represented a balance between ensuring the lattice could reach equilibrium, whilst also maintaining a realistic calculation time.&lt;br /&gt;
&lt;br /&gt;
=== Temperature plots for various different lattice sizes===&lt;br /&gt;
&lt;br /&gt;
Energy and magnetisation calculations at different temperatures were carried out for various lattice sizes.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Temperature plots from Iltemperaturerange.py&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;2x2 Lattice&amp;lt;/center&amp;gt; &lt;br /&gt;
| &amp;lt;center&amp;gt;4x4 Lattice&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:2x2 rerun.png|400px| 2x2]]&lt;br /&gt;
|[[File:4x4 rerun.png|400px| 2x2]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;8x8 Lattice&amp;lt;/center&amp;gt; &lt;br /&gt;
|&amp;lt;center&amp;gt;16x16 Lattice&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:8x8 rerun.png|400px| 16x16]]&lt;br /&gt;
|[[File:16x16 rerun.png|400px| 48x48]]&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &amp;lt;center&amp;gt;32x32&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|&amp;lt;center&amp;gt;[[File:32x32 rerun.png|400px| 48x48]]&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Combined plots of magnetisation and energy against temperature&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;Combined Magnetism Plot&amp;lt;/center&amp;gt;&lt;br /&gt;
|&amp;lt;center&amp;gt;Combined Energy Plot&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Combined Magnetism.png| 450px]]&lt;br /&gt;
|[[File:Combined Temperature Graph.png| 450px]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481288</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481288"/>
		<updated>2015-01-30T11:59:32Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: /* Nas&amp;#039; CMP Comp */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
The purpose of this exercise was to model a low temperature 2D lattice of a para-magnetic solid.  In particular the cross-over point of the enthalpic and entropic regimes was studied using a Monte Carlo simulation. &lt;br /&gt;
 &lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: &lt;br /&gt;
&lt;br /&gt;
 2D: E= -0.5*J*N*4 &lt;br /&gt;
 3D: E=-0.5*J*N*6   &lt;br /&gt;
&lt;br /&gt;
both also yield the general equation: &lt;br /&gt;
&lt;br /&gt;
 E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical basis since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|400px|||Figure showing that the energy and magnetisation are calculated correctly]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Results from Ilanmin.py&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! Screenshot of ILanim.py&lt;br /&gt;
! Values returned from Statistics function&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Nas Ilanim Final Good.png|500px]]&lt;br /&gt;
| [[File:Nas Ilanim Final Stats.PNG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG | This is a caption]]&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Number of cycles required to reach equilibrium&#039;&#039;&#039;&lt;br /&gt;
|[[File:Period converge Eq.PNG]]&lt;br /&gt;
| NA- suggests that either the simulation temperature was above the Curie Temperature so no spontaneous magnetisation could occur or equilibrium was not reached in the time scope of this basic investigation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Typical prints from Ilfinalframe.py&#039;&#039;&#039;&lt;br /&gt;
|[[File:Typical 2 0,1K.png|thumb|right| 2x2 @ 0.1Kb]]&lt;br /&gt;
|[[File:Typical 2 2,5K.png|thumb|right| 2x2 @ 2.5Kb]]&lt;br /&gt;
|[[File:Typical 16 1K.png|thumb|right| 16x16 @ 1Kb]]&lt;br /&gt;
|[[File:48 0.1K.png|thumb|right| 48x48 @ 0.1Kb]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The modification of IsingLattice.py allowed the user to modify the number of cycles that could be discarded before average values began to be calculated. For scanning different temperatures for the largest lattice sizes, a period of discard of 100000 was chosen. This represented a balance between ensuring the lattice could reach equilibrium, whilst also maintaining a realistic calculation time.&lt;br /&gt;
&lt;br /&gt;
=== Temperature plots for various different lattice sizes===&lt;br /&gt;
&lt;br /&gt;
Energy and magnetisation calculations at different temperatures were carried out for various lattice sizes.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Temperature plots from Iltemperaturerange.py&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;2x2 Lattice&amp;lt;/center&amp;gt; &lt;br /&gt;
| &amp;lt;center&amp;gt;4x4 Lattice&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:2x2 rerun.png|400px| 2x2]]&lt;br /&gt;
|[[File:4x4 rerun.png|400px| 2x2]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;8x8 Lattice&amp;lt;/center&amp;gt; &lt;br /&gt;
|&amp;lt;center&amp;gt;16x16 Lattice&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:8x8 rerun.png|400px| 16x16]]&lt;br /&gt;
|[[File:16x16 rerun.png|400px| 48x48]]&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &amp;lt;center&amp;gt;32x32&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|&amp;lt;center&amp;gt;[[File:32x32 rerun.png|400px| 48x48]]&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Combined plots of magnetisation and energy against temperature&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;Combined Magnetism Plot&amp;lt;/center&amp;gt;&lt;br /&gt;
|&amp;lt;center&amp;gt;Combined Energy Plot&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Combined Magnetism.png| 450px]]&lt;br /&gt;
|[[File:Combined Temperature Graph.png| 450px]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Combined_Magnetism.png&amp;diff=481280</id>
		<title>File:Combined Magnetism.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Combined_Magnetism.png&amp;diff=481280"/>
		<updated>2015-01-30T11:55:56Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: Aa15712 uploaded a new version of &amp;amp;quot;File:Combined Magnetism.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Combined_Temperature_Graph.png&amp;diff=481278</id>
		<title>File:Combined Temperature Graph.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Combined_Temperature_Graph.png&amp;diff=481278"/>
		<updated>2015-01-30T11:53:28Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: Aa15712 uploaded a new version of &amp;amp;quot;File:Combined Temperature Graph.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481271</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481271"/>
		<updated>2015-01-30T11:50:50Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: /* Nas&amp;#039; CMP Comp */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: &lt;br /&gt;
&lt;br /&gt;
 2D: E= -0.5*J*N*4 &lt;br /&gt;
 3D: E=-0.5*J*N*6   &lt;br /&gt;
&lt;br /&gt;
both also yield the general equation: &lt;br /&gt;
&lt;br /&gt;
 E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical basis since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|400px|||Figure showing that the energy and magnetisation are calculated correctly]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Results from Ilanmin.py&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! Screenshot of ILanim.py&lt;br /&gt;
! Values returned from Statistics function&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Nas Ilanim Final Good.png|500px]]&lt;br /&gt;
| [[File:Nas Ilanim Final Stats.PNG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG | This is a caption]]&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Number of cycles required to reach equilibrium&#039;&#039;&#039;&lt;br /&gt;
|[[File:Period converge Eq.PNG]]&lt;br /&gt;
| NA- suggests that either the simulation temperature was above the Curie Temperature so no spontaneous magnetisation could occur or equilibrium was not reached in the time scope of this basic investigation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Typical prints from Ilfinalframe.py&#039;&#039;&#039;&lt;br /&gt;
|[[File:Typical 2 0,1K.png|thumb|right| 2x2 @ 0.1Kb]]&lt;br /&gt;
|[[File:Typical 2 2,5K.png|thumb|right| 2x2 @ 2.5Kb]]&lt;br /&gt;
|[[File:Typical 16 1K.png|thumb|right| 16x16 @ 1Kb]]&lt;br /&gt;
|[[File:48 0.1K.png|thumb|right| 48x48 @ 0.1Kb]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The modification of IsingLattice.py allowed the user to modify the number of cycles that could be discarded before average values began to be calculated. For scanning different temperatures for the largest lattice sizes, a period of discard of 100000 was chosen. This represented a balance between ensuring the lattice could reach equilibrium, whilst also maintaining a realistic calculation time.&lt;br /&gt;
&lt;br /&gt;
=== Temperature plots for various different lattice sizes===&lt;br /&gt;
&lt;br /&gt;
Energy and magnetisation calculations at different temperatures were carried out for various lattice sizes.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Temperature plots from Iltemperaturerange.py&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;2x2 Lattice&amp;lt;/center&amp;gt; &lt;br /&gt;
| &amp;lt;center&amp;gt;4x4 Lattice&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:2x2 rerun.png|400px| 2x2]]&lt;br /&gt;
|[[File:4x4 rerun.png|400px| 2x2]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;center&amp;gt;8x8 Lattice&amp;lt;/center&amp;gt; &lt;br /&gt;
|&amp;lt;center&amp;gt;16x16 Lattice&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:8x8 rerun.png|400px| 16x16]]&lt;br /&gt;
|[[File:16x16 rerun.png|400px| 48x48]]&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &amp;lt;center&amp;gt;32x32&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|&amp;lt;center&amp;gt;[[File:32x32 rerun.png|400px| 48x48]]&amp;lt;/center&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Combined plots of magnetisation and energy against temperature&#039;&#039;&#039;&lt;br /&gt;
|&amp;lt;center&amp;gt;Combined Magnetism Plot&amp;lt;/center&amp;gt;&lt;br /&gt;
|&amp;lt;center&amp;gt;Combined Energy Plot&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[File:Combined Magnetism.png| 450px]]&lt;br /&gt;
|[[File:Combined Temperature Graph.png| 450px]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Combined_Temperature_Graph.png&amp;diff=481264</id>
		<title>File:Combined Temperature Graph.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Combined_Temperature_Graph.png&amp;diff=481264"/>
		<updated>2015-01-30T11:48:31Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Combined_Magnetism.png&amp;diff=481260</id>
		<title>File:Combined Magnetism.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Combined_Magnetism.png&amp;diff=481260"/>
		<updated>2015-01-30T11:46:21Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:8x8_rerun.png&amp;diff=481222</id>
		<title>File:8x8 rerun.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:8x8_rerun.png&amp;diff=481222"/>
		<updated>2015-01-30T11:31:06Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: Aa15712 uploaded a new version of &amp;amp;quot;File:8x8 rerun.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:32x32_rerun.png&amp;diff=481220</id>
		<title>File:32x32 rerun.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:32x32_rerun.png&amp;diff=481220"/>
		<updated>2015-01-30T11:29:10Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:16x16_rerun.png&amp;diff=481219</id>
		<title>File:16x16 rerun.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:16x16_rerun.png&amp;diff=481219"/>
		<updated>2015-01-30T11:28:32Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:8x8_rerun.png&amp;diff=481217</id>
		<title>File:8x8 rerun.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:8x8_rerun.png&amp;diff=481217"/>
		<updated>2015-01-30T11:28:09Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:4x4_rerun.png&amp;diff=481215</id>
		<title>File:4x4 rerun.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:4x4_rerun.png&amp;diff=481215"/>
		<updated>2015-01-30T11:27:41Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:2x2_rerun.png&amp;diff=481214</id>
		<title>File:2x2 rerun.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:2x2_rerun.png&amp;diff=481214"/>
		<updated>2015-01-30T11:27:13Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481209</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481209"/>
		<updated>2015-01-30T11:19:29Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: /* The effect of Temperature on our Lattices */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: &lt;br /&gt;
&lt;br /&gt;
 2D: E= -0.5*J*N*4 &lt;br /&gt;
 3D: E=-0.5*J*N*6   &lt;br /&gt;
&lt;br /&gt;
both also yield the general equation: &lt;br /&gt;
&lt;br /&gt;
 E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical basis since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|400px|||Figure showing that the energy and magnetisation are calculated correctly]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Results from Ilanmin.py&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! Screenshot of ILanim.py&lt;br /&gt;
! Values returned from Statistics function&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Nas Ilanim Final Good.png|500px]]&lt;br /&gt;
| [[File:Nas Ilanim Final Stats.PNG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG | This is a caption]]&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Number of cycles required to reach equilibrium&#039;&#039;&#039;&lt;br /&gt;
|[[File:Period converge Eq.PNG]]&lt;br /&gt;
| NA- suggests that either the simulation temperature was above the Curie Temperature so no spontaneous magnetisation could occur or equilibrium was not reached in the time scope of this basic investigation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Typical prints from Ilfinalframe.py&#039;&#039;&#039;&lt;br /&gt;
|[[File:Typical 2 0,1K.png|thumb|right| 2x2 @ 0.1Kb]]&lt;br /&gt;
|[[File:Typical 2 2,5K.png|thumb|right| 2x2 @ 2.5Kb]]&lt;br /&gt;
|[[File:Typical 16 1K.png|thumb|right| 16x16 @ 1Kb]]&lt;br /&gt;
|[[File:48 0.1K.png|thumb|right| 48x48 @ 0.1Kb]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The modification of IsingLattice.py allowed the user to modify the number of cycles that could be discarded before average values began to be calculated. For scanning different temperatures for the largest lattice sizes, a period of discard of 100000 was chosen. This represented a balance between ensuring the lattice could reach equilibrium, whilst also maintaining a realistic calculation time.&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481200</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481200"/>
		<updated>2015-01-30T11:13:21Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: /* The effect of Temperature on our Lattices */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: &lt;br /&gt;
&lt;br /&gt;
 2D: E= -0.5*J*N*4 &lt;br /&gt;
 3D: E=-0.5*J*N*6   &lt;br /&gt;
&lt;br /&gt;
both also yield the general equation: &lt;br /&gt;
&lt;br /&gt;
 E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical basis since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|400px|||Figure showing that the energy and magnetisation are calculated correctly]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Results from Ilanmin.py&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! Screenshot of ILanim.py&lt;br /&gt;
! Values returned from Statistics function&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Nas Ilanim Final Good.png|500px]]&lt;br /&gt;
| [[File:Nas Ilanim Final Stats.PNG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG | This is a caption]]&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Number of cycles required to reach equilibrium&#039;&#039;&#039;&lt;br /&gt;
|[[File:Period converge Eq.PNG]]&lt;br /&gt;
| NA- suggests that either the simulation temperature was above the Curie Temperature so no spontaneous magnetisation could occur or equilibrium was not reached in the time scope of this basic investigation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Typical prints from Ilfinalframe.py&#039;&#039;&#039;&lt;br /&gt;
|[[File:Typical 2 0,1K.png|thumb|right| 2x2 @ 0.1Kb]]&lt;br /&gt;
|[[File:Typical 2 2,5K.png|thumb|right| 2x2 @ 2.5Kb]]&lt;br /&gt;
|[[File:Typical 16 1K.png|thumb|right| 16x16 @ 1Kb]]&lt;br /&gt;
|[[File:48 0.1K.png|thumb|right| 16x16 @ 0.1Kb]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
48 0.1K.png&lt;br /&gt;
Typical 2 0,1K.png&lt;br /&gt;
Typical 2 2,5K.png&lt;br /&gt;
Typical 16 1K.png&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Typical_16_1K.png&amp;diff=481189</id>
		<title>File:Typical 16 1K.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Typical_16_1K.png&amp;diff=481189"/>
		<updated>2015-01-30T11:07:18Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Typical_2_2,5K.png&amp;diff=481183</id>
		<title>File:Typical 2 2,5K.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Typical_2_2,5K.png&amp;diff=481183"/>
		<updated>2015-01-30T11:05:50Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Typical_2_0,1K.png&amp;diff=481179</id>
		<title>File:Typical 2 0,1K.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Typical_2_0,1K.png&amp;diff=481179"/>
		<updated>2015-01-30T11:03:58Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:48_0.1K.png&amp;diff=481178</id>
		<title>File:48 0.1K.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:48_0.1K.png&amp;diff=481178"/>
		<updated>2015-01-30T11:02:50Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481174</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481174"/>
		<updated>2015-01-30T10:59:34Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: /* The effect of Temperature on our Lattices */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: &lt;br /&gt;
&lt;br /&gt;
 2D: E= -0.5*J*N*4 &lt;br /&gt;
 3D: E=-0.5*J*N*6   &lt;br /&gt;
&lt;br /&gt;
both also yield the general equation: &lt;br /&gt;
&lt;br /&gt;
 E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical basis since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|400px|||Figure showing that the energy and magnetisation are calculated correctly]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Results from Ilanmin.py&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! Screenshot of ILanim.py&lt;br /&gt;
! Values returned from Statistics function&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Nas Ilanim Final Good.png|500px]]&lt;br /&gt;
| [[File:Nas Ilanim Final Stats.PNG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG | This is a caption]]&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin: 1em auto 1em auto;&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Number of cycles required to reach equilibrium&#039;&#039;&#039;&lt;br /&gt;
|[[File:Period converge Eq.PNG]]&lt;br /&gt;
| NA- suggests that either the simulation temperature was above the Curie Temperature so no spontaneous magnetisation could occur or equilibrium was not reached in the time scope of this basic investigation.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Period_converge_Eq.PNG&amp;diff=481173</id>
		<title>File:Period converge Eq.PNG</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Period_converge_Eq.PNG&amp;diff=481173"/>
		<updated>2015-01-30T10:56:12Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481172</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481172"/>
		<updated>2015-01-30T10:50:27Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: /* Accelerating the Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: &lt;br /&gt;
&lt;br /&gt;
 2D: E= -0.5*J*N*4 &lt;br /&gt;
 3D: E=-0.5*J*N*6   &lt;br /&gt;
&lt;br /&gt;
both also yield the general equation: &lt;br /&gt;
&lt;br /&gt;
 E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical basis since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|400px|||Figure showing that the energy and magnetisation are calculated correctly]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Results from Ilanmin.py&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! Screenshot of ILanim.py&lt;br /&gt;
! Values returned from Statistics function&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Nas Ilanim Final Good.png|500px]]&lt;br /&gt;
| [[File:Nas Ilanim Final Stats.PNG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG | This is a caption]]&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481160</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481160"/>
		<updated>2015-01-30T10:38:59Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: /* Applying Monte Carlo Cycles to our System */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: &lt;br /&gt;
&lt;br /&gt;
 2D: E= -0.5*J*N*4 &lt;br /&gt;
 3D: E=-0.5*J*N*6   &lt;br /&gt;
&lt;br /&gt;
both also yield the general equation: &lt;br /&gt;
&lt;br /&gt;
 E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical basis since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|400px|||Figure showing that the energy and magnetisation are calculated correctly]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ &#039;&#039;&#039;Results from Ilanmin.py&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
! Screenshot of ILanim.py&lt;br /&gt;
! Values returned from Statistics function&lt;br /&gt;
|-&lt;br /&gt;
| [[File:Nas Ilanim Final Good.png|500px]]&lt;br /&gt;
| [[File:Nas Ilanim Final Stats.PNG]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG| This is a caption]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nas_Ilanim_Final_Stats.PNG&amp;diff=481157</id>
		<title>File:Nas Ilanim Final Stats.PNG</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nas_Ilanim_Final_Stats.PNG&amp;diff=481157"/>
		<updated>2015-01-30T10:36:10Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nas_Ilanim_Final_Good.png&amp;diff=481145</id>
		<title>File:Nas Ilanim Final Good.png</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Nas_Ilanim_Final_Good.png&amp;diff=481145"/>
		<updated>2015-01-30T10:20:00Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481137</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=481137"/>
		<updated>2015-01-30T10:15:25Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: &lt;br /&gt;
&lt;br /&gt;
 2D: E= -0.5*J*N*4 &lt;br /&gt;
 3D: E=-0.5*J*N*6   &lt;br /&gt;
&lt;br /&gt;
both also yield the general equation: &lt;br /&gt;
&lt;br /&gt;
 E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical basis since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|400px|||Figure showing that the energy and magnetisation are calculated correctly]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
[[File:ILanimFigure2.PNG]]&lt;br /&gt;
[[File:ILanimFigure3.PNG]]&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG| This is a caption]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=480859</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=480859"/>
		<updated>2015-01-29T21:00:19Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: 2D: E= -0.5*J*N*4 3D: E=-0.5*J*N*6   both also yield the general equation: E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical backing since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
The IsingLattic.py was completed to calculate the energy and magnetisation of a given lattice.&lt;br /&gt;
The file below demonstrates that the code returns a correct result.&lt;br /&gt;
 &lt;br /&gt;
[[File:Nas ILCheckFigure1.png |Figure showing I did a good with my code]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
Consider again the expressions for the average energy and magnetisation that we gave in the introduction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle M\right\rangle_T = \frac{1}{Z}\sum_\alpha M\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle E\right\rangle_T = \frac{1}{Z}\sum_\alpha E\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Imagine we want to evaluate these at a particular temperature, in a system of 100 spins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
**&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
[[File:ILanimFigure2.PNG]]&lt;br /&gt;
[[File:ILanimFigure3.PNG]]&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG| This is a caption]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=480854</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=480854"/>
		<updated>2015-01-29T20:58:00Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that in order to miminise the energy of the system we must maximise the total sum of spin-spin interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions: one with the atom each side). We also can apply periodic boundary conditions so an end atom interacts with first atom in the chain. However we need to now recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and as such we need to halve the total number of spin terms that appear in the sum.&lt;br /&gt;
&lt;br /&gt;
 =&amp;gt; E = -0.5*J*N*2 =&amp;gt;  E = -DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: 2D: E= -0.5*J*N*4 3D: E=-0.5*J*N*6   both also yield the general equation: E=-DJN.&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical backing since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs since parallel spins miminise the shielding of nuclear charge (electric field) experience by the other electrons in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2 as spins can be all parallel up or all parallel down. Entropy will be S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stabilising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Magnetisation and Energy Calculations with Python==&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png |Figure showing I did a good with my code]]&lt;br /&gt;
&lt;br /&gt;
==Applying Monte Carlo Cycles to our System==&lt;br /&gt;
&lt;br /&gt;
Consider again the expressions for the average energy and magnetisation that we gave in the introduction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle M\right\rangle_T = \frac{1}{Z}\sum_\alpha M\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle E\right\rangle_T = \frac{1}{Z}\sum_\alpha E\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Imagine we want to evaluate these at a particular temperature, in a system of 100 spins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
**&lt;br /&gt;
You would expect an spontaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the enthalpic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system, however below the Curie Temperature there is a surplus of spin in one direction for a system at equilibrium.  &lt;br /&gt;
&lt;br /&gt;
[[File:ILanimFigure2.PNG]]&lt;br /&gt;
[[File:ILanimFigure3.PNG]]&lt;br /&gt;
&lt;br /&gt;
==Accelerating the Code==&lt;br /&gt;
&lt;br /&gt;
The code was time trialed before and after acceleration. The timetrial was run 20 times before and after modification in order to give an accurate estimate of the mean execution time. These results show a drastic reduction in execution time. It is quite an advantage using a C based extension as opposed to nested for loops!&lt;br /&gt;
&lt;br /&gt;
[[File:Acceleration_Stats.PNG| This is a caption]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature on our Lattices ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:Acceleration_Stats.PNG&amp;diff=480852</id>
		<title>File:Acceleration Stats.PNG</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:Acceleration_Stats.PNG&amp;diff=480852"/>
		<updated>2015-01-29T20:53:44Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=480547</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=480547"/>
		<updated>2015-01-29T14:42:55Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that we can miminise the energy of the system by maximising the sum of interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions (one with the nieghbour before and one with the neighbour after as you travel down the chain) - periodic boundary conditions have been applied so an end atom interacts with the other end atom. However we need to recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as &amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and we need to halve the total number of spin terms that appear in the sum. =&amp;gt; E=- 0.5*J*N*2 =&amp;gt; E=-DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: 2D: E= -0.5*J*N*4 3D: E=-0.5*J*N*6   both also yield E=-DJN&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical backing since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs because parallel spins miminise the shielding of nuclear charge for the other electron in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2. Since spins can be all parallel up or all parallel down. Entropy, S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stablising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Magnetisation and Energy Calculations with Python===&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|Figure showing I did a good with my code]]&lt;br /&gt;
&lt;br /&gt;
==Monte Carlo Time==&lt;br /&gt;
&lt;br /&gt;
Consider again the expressions for the average energy and magnetisation that we gave in the introduction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle M\right\rangle_T = \frac{1}{Z}\sum_\alpha M\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle E\right\rangle_T = \frac{1}{Z}\sum_\alpha E\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Imagine we want to evaluate these at a particular temperature, in a system of 100 spins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Implement a single cycle of the above algorithm in the montecarlocycle(T) function. This function should return the energy of your lattice and the magnetisation at the end of the cycle. You may assume that the energy returned by your energy() function is in units of &amp;lt;math&amp;gt;k_B&amp;lt;/math&amp;gt;! Complete the statistics() function. This should return the following quantities whenever it is called: &amp;lt;math&amp;gt;&amp;lt;E&amp;gt;, &amp;lt;E^2&amp;gt;, &amp;lt;M&amp;gt;, &amp;lt;M^2&amp;gt;&amp;lt;/math&amp;gt;, and the number of Monte Carlo steps that have elapsed.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
**&lt;br /&gt;
You would expect an instantaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the energetic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system. &lt;br /&gt;
&lt;br /&gt;
[[File:ILanimFigure2.PNG]]&lt;br /&gt;
[[File:ILanimFigure3.PNG]]&lt;br /&gt;
&lt;br /&gt;
== The effect of Temperature ==&lt;br /&gt;
&lt;br /&gt;
In order to study the effect of temperature of our system we need a method to acquire reliable values for the averages of energy and magnification. This is done by taking the mean value of the attribute over an extended number of cycles when at equilibrium. It is therefore required to ignore the values prior to the equilibrium being achieved. The speed at which equilibrium is established depends on the size of the Ising lattice and also the temperature. Over several runs it was noted that having a larger system size and higher temperature increased the number of cycles required to come to equilibrium. For larger lattices this is because the probability of choosing a spin element that lowers the energy of the system is related to the inverse square of the length of the matrix (we note that the ΔE term is not dependent on lattice size, so can be ignored for comparison of two situations where only the size varies). However, the effect of temperature can be explained by the exp(-ΔE/T) term. As T tends to infinity the exponential function tends to 1, and as T tends to 0 so does the exponential function. Therefore at higher temperatures the system is more likely to accept a spin change that raises the total energy, which means it takes longer to arrive at the equilibrium state from a random distribution. We should also mention that over the Curie Temperature there will be no net magnetisation and that the system equilibrilises about an equal number of randomly distributed spin up/down.  &lt;br /&gt;
&lt;br /&gt;
The periods required for the equilibrium were found by repeating ILfinalframe.py 10 times for each temperature/size combination. Reported is an up-rounded approximation of the number of cycles required to reach equilibrium. Selected &amp;quot;typical&amp;quot; figures of &amp;quot;Ilfinalfram.py&amp;quot; are included to evidence this.&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=479245</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=479245"/>
		<updated>2015-01-23T15:49:22Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that we can miminise the energy of the system by maximising the sum of interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions (one with the nieghbour before and one with the neighbour after as you travel down the chain) - periodic boundary conditions have been applied so an end atom interacts with the other end atom. However we need to recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as &amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and we need to halve the total number of spin terms that appear in the sum. =&amp;gt; E=- 0.5*J*N*2 =&amp;gt; E=-DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: 2D: E= -0.5*J*N*4 3D: E=-0.5*J*N*6   both also yield E=-DJN&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical backing since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs because parallel spins miminise the shielding of nuclear charge for the other electron in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2. Since spins can be all parallel up or all parallel down. Entropy, S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stablising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Magnetisation and Energy Calculations with Python===&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|Figure showing I did a good with my code]]&lt;br /&gt;
&lt;br /&gt;
==Monte Carlo Time==&lt;br /&gt;
&lt;br /&gt;
Consider again the expressions for the average energy and magnetisation that we gave in the introduction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle M\right\rangle_T = \frac{1}{Z}\sum_\alpha M\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle E\right\rangle_T = \frac{1}{Z}\sum_\alpha E\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Imagine we want to evaluate these at a particular temperature, in a system of 100 spins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Implement a single cycle of the above algorithm in the montecarlocycle(T) function. This function should return the energy of your lattice and the magnetisation at the end of the cycle. You may assume that the energy returned by your energy() function is in units of &amp;lt;math&amp;gt;k_B&amp;lt;/math&amp;gt;! Complete the statistics() function. This should return the following quantities whenever it is called: &amp;lt;math&amp;gt;&amp;lt;E&amp;gt;, &amp;lt;E^2&amp;gt;, &amp;lt;M&amp;gt;, &amp;lt;M^2&amp;gt;&amp;lt;/math&amp;gt;, and the number of Monte Carlo steps that have elapsed.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
**&lt;br /&gt;
You would expect an instantaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the energetic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system. &lt;br /&gt;
&lt;br /&gt;
[[File:ILanimFigure2.PNG]]&lt;br /&gt;
[[File:ILanimFigure3.PNG]]&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:ILanimFigure3.PNG&amp;diff=479244</id>
		<title>File:ILanimFigure3.PNG</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:ILanimFigure3.PNG&amp;diff=479244"/>
		<updated>2015-01-23T15:48:52Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=479237</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=479237"/>
		<updated>2015-01-23T15:42:04Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that we can miminise the energy of the system by maximising the sum of interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions (one with the nieghbour before and one with the neighbour after as you travel down the chain) - periodic boundary conditions have been applied so an end atom interacts with the other end atom. However we need to recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as &amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and we need to halve the total number of spin terms that appear in the sum. =&amp;gt; E=- 0.5*J*N*2 =&amp;gt; E=-DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: 2D: E= -0.5*J*N*4 3D: E=-0.5*J*N*6   both also yield E=-DJN&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical backing since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs because parallel spins miminise the shielding of nuclear charge for the other electron in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2. Since spins can be all parallel up or all parallel down. Entropy, S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stablising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Magnetisation and Energy Calculations with Python===&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|Figure showing I did a good with my code]]&lt;br /&gt;
&lt;br /&gt;
==Monte Carlo Time==&lt;br /&gt;
&lt;br /&gt;
Consider again the expressions for the average energy and magnetisation that we gave in the introduction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle M\right\rangle_T = \frac{1}{Z}\sum_\alpha M\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle E\right\rangle_T = \frac{1}{Z}\sum_\alpha E\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Imagine we want to evaluate these at a particular temperature, in a system of 100 spins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Implement a single cycle of the above algorithm in the montecarlocycle(T) function. This function should return the energy of your lattice and the magnetisation at the end of the cycle. You may assume that the energy returned by your energy() function is in units of &amp;lt;math&amp;gt;k_B&amp;lt;/math&amp;gt;! Complete the statistics() function. This should return the following quantities whenever it is called: &amp;lt;math&amp;gt;&amp;lt;E&amp;gt;, &amp;lt;E^2&amp;gt;, &amp;lt;M&amp;gt;, &amp;lt;M^2&amp;gt;&amp;lt;/math&amp;gt;, and the number of Monte Carlo steps that have elapsed.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
**&lt;br /&gt;
You would expect an instantaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the energetic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system. &lt;br /&gt;
&lt;br /&gt;
[[File:ILanimFigure2.PNG]]&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=479233</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=479233"/>
		<updated>2015-01-23T15:40:22Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that we can miminise the energy of the system by maximising the sum of interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions (one with the nieghbour before and one with the neighbour after as you travel down the chain) - periodic boundary conditions have been applied so an end atom interacts with the other end atom. However we need to recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as &amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and we need to halve the total number of spin terms that appear in the sum. =&amp;gt; E=- 0.5*J*N*2 =&amp;gt; E=-DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: 2D: E= -0.5*J*N*4 3D: E=-0.5*J*N*6   both also yield E=-DJN&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical backing since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs because parallel spins miminise the shielding of nuclear charge for the other electron in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2. Since spins can be all parallel up or all parallel down. Entropy, S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stablising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Magnetisation and Energy Calculations with Python===&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|Figure showing I did a good with my code]]&lt;br /&gt;
&lt;br /&gt;
==Monte Carlo Time==&lt;br /&gt;
&lt;br /&gt;
Consider again the expressions for the average energy and magnetisation that we gave in the introduction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle M\right\rangle_T = \frac{1}{Z}\sum_\alpha M\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle E\right\rangle_T = \frac{1}{Z}\sum_\alpha E\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Imagine we want to evaluate these at a particular temperature, in a system of 100 spins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Implement a single cycle of the above algorithm in the montecarlocycle(T) function. This function should return the energy of your lattice and the magnetisation at the end of the cycle. You may assume that the energy returned by your energy() function is in units of &amp;lt;math&amp;gt;k_B&amp;lt;/math&amp;gt;! Complete the statistics() function. This should return the following quantities whenever it is called: &amp;lt;math&amp;gt;&amp;lt;E&amp;gt;, &amp;lt;E^2&amp;gt;, &amp;lt;M&amp;gt;, &amp;lt;M^2&amp;gt;&amp;lt;/math&amp;gt;, and the number of Monte Carlo steps that have elapsed.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
**&lt;br /&gt;
You would expect an instantaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the energetic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system. &lt;br /&gt;
&lt;br /&gt;
[[File:ILanimFigure2.PNG.PNG]]&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:ILanimFigure2.PNG&amp;diff=479231</id>
		<title>File:ILanimFigure2.PNG</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:ILanimFigure2.PNG&amp;diff=479231"/>
		<updated>2015-01-23T15:40:00Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=479219</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=479219"/>
		<updated>2015-01-23T15:25:00Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: /* Monte Carlo Time */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that we can miminise the energy of the system by maximising the sum of interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions (one with the nieghbour before and one with the neighbour after as you travel down the chain) - periodic boundary conditions have been applied so an end atom interacts with the other end atom. However we need to recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as &amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and we need to halve the total number of spin terms that appear in the sum. =&amp;gt; E=- 0.5*J*N*2 =&amp;gt; E=-DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: 2D: E= -0.5*J*N*4 3D: E=-0.5*J*N*6   both also yield E=-DJN&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical backing since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs because parallel spins miminise the shielding of nuclear charge for the other electron in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2. Since spins can be all parallel up or all parallel down. Entropy, S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stablising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Magnetisation and Energy Calculations with Python===&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|Figure showing I did a good with my code]]&lt;br /&gt;
&lt;br /&gt;
==Monte Carlo Time==&lt;br /&gt;
&lt;br /&gt;
Consider again the expressions for the average energy and magnetisation that we gave in the introduction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle M\right\rangle_T = \frac{1}{Z}\sum_\alpha M\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle E\right\rangle_T = \frac{1}{Z}\sum_\alpha E\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Imagine we want to evaluate these at a particular temperature, in a system of 100 spins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Implement a single cycle of the above algorithm in the montecarlocycle(T) function. This function should return the energy of your lattice and the magnetisation at the end of the cycle. You may assume that the energy returned by your energy() function is in units of &amp;lt;math&amp;gt;k_B&amp;lt;/math&amp;gt;! Complete the statistics() function. This should return the following quantities whenever it is called: &amp;lt;math&amp;gt;&amp;lt;E&amp;gt;, &amp;lt;E^2&amp;gt;, &amp;lt;M&amp;gt;, &amp;lt;M^2&amp;gt;&amp;lt;/math&amp;gt;, and the number of Monte Carlo steps that have elapsed.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: If &amp;lt;math&amp;gt;T &amp;lt; T_C&amp;lt;/math&amp;gt;, do you expect a spontaneous magnetisation (i.e. do you expect &amp;lt;math&amp;gt;\left\langle M\right\rangle \neq 0&amp;lt;/math&amp;gt;)? When the state of the simulation appears to stop changing (when you have reached an equilibrium state), use the controls to export the output to PNG and attach this to your report. You should also include the output from your statistics() function.&#039;&#039;&#039;&lt;br /&gt;
**&lt;br /&gt;
You would expect an instantaneous magnetisation if T is less than T&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; as the energetic preference for aligned spins is not overcome by thermal excitation. By examining ΔG=ΔH-TΔS we can see that entropic term increases with the temperature of the system. &lt;br /&gt;
&lt;br /&gt;
[[File:ILanimFigure1.PNG]]&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=File:ILanimFigure1.PNG&amp;diff=479216</id>
		<title>File:ILanimFigure1.PNG</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=File:ILanimFigure1.PNG&amp;diff=479216"/>
		<updated>2015-01-23T15:21:44Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=478835</id>
		<title>Rep:NasCOMP</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Rep:NasCOMP&amp;diff=478835"/>
		<updated>2015-01-20T17:38:11Z</updated>

		<summary type="html">&lt;p&gt;Aa15712: /* Monte Carlo Time */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Nas&#039; CMP Comp=&lt;br /&gt;
&lt;br /&gt;
==Ising Model==&lt;br /&gt;
&lt;br /&gt;
The interaction energy is defined as &amp;lt;math&amp;gt;- \frac{1}{2} J \sum_i^N \sum_{j\  \in\  \mathrm{neighbours}\left(i\right)} s_i s_j&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;J&amp;lt;/math&amp;gt; is a constant which controls the strength of interaction and the notation &amp;lt;math&amp;gt;j\  \in\  \mathrm{neighbours}\left(i\right)&amp;lt;/math&amp;gt; indicates that spin &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; must lie in a lattice cell adjacent to spin &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Show that the lowest possible energy for the Ising model is &amp;lt;math&amp;gt;E\ =\ -DNJ&amp;lt;/math&amp;gt;, where &amp;lt;math&amp;gt;D&amp;lt;/math&amp;gt; is the number of dimensions and &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of spins. What is the multiplicity of this state? Calculate its entropy.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By viewing the above equation we realise that we can miminise the energy of the system by maximising the sum of interactions. This occurs when all spins are aligned. In a 1D system of N atoms, each atom has 2 interactions (one with the nieghbour before and one with the neighbour after as you travel down the chain) - periodic boundary conditions have been applied so an end atom interacts with the other end atom. However we need to recognise that spin &amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is the same as &amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*spin&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and we need to halve the total number of spin terms that appear in the sum. =&amp;gt; E=- 0.5*J*N*2 =&amp;gt; E=-DJN&lt;br /&gt;
&lt;br /&gt;
We can make analogous arguments for 2D and 3D lattices, where each atom interacts with 4 and 6 neighbors respectively: 2D: E= -0.5*J*N*4 3D: E=-0.5*J*N*6   both also yield E=-DJN&lt;br /&gt;
&lt;br /&gt;
This result has some theoretical backing since we know from Hund&#039;s Rule of Maximum Multiplicity that fermions in degenerate energy levels adopt parallel spins in order to minimise their total energy. This occurs because parallel spins miminise the shielding of nuclear charge for the other electron in the atom. &lt;br /&gt;
&lt;br /&gt;
The multiplicity of this energy level is 2. Since spins can be all parallel up or all parallel down. Entropy, S= K&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;ln2 .&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Imagine that the system is in the lowest energy configuration. To move to a different state, one of the spins must spontaneously change direction (&amp;quot;flip&amp;quot;). What is the change in energy if this happens (&amp;lt;math&amp;gt;D=3,\ N=1000&amp;lt;/math&amp;gt;)? How much entropy does the system gain by doing so?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Flipping one spin in a 3D lattice changes 6 stablising interactions into destabilising interactions. Not only does this mean there is an  increase in the energy of the system from the removal of the 6 stabilising interactions, but the destabilsation further cancels out 6 more stabilising alignments. From this logic we can make a simple modification to our equation for total energy: E=-DNJ =&amp;gt; -DJ(N-4n) - where n is the number of anti-aligned spins isolated in the parallel spin lattice. The energy of the second lowest energy state in the system states is therefore 12J higher than the lowest state. The degeneracy is 2*1000, as every atom could be spin up whilst the others are spin down and visa versa. Change in Entropy ΔS= k&amp;lt;sub&amp;gt;b&amp;lt;/sub&amp;gt;ln (2000/2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: Calculate the magnetisation of the 1D and 2D lattices in figure 1. What magnetisation would you expect to observe for an Ising lattice with &amp;lt;math&amp;gt;D = 3,\ N=1000&amp;lt;/math&amp;gt; at absolute zero?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Magnitisation is simply the sum of all spins. For the lattices shown in Fig1. &lt;br /&gt;
&lt;br /&gt;
1D: Total Magnetisation = 3*(1)+2*(-1)=1&lt;br /&gt;
2D: Total Magnetisation = 13*(1)+12*(-1)=1&lt;br /&gt;
&lt;br /&gt;
For a 3D lattice at 0°K we would expect all spins to be parallel therefore M = 1000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Magnetisation and Energy Calculations with Python===&lt;br /&gt;
&lt;br /&gt;
[[File:Nas ILCheckFigure1.png|Figure showing I did a good with my code]]&lt;br /&gt;
&lt;br /&gt;
==Monte Carlo Time==&lt;br /&gt;
&lt;br /&gt;
Consider again the expressions for the average energy and magnetisation that we gave in the introduction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle M\right\rangle_T = \frac{1}{Z}\sum_\alpha M\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\left\langle E\right\rangle_T = \frac{1}{Z}\sum_\alpha E\left(\alpha\right) \exp \left\{-\frac{E\left(\alpha\right)}{k_BT}\right\} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Imagine we want to evaluate these at a particular temperature, in a system of 100 spins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&amp;lt;big&amp;gt;TASK&amp;lt;/big&amp;gt;: How many configurations are available to a system with 100 spins? To evaluate these expressions, we have to calculate the energy and magnetisation for each of these configurations, then perform the sum. Let&#039;s be very, very, generous, and say that we can analyse &amp;lt;math&amp;gt;1\times 10^9&amp;lt;/math&amp;gt; configurations per second with our computer. How long will it take to evaluate a single value of &amp;lt;math&amp;gt;\left\langle M\right\rangle_T&amp;lt;/math&amp;gt;?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each atom has an equal probability of being spin up or spin down and each atom adopts its direction independently. In a 100 atom system we would therefore expect their to be a possible 2&amp;lt;sup&amp;gt;100&amp;lt;/sup&amp;gt; possible configurations = 1.2676506e+30. It would take 1.2676506e+21 seconds to work out the Magnitisation of 100 atoms in all configurations.&lt;/div&gt;</summary>
		<author><name>Aa15712</name></author>
	</entry>
</feed>