Phase Transitions
←Previous
Homework assignment
This homework is due on Monday 20.11..
In this assignment we will look at the Ising model and
evaluate the spontaneous magnetisation of the spins in
a square grid in 2 dimensions. To this end we will use
the two methods discussed in lecture 8, namely Mean Field
Approximation (MFA) and Monte Carlo simulation (MC) to
evaulate the normalised spontaneous magnetisation M
in dependence on the temperature T, which is given
in units of jJ/kB.
-
Mean field approximation
As you may remember from lecture 8, in mean field approximation
the normalised magnetisation M/Mmax is given by the
solution of an implicit equation, which we aim to solve in this first step.
For this you need to
- Implement a root finding algorithm in the file
RootFinder.py. By default
we assume the algorithm of choice is the Newton-Raphson method
discussed in lecture 5, implemented as the method NewtonRaphson,
see the lecture notes for details.
- Implement f(x) and its first derivative in
IsingModelAnalytical.py,
encoding the class IsingMeanField.
These two functions are made accessible through the __call__
method, with mode selecting whether the function (mode=0) or
its dervaitve (mode=1) are returned.
-
Monte Carlo simulation
In the MC solution, encoded in IsingModel.py,
there are a number of classes to be made functional:
- The Lattice-class:
This class mainly carries a two-dimensional lattice with dim sites in
each dimension:
-
In its initialisation, in the __init__ method, these sites are either
filled randomly, through the method randomSpin() of the class Ising,
or with a fixed default value given as the argument of the
__init__ method.
-
The __call__ method returns the spin direction at position (lx, ly).
Note: Employ periodic boundary conditions for the lattice.
-
The randomPosition method returns a random position x, y inside the
lattice.
-
The setSpin method sets the spin at position lx, ly to the value
spin.
- The Ising-class:
This class defines the interactions of the spins. Here you should fix the
following methods:
- randomSpin
Return a random spin in the Ising model, i.e. eith +1 or -1.
- modifySpin
Modify the given spin such that it takes another than the original value.
- calculateEnergy
Calculate the contribution of a spin at the given position to the total
energy. Note: You amy use the __call__ method of the Lattice class.
- The Metropolis-class:
Here, in each lattice sweep the method modifySpin is called
dim² times. This method needs to be filled:
- In modifySpin a single Metropolis step is performed for one
spin: A spin position is selected at random and a new trial spin is generated,
different from the original one. The energy difference is calculated and
defines whether the trial spin is accepted or not. For details of how
this happens, cf. Lecture 8.
- The Observables-class:
This class hosts the observables we would like to calculate and, in fact,
also the scanning over the temperatures, in scanTemperatures. In each of
the steps, the observables are calulcated in our case now it is just the
normalised magnetisation M/Mmax, realised in.
- calculateMnorm.
This method needs being fixed, see the lecture ntoes for details.
If you want to do something interesting on top of that (no marks!),
implement the Heisenberg model in addition, or check for the impact of
external fields etc.. There's a plethora of idea in Lecture 9.
That's the last homework assignment. Have fun!