Potts model applet: simulation in the multicanonical ensemble with the Wang-Landau algorithm

This applet implements the Wang-Landau algorithm, which simulates the model in the multicanonical ensemble, and computes (an estimate of) the density of states of the model.
In this ensemble, the usual Boltzmann weight w(E)=exp(-E/kT) is replaced by w(E)=1/n(E), where n(E) gradually converges to the exact density of states as the simulation advances. A single-spin update from Ea to Eb is accepted with probability n(Ea)/n(Eb), so that the energy histogram N(E)=w(E) n(E) eventually becomes flat. Wang-Landau's iteration scheme works roughly as follow: each time an energy level E is visited, n(E) gets updated according to n(E) *= f, or equally S(E) += ln f, where S(E)=ln n(E) is the microcanonical entroyp ("ln f" is displayed as "WL-weight" in the left panel). Most visited energy levels are thus disfavored, which slowly lead to a flat histogram (the algorithm "compensates" for rare events by over-favoring them, and conversely for events which show up too often).
Once in a while, the histogram roughness is checked, and if it falls below a given threshold ( the "Maximum histogram roughness" field in the configuration panel), the update-weight is reduced by two, and the simulation goes on.

Ref: Wang, F. & Landau, D.P.
Determining the density of states for classical statistical models: A random walk algorithm to produce a flat histogram
Phys. Rev. E, 2001 , 64 , 056101

Applet help:

  • The S(E) chart on the right side displays the estimate of the microcanonical entropy S(E) in real time.
  • The south-panel displays charts of reweighted thermodymical averages as a funtion of temperature. The "F(kT,E)" button let you visualize the variational free energy. For first-order transitions (Q>4) and near the transition temperature, you might witness two minima (provided the lattice size is not too small).
  • The "temperature" button let you configure many things regarding the simulation, e.g. temperature range for the reweighting procedure, number of measurements between checks histogram roughness, ...
  • if the applet runs too slowly, reduce the "Latency". If still slow, deselect the "Animate" checkbox.

Download source code : montecarlo.zip

S. Reynal (ENSEA/UCP)