Processing math: 100%

Lattice gas project

A lattice gas is a system of spins that can take a value of +1 and -1. These spins do not interact with each other but they do interact with an external magnetic field, H. The Hamiltonian for this system is thus:

H(s1,s2,,sn)=HμNi=1si

where si is the spin coordinate of the ith spin. The code in the cell below calculates the internal energy for a system of N spins in an external magnetic field, H, in units of Hμ:

Calculating the canonical partition function for this system

We can calculate the canonical partition function for a system of n spins in a lattice gas model using:

Z=1s1=01s2=01sn=0eβH(s1,s2,,sn)

An analytical expression for this quantity can be determined can be determined as follows:

Z=1s1=01s2=01sn=0eβHμni=1z(si)=1s1=01s2=01sn=0ni=1eβHμz(si)=[1s1=0eβHμz(s1)][1s2=0eβHμz(s2)][1sn=0eβHμz(sn)]=[eβHμ+eβHμ][eβHμ+eβHμ][eβHμ+eβHμ]=[eβHμ+eβHμ]n=2ncoshn(βHμ)

Alternatively we can calculate the value of the canonical partition function at a particular temperature for a small numbers of spins numerically using the first of the expressions in the cell. The cell below thus contains a function that calculates the partition function for a system of N spins exactly. The value of the partition function for a system of 10 spins as a function of temperature is then shown plotted on a graph.

Calculating the ensemble average for the energy as a function of temperature

We can calculate the ensemble average of the energy for a lattice gas module using the following formula:

E=1Z1s1=01s2=01sn=0H(s1,s2,,sn)eβH(s1,s2,,sn)

In addition, this ensemble average can be found by taking the partial derivative of the logarithm of the partition function with respect to inverse temperature:

E=(lnZβ)

When we do this for the analytical experssion that was derived in the previous markdown cell we find that:

E=(lnZβ)=β[nln2+nlncosh(βHμ)]=1cosh(βHμ)βcosh(βHμ)=Hμsinh(βHμ)cosh(βHμ)=Hμtanh(βHμ)

The alternative is to calculate the ensemble average numerically using the first formula in this markdown cell. In the cell below there is a function that calculates the ensemble average of the energy of N spins exactly. The value of the ensemble average for a system of 10 spins as a function of temperature is then shown plotted on a graph.

Calculating the histogram as a function of the magnetization at two temperatures

We can also calculate the probability of the probability of occupying a state with a particular magnetism m using

P(M=m)=1Z1s1=01s2=01sn=0δ(M(s1,s2,,sn),m)eβH(s1,s2,,sn)

This is done below for two different temperatures and histograms are shown

Calculating the spin-spin correlation function

The spin-spin correlation function is calculated using:

δ(r)=(sisi)(si+rsi)(sisi)2

where si is the ensemble average for the spin variables. This quantity can be used to give a sense of the strength of the interaction between pairs of spins that are separated by different numbers of spins.

The code in the cell below calculates the spin-spin correlation function for a set of 10 spins in a magentic field.

The limits of the (exact) numerical solution

Here you should explain why we can only calculate the solutions to these problems numerically when the number of sites in the model is small.