10.3 Importance sampling through Markov chains 305
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
1 2 3 4 5 6 7
Specific heat
Figure 10.1. Specific heat per site in units ofJ/kBof the Ising 20×20 square
lattice as a function of the coupling constant reduced temperatureτ=kBT/J.
calculated at every step) to the total energy so that we always have the energy of the
new state at our disposal. Similarly it is possible to keep track of the magnetisation
during the simulation. The approach described here avoids having to calculate these
quantities every now and then by summing over the entire lattice.
As the acceptance probability exp[−βE(X→X′)]can assume only five dif-
ferent values, it is advisable to store these in an array in order to avoid calculating
the exponential function over and over again. It is nice to display the lattice after
every fixed number of MC steps on the computer screen and give the user the oppor-
tunity to change the temperature during the simulation. A magnetic field can also
be included. Visual inspection should convince you that the phase transition for
zero field takes place somewhere aroundβJ≈0.44, although critical fluctuations
make it difficult to locate this transition temperature with satisfactory precision.
The specific heat can be determined as the variance of the energy (seeEq. (7.28))
and this should exhibit a peak near the critical temperature (seeFigure 10.1).
The initial configuration will be chosen either random (infinite temperature) or
as one of the two ground states: all spins either+or−. In the first case, if the
temperature at which the system is simulated is lower than the transition temperat-
ure, spontaneous magnetisation may not always occur. In fact, several large regions
of spin+or of spin−will be formed, separated by boundaries which are relat-
ively smooth in order to minimise their energy. It will now take a very long time
before one of the two spin values dominates. This undercooling effect can only be
avoided by cooling the system gradually down to the desired temperature, taking
care that the cooling rate is particularly slow nearTc. After passing a first order
transition in a simulation, it is often impossible to arrive at the equilibrium state
within a reasonable time, as the system cannot overcome the free energy barrier