Magnetic domains
A grid of tiny magnetic moments that self-organize into domains — regions of aligned spins. Click and drag on the lattice to apply an external magnetic field and watch domains aligned with the field grow at the expense of others. The hysteresis loop on the right records the material’s magnetic memory: the magnetization depends not just on the current field, but on the field’s history. Heat the lattice past the Curie temperature and watch order collapse into chaos.
The Ising model
This simulation is based on the 2D Ising model, one of the most studied systems in statistical physics. Each site on a square lattice holds a spin that points either up (+1) or down (−1). Neighboring spins prefer to align (ferromagnetic coupling J > 0), and an external magnetic field H encourages spins to align with it. The Hamiltonian is −J Σ sisj − H Σ si.
Domains and domain walls
At low temperature, the exchange coupling between neighbors causes spins to form large domains — regions of uniform alignment. The boundaries between domains (domain walls) cost energy. The system minimizes total energy by reducing the number and length of domain walls, which is why domains tend to be large and compact. When an external field is applied, domains aligned with the field grow by moving domain walls, while opposing domains shrink.
The hysteresis loop
If you slowly increase the external field from zero, spins aligned with the field grow in number and the net magnetization M increases. When you reverse the field, M does not retrace the same path — it follows a different curve, forming a hysteresis loop. This asymmetry means the material has memory: its current state depends on its history. The area enclosed by the hysteresis loop represents energy dissipated as heat during each magnetization cycle.
Remanence is the magnetization remaining when the field returns to zero. Coercivity is the reverse field needed to demagnetize the material. Hard magnets (wide hysteresis loops) retain magnetization well; soft magnets (narrow loops) are easy to magnetize and demagnetize.
The Curie temperature
As temperature increases, thermal fluctuations compete with the exchange coupling. At the Curie temperature Tc, the system undergoes a phase transition from ferromagnetic (ordered) to paramagnetic (disordered). Above Tc, thermal energy overwhelms the coupling and domains break apart completely. For the 2D Ising model, the exact Curie temperature is Tc = 2J / ln(1 + √2) ≈ 2.269 J/kB, derived by Lars Onsager in 1944.
Quantum origins
The exchange coupling J has a quantum mechanical origin: the exchange interaction arises from the Pauli exclusion principle and the Coulomb interaction between electrons. Electrons with parallel spins must have antisymmetric spatial wavefunctions, which changes their electrostatic energy. This purely quantum effect, with no classical analogue, is responsible for ferromagnetism — one of the most striking macroscopic consequences of quantum mechanics.