Potts Number Of States

Program PottsNumberOfStates uses the Wang-Landau Monte Carlo algorithm to estimate the number of microstates $\Omega(E)$ for each value of $E$ in the q-state 2d Potts model on a square lattice. In the Potts model there are $q$ possible states for each spin and the interaction energy between any pair of neighboring spins is $-J$ if the spins have the same value and is 0 otherwise. The 2-state Potts model is equivalent to the Ising model. Once $\Omega(E)$ is known averages such as the mean energy can be found at any temperature using $$\overline{E} = \sum_E EP(E) = \frac{\sum_E E\Omega(E)e^{-E/kT}}{\sum_E\Omega(E)e^{-E/kT}}. $$

The program also calculates the specific heat as a function of temperature from a single simulation. From the energy distribution $\ln{P(E)}$ we obtain evidence for whether the phase transition is continuous or discontinuous. The nature of the transition depends on $q$.

Problem: Application of Wang-Landau algorithm to the Potts model
  1. What is the relation of the $q=2$ Potts model to the usual Ising model? In particular, what is the relation of the interaction energy $K$ defined in the Potts model and the interaction energy $J$ defined in the Ising model?
  2. Program PottsNumberOfStates implements the Wang-Landau algorithm for the Potts model on a square lattice. Run the program for $L = 16$ and various values of $q$ and verify that the peak in the specific heat occurs near the known exact value of the transition temperature given by $T_c = (\ln{(1 + \sqrt{q})})^{-1}$. You will need more than 100,000 Monte Carlo steps to obtain reliable data.
  3. Choose $q = 2$ and $q=3$ and observe the energy distribution $P(E) = \Omega(E) e^{-\beta E}$ at $T=T_c$. Do you see one peak or two?
  4. Choose $q = 10$ and observe the energy distribution $P(E)$ at $T=T_c$. You should notice two peaks in this distribution. Discuss why the occurrence of two peaks is appropriate for a discontinuous transition.


  1. The program on this page was converted from Java to JavaScript by Wolfgang Christian and Robert Hanson using the SwingJS system developed at St. Olaf College.
  2. Download source code for all java programs. Requires OSP library to run.
  3. Download all python programs.
  4. Download executable jar file for all programs (need to install Java on your computer to run jar files.)
  5. Problem 5.21 in Statistical and Thermal Physics: With Computer Applications, 2nd ed., Harvey Gould and Jan Tobochnik, Princeton University Press (2021).

OSP Projects:
Open Source Physics - EJS Modeling - Tracker - Physlet Physics - Physlet Quantum Physics - STP Book