Computational Physics Lab 7
The Ising Model
This goal of this lab is to study the second-order phase transition
between ferromagnetic and paramagnetic states using the Ising
model with Monte Carlo approach. It might be helpful to familiarize
yourself with sections 8.1 through 8.4 in Giordano & Nakanishi
before working on this assignment.
1)
Implement the Ising model on the square lattice using the algorithm
described by G&N in Example 8.1 (page 247). This algorithm sets up
a Markov chain whose limiting distribution will allow you to
sample from the canonical ensemble of the model. It is best to do
this in C++ for speed, and then use SWIG for interfacing the results to
Python for visualization. You can modify the code from Lab 6 for this purpose. The structure set up by the CPInitialValueSolver
code can be used with minimal changes. The smallest possible change
would be commenting out the "assert(nTSteps > 1)" statement on line
16 of CPInitialValueSolver.cc and
then, in the constructor of your derived class, calling the base class
constructor with "nTSteps" argument set to 1. You will then get a call
to the "propagate" function of your derived class in which
"next" and "previous[0]" pointers refer to the same memory
location.
Use periodic boundary conditions. Include the code in
your model to calculate the average system energy (G&N formula 8.5)
and the average magnetization, as well as the interface to access them from Python. The
averaging should be performed over a configurable number of lattice
sweeps after skipping a number of sweeps required for the Markov chain
convergence.
Animate your model. Access the convergence speed by eye for different values of temperature. You can pattern your code on WaveSolver2d_example.py
from Lab 6. Also, estimate the convergence from the plot of the
average magnetization vs. the cycle number (as in Fig. 8.6 of G&N
on page 249).
On a Linux system, drand48()
is a reasonably good generator of pseudo-random numbers between 0 and 1
which can be used with C++ code. For more details, run "man drand48" in
your terminal. Note that in C++ you should write
#include <cstdlib>
instead of
#include <stdlib.h>
2) Figure
out the critical temperature of the system using a plot similar to
G&N Figure 8.7 (on page 251). For this study, use J value of 1.
3)
Using your model, accomplish exercise 8.3 in G&N. Use just the
square lattice, not the triangular one. Try a few different lattice
sizes.
4)
Obtain the specific heat per spin as a function of temeperature
for a 10x10 lattice by differentiating the average energy w.r.t.
temperature. Compare your result with Fig. 8.9 in G&N (which was
obtained using a different method).
Submit your lab report by email
before 2 pm 03/13/2008.
Include the code, the plots, and a brief discussion of results.