Cluster Moves#
Cluster moves like the Wolff algorithm or the Swendsen-Wang Algorithm. allow you to flip an entire cluster instead of a single spin at a time.
(Extra Credit: 5 points for Implementing the Wolff Algorith)
(Extra Credit: 5 points for the rest of this page)
Critical Slowing Down#
When we do single spin-flips, the amount of time between having a full independent sample of information can be long. This is especially true as we approach the critical temperature. Here the correlation length diverges and the consequence of this is that the autocorrelation time also should diverge as a function of system size \(L\). In this section, we are going to try to understand this.
First, let’s go ahead and graph the autocorrelation time as a function of inverse temperature \(\beta\) for our \(27 \times 27\) and our \(81 \times 81\) system. Unfortunately, to get a pretty good estimate of the autocorrelation time, we want to actually do 100,000 sweeps.
Compute it for the following betas:
betas = [0.35,0.375,0.4,0.425,0.45,0.475,0.5,0.525,0.555]
Grading
Produce the autocorrelation as a function of \(\beta\) graph with both system sizes on the same graph. You should notice the following things:
As you approach the critical temperature, the autocorrelation time explodes. For the \(81 \times 81\), I get that it is in the range of 500-1000 sweeps.
Away from the critical temperature, both lattices have the same autocorrelation time.
As you approach the critical temperature, the autocorrelation time for the \(81 \times 81\) lattice is much larger. This is because the largest cluster can only be as large as the system size so that sets an upper bound on the autocorrelation time.
If you got close enough to the critical temperature and ran enough sweeps for large enough system sizes, you should be able to see that the autocorrelation time goes as \((T-T_c)^{-2.2}\). This is somewhat difficult to see withotu being careful though so we don’t require you to verify it.
Divergence of Autocorrelation Time with System Size
We will measure a related quantity though. Away from the critical temperature, the autocorrelation time increases as the system gets larger and then eventually converges at some system size. This is because there is some correlation size for the largest clusters and once your system is bigger then that correlation size, we don’t expect the autocorrelation time to grow even if the system gets bigger.
On the other hand, if you are at the critical temperature, then the larger clusters span the entire system and you expect that the autocorrelation time to continue increasing. In fact, we expect that the autocorrelation time should go as \(L^{-2.2}\).
To test this, take the following Ls=np.array([4,8,16,32,64,128])
and measure the autocorrelation time as a function of \(L\). Graph log(AutoCorrelation) vs. \(\log(L)\) Do this at two different betas: 1.0/2.269 and 1/0.3. I needed to do 100,000 sweeps to get reasonable statistics. You should see that \(\beta=1/0.3\) quickly saturates while \(\beta=1/2.269\) grows indefinitely with a slope around 2.2. This corresponds to the above scaling.
Grading
Make the plot of log(AutoCorrelation) vs. \(\log(L)\) with two lines, one for each \(\beta\)
Snapshots of Slow Equilibration
Finally, we would just like to see visually that the autocorrelation time is slow. Again, work at the critical temperature \(\beta=1.0/2.269\) for the \(81 \times 81\) lattice. Take snapshots at sweeps
10,000
10,100
20,000 and do a matshow on them. You should see that the two snapshots that are 100 sweeps apart are very similar suggesting that there was very little change in the configuration.
Grading
Produce these snapshots
Wolff Algorithm#
We would now like to switch to an algorithm where the autocorrelation time is much better.
We are now going to describe the Wolff algorithm.
In each step of the Wolff algorithm you need to:
Choose a random spin and add it to your cluster.
For every bond you haven’t considered which goes from a spin in the cluster to a spin not in the cluster of the same spin (both up or both down)
Add the new spin to the cluster with probability \(1-\exp[-2 \beta J]\)
In order to define a sweep of the Wolff algorithm, we will need to figure out what the average cluster size that is being flipped is. This will depend on \(\beta\). In order to do this, take 1000 steps in your Monte Carlo Ising model and measure the average cluster size. Then define a sweep for that simulation as a number of steps which is proportional to \(L^2\) over the cluster size.
Grading
Implement the Wolff algorithm and verify that you get the same \(\langle M^2 \rangle\) for \(\beta=0.3\) that you had before.
Now that we have a working Wolff algorithm, we would like to graph two things. For the \(81 \times 81\) cluster graph the autocorrelation time as a function of \(\beta\) as well as the average cluster size as a function of \(\beta\) (on two different graphs)