HomeArticlesIsing Model

The Ising Model: Phase Transitions and Ferromagnetism

A grid of up-or-down spins, one coupling constant, and a Metropolis rule — enough to reproduce a real magnetic phase transition on a laptop.

mysimulator teamUpdated June 2026≈ 9 min read▶ Open the simulation

A lattice of tiny magnets

The Ising model reduces a magnet to the simplest thing that can still show a phase transition: a grid of spins, each pointing up or down (+1 or −1), each one wanting to line up with its neighbours because that lowers the system’s energy. The energy of any configuration is the Hamiltonian below — J sets how strongly neighbours prefer to agree, and h is an external magnetic field nudging every spin the same way.

H = −J Σ⟨i,j⟩ s_i s_j  −  h Σ_i s_i
       neighbouring pairs           external field term

Left alone at high temperature, thermal jitter beats the coupling and spins point every which way — zero net magnetisation. Cooled below a critical temperature, the coupling wins and large patches of the lattice lock into agreement, giving a nonzero net magnetisation without any external field at all: spontaneous magnetisation, the same phenomenon that makes a bar of iron a permanent magnet below its Curie point.

Metropolis–Hastings: sampling without solving

For any lattice bigger than a few dozen spins there are too many configurations to enumerate, so the simulation uses a Monte Carlo method instead: pick a random spin, compute how much the total energy would change if it flipped (ΔE), and flip it if that lowers the energy or, if it raises it, flip it anyway with probability exp(−ΔE / kᵇT). Repeated millions of times, this Metropolis rule generates configurations distributed exactly according to the Boltzmann distribution at temperature T — without ever computing the (impossibly large) normalising sum over all states.

pick random site i
ΔE = energy_if_flipped(i) - energy_now(i)
if ΔE <= 0 or random() < exp(-ΔE / (k*T)):
    flip(i)
live demo · Metropolis Monte Carlo on a 2D spin lattice● LIVE

The Curie point and critical phenomena

For the 2D square lattice, Lars Onsager found the exact critical temperature in 1944: kᵇT_c / J = 2 / ln(1 + √2), approximately 2.269. Just above T_c the lattice is a fine, ever-shifting patchwork of tiny domains; just below, domains merge and grow until one orientation dominates the whole grid. Near T_c the correlation length — the typical size of an agreeing patch — diverges, and quantities like magnetisation and susceptibility follow power laws in (T − T_c) with universal exponents shared by wildly different physical systems, which is why the Ising model is treated as a template for phase transitions generally, not just magnetism.

Why simple Metropolis gets slow near T_c

Close to the critical point, domains are huge and flipping one spin at a time barely nudges them — the number of steps needed to produce a statistically independent configuration grows sharply as T approaches T_c, a problem called critical slowing down. Cluster algorithms such as Wolff and Swendsen–Wang sidestep it by identifying and flipping whole clusters of aligned spins in one move, based on the same coupling probability, which keeps simulations near the Curie point tractable.

Frequently asked questions

Why does the lattice look like static above the critical temperature but form solid patches below it?

Above T_c thermal energy dominates the coupling between neighbours, so spins flip almost independently and the grid looks like noise. Below T_c the coupling wins, small aligned patches grow and merge, and the lattice settles into large domains — the visual signature of spontaneous magnetisation.

What exactly does the Metropolis rule decide?

For each proposed spin flip it computes the resulting energy change ΔE. If flipping lowers the energy, it always accepts. If flipping raises the energy, it still accepts with probability exp(−ΔE / kᵇT) rather than rejecting outright — that small chance of accepting an unfavourable move is what lets the system escape local configurations and correctly sample the full Boltzmann distribution.

Why use Monte Carlo instead of just computing the exact answer?

The exact partition function sums over 2 to the power of the number of spins configurations — astronomically large for any lattice bigger than a postage stamp. Monte Carlo sampling reaches the same statistical answer without ever enumerating that sum, at the cost of a small amount of statistical noise.

Try it live

Everything above runs in your browser — open Ising Model and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Ising Model simulation

What did you find?

Add reproduction steps (optional)