How it Works
Each site on the lattice holds a classical spin: a unit vector (Sx, Sy, Sz) that can point anywhere on a sphere, not just "up" or "down" as in the simpler Ising model. Neighboring spins interact through the exchange energy E = -J·Σ Sᵢ·Sⱼ, summed over nearest-neighbor pairs with periodic boundary conditions (the lattice wraps at the edges). Positive J favors parallel alignment (ferromagnetic); negative J favors anti-parallel alignment (antiferromagnetic).
The simulation uses the Metropolis Monte Carlo algorithm: each animation frame performs a full sweep (one attempted update per site on average). For every attempt, a site is picked at random, a new random unit-vector orientation is proposed, and the resulting energy change ΔE is computed from its four lattice neighbors. Moves that lower the energy are always accepted; moves that raise it are accepted with probability exp(-ΔE / kBT). Over many sweeps this drives the lattice toward thermal equilibrium at the chosen temperature T, visibly reorganizing into large colorful ordered domains at low T and dissolving into noise-like disorder at high T.
Metropolis acceptance: P = min(1, exp(-ΔE / kBT))
Magnetization: |M| = |(1/N)·Σᵢ Sᵢ|, 0 ≤ |M| ≤ 1
Color mapping: hue = atan2(Sy, Sx), lightness ∝ Sz
Frequently Asked Questions
What is the Heisenberg spin model?
The classical Heisenberg model represents each magnetic moment as a continuous 3D unit vector rather than a fixed direction. Neighboring spins interact through an exchange energy E = -J·Sᵢ·Sⱼ, and the system evolves toward the orientation pattern that minimizes total energy at a given temperature.
How does the Heisenberg model differ from the Ising model?
The Ising model restricts each spin to two discrete states, up or down. The Heisenberg model allows spins to point in any direction on the unit sphere, giving continuous rotational freedom — a more realistic description of many real magnetic materials.
What does the Metropolis Monte Carlo algorithm do?
At each step, a random site is chosen and a new random spin orientation is proposed. If it lowers the energy it is always accepted; if it raises the energy it is accepted with probability exp(-ΔE / kBT). This samples the Boltzmann distribution so the lattice reflects thermal equilibrium at temperature T.
Why is the acceptance probability exp(-ΔE/kBT)?
This is the Boltzmann factor from statistical mechanics: the relative probability of a state with energy E is proportional to exp(-E/kBT). Using it as the acceptance rule guarantees detailed balance, so simulated configurations converge to the correct thermal ensemble.
What does the magnetization |M| measure?
The magnetization is the vector average of all spins, M = (1/N)·Σ Sᵢ. Its magnitude ranges from 0 (random orientations, no net moment) to 1 (all spins perfectly aligned) — the simplest order parameter for magnetic ordering.
Why doesn't the 2D Heisenberg model have a true phase transition at finite temperature?
The Mermin-Wagner theorem shows continuous symmetries cannot be spontaneously broken in 1D or 2D short-range systems at any T > 0 — long-wavelength spin-wave fluctuations destroy true long-range order. The lattice still shows strong short-range correlations and large ordered domains at low T; related planar (XY-like) models show a topological Berezinskii-Kosterlitz-Thouless (BKT) crossover instead of a conventional transition.
What does the coupling constant J represent?
J is the exchange interaction strength between neighboring moments, arising quantum mechanically from electron wavefunction overlap and the Pauli exclusion principle. Positive J (ferromagnetic) favors parallel spins; negative J (antiferromagnetic) favors a checkerboard-like anti-parallel pattern at low T.
What does the external field control do?
Enabling the field adds a Zeeman term -h·Sᵢz to each spin's energy, favoring alignment along z. This mimics an applied magnetic field Bz; even a modest field pulls the lattice toward net out-of-plane magnetization, visible as the canvas becoming uniformly brighter or darker.
Where is the classical Heisenberg model used in real research?
It is a standard testbed for ferromagnets, antiferromagnets, and frustrated magnets, and underlies simulations used in spintronics device design, magnetic recording media research, and quantum magnetism studies where classical Monte Carlo guides quantum many-body calculations.
What is a Monte Carlo sweep?
One sweep attempts one Metropolis update per lattice site on average (N×N attempts for an N×N lattice). Many sweeps let the configuration relax from a random start toward equilibrium; acceptance rate and magnetization typically stabilize after a few dozen sweeps.