Ferromagnetic coupling (J > 0) rewards aligned neighbors, forming macroscopic magnetic domains. Antiferromagnetic coupling (J < 0) favors anti-parallel neighbors, yielding a Néel checkerboard ground state.
Spin Lattice 36 × 36
Click or drag across the lattice to perturb spins. Periodic boundary conditions active.
At zero external field, the square-lattice critical temperature is Tc = 2|J| / ln(1 + √2) ≈ 2.269 |J|. Near this point, fluctuations occur across a broad range of length scales. A nonzero field changes this critical behavior.
Single-spin Metropolis flips suffer from critical slowing down near Tc. The Wolff algorithm grows and flips entire correlated spin clusters in a single step (at h = 0), rapidly decorrelating states.
The dashed energy line is the exact value for the N × N periodic lattice on screen, so a correct simulation converges to it even at Tc; the "Onsager" readouts are the infinite-lattice values at h = 0. A finite periodic lattice rounds the transition: near Tc and above it |M| stays above the infinite-lattice value (zero above Tc) by roughly 1/N, and no exact finite-N |M| is shown. Antiferromagnets (J < 0) are tracked by the staggered magnetization ms, since M/N stays near zero in a Néel state.
One Wolff "sweep" here means about N² spins flipped, a measure of work and not of physical time, so do not compare it with Metropolis sweeps. Below Tc whole-lattice clusters flip M between + and − constantly; that is correct. Watch |M| (yellow) for the order parameter.
Cooling a disordered state quickly (about 1,200 sweeps) rarely reaches the single-domain ground state: stripe or blob domains get stuck, because removing a straight wall costs no energy and only fluctuations move it. That is real metastability, not a bug. Cool more slowly (see Anneal Cooling Rate) to see the difference.
On a triangle, three antiparallel-preferring neighbours cannot all be satisfied, so at best one bond per triangle stays unsatisfied. For the uniform nearest-neighbour model at h = 0 in the thermodynamic limit, the ground-state energy is exactly −|J| per spin, shared by a huge number of configurations (residual entropy ≈ 0.323 per spin, Wannier 1950), and there is no transition at any T > 0. m3 is a diagnostic of three-sublattice ordering: the ideal (+, +, −) state scores 0.667, but it is only one of many ground states, so a low m3 is expected. The ferromagnet on the same lattice is unfrustrated: exact Tc = 4|J| / ln 3, and the Wolff update works.
Random ferro- and antiferromagnetic bonds frustrate many plaquettes. There is no exact e(T) here. The ≈ −1.40 per spin figure is an approximate, disorder-averaged T = 0 literature value for large square lattices, not the ground state of the sample on screen, and the 2D ±J glass has no finite-temperature transition. Slow anneals still get trapped in metastable states. The ferromagnetic Wolff update is unavailable for disordered bonds, so Metropolis is used.
Dashed lines and "Exact" readouts are exact results at h = 0 with uniform bonds. Square lattice: the energy line is the exact value for the N × N periodic torus on screen (Kaufman; Ferdinand and Fisher), so a correct simulation converges to it even at Tc, and the Onsager infinite-lattice energy and |m| are shown for comparison. Triangular lattice: the infinite-lattice Houtappel/Wannier energy, compared with independent Monte Carlo at several temperatures and both signs of J before use. The repository's tests compare the update rules with exact enumeration of small lattices, with these exact energies, and with seeded bugs that must make them fail. The spin-glass reference and the residual entropy are literature values and are not checked here.