Spin configuration
Spin +1 Spin −1
ln g(E) — density of states
C(T)/N and F(T)/N from g(E)

Wang-Landau Density of States (2D)

The Wang-Landau algorithm is a flat-histogram Monte Carlo method that estimates the density of states g(E) of a statistical system in a single random walk — replacing separate Metropolis simulations at every temperature with one run whose output gives the full thermodynamics of the system at any temperature by direct summation. This 2D simulator runs the algorithm live on a 2D Ising spin lattice: a grid of red/blue spins shows the current microstate, a bar chart builds up ln g(E) in real time as the modification factor ln f halves each time the visit histogram becomes flat enough (exactly as in the original 2001 Wang-Landau paper), and a third panel turns the running g(E) estimate into an actual specific-heat and free-energy curve you can read at any temperature with a slider — the "one run, every temperature" payoff made visible.