Measuring the Ising Model
Contents
Measuring the Ising Model#
Our goal in this section will be to start measuring properties of our Ising model. We will work with a larger system (
Minimal Background#
We can measure properties or observables of our system at a temperature
Three observables we will consider are the energy
where
Notice that this means that
Question to think about: Why do we study
and not ?
When we measure an observable we can either compute its histogram or expectation value.
Phases#
A phase of matter (like gas, liquid, solid) can be defined by an order parameter (i.e. an observable) which is zero in one phase and not zero in another phase. A 2D Ising model has two phases: the ferromagnet (essentially all spins up) and the paramagnet (essentially all random spins). In the paramagnet, the squared magnetization is zero in the thermodynamic limit. The ferromagnet, the squared magnetization is not zero in the thermodynamic limit.
A note about errors#
You can think of your Monte Carlo code as a black box that gives correlated samples of the magnetization. To get an average, do exactly what you’re familiar with: sum the results then divide by the number of results. But further analysis involves subtleties that come with correlated data.
Consider estimating the error of the previously computed average. Given uncorrelated data, the error in the mean typically quantified by the standard error,
As an example, suppose you’ve generated 100 samples of the Ising model with a MCMC method which has
To compute the standard error scaled by the autocorrelation time
import stats
(mean, variance, error, autocorrelation) = stats.Stats(myNumpyArrayOfData)
The variable error
is the standard error that properly takes into account the autocorrelation time.
Measuring#
For a range of
a prototypical snapshot (you can build this with
pylab.matshow()
)a histogram of
the value of
(and error bar)a histogram of
the value of
(and error bar)
Testing
To test your results, it’s important to check limits that you are able to compute in some alternative way. In our case, it is reasonably straightforward to figure out the
Grading
Fill out the table in the document. Draw vertical lines on your respective histograms where axvline()
). On your
At
If you look at your snapshot, you should see two phases. One (at
Note about domain walls: Maybe you are seeing domain walls? Why is that? This is because it’s very hard to move from the all-up to the all-down configuration. This isn’t a critical problem (this happens in the real world too). You don’t have to fix it but you could by adding in additional smarter moves.
In between these two phases there is a phase transition; there is a critical point (one very specific temperature) where this happens.
You now want to use this information to compute the transition location. You should be able to roughly guess where the transition is just by looking at the prototypical snapshots. To do a more thorough job, we are going to use the magnetization squared. This is the order parameter for ferromagnetic phase. When
It won’t be exactly this sharp in the finite system but it should still give you a good sense for the location of the transition.
Grading
Graph
Another way to identify the transition is to compute the specific heat
$
If it easy for you to compute a curve for Energies[1:] - Energies[:-1]
). This will work but requires you to have the error bars on your energies pretty small.
An alternative (and more robust approach) is to first interpolate your scipy.interpolate.UnivariateSpline
. Then you can use .derivative()
to get the derivative.
Grading
Produce a curve of the specific heat vs.
Extra Credit (5 points)
One thing that we haven’t measured is the free energy and entropy. In order to measure this, you need to do some additional thermodynamic integration. Look up how to go about this and implement it computing the entropy and free energy of the Ising model as a function of temperature.