🌀 Spin Glass
PhysicsDifficulty 4/5
Temperature
Lattice
Statistics
Energy / N²
Order param q
Frustrated %
MC sweeps
0
Satisfied bond
Frustrated bond
Spin ↑
Spin ↓
ℹ Info & Algorithm

Random ferromagnetic (+J) and antiferromagnetic (−J) bonds prevent the lattice from finding a single ground state. The system instead wanders among many metastable minima — the defining feature of a spin glass.

Hamiltonian

H = −Σ Jij si sj

where Jij ∈ {+1, −1} drawn at initialisation; si ∈ {+1, −1}.

Metropolis MC Steps

  • Pick a random spin i
  • Compute ΔE = 2 si Σj∈nn Jij sj
  • If ΔE ≤ 0: flip unconditionally
  • Else: flip with prob exp(−ΔE / T)

Order Parameter

q = (1/N²) Σ 〈si〉²

Non-zero q below Tf signals frozen spins.

Did You Know?

The mathematics of spin glasses — replica theory by Giorgio Parisi (Nobel 2021) — also describes the loss landscape of deep neural networks and the hardness of NP optimisation problems.

FAQ — Spin Glass Physics

What is a spin glass?

A spin glass is a disordered magnetic material where interactions between spins are randomly ferromagnetic or antiferromagnetic. This randomness causes frustration — no configuration satisfies all bonds — producing a rugged energy landscape with many metastable states and slow, complex relaxation dynamics.

What is magnetic frustration?

Frustration occurs when competing interactions cannot all be satisfied simultaneously. A classic example: in a triangle with two ferromagnetic and one antiferromagnetic bond, at least one bond must remain unsatisfied regardless of spin orientations. Red bonds in this simulation mark frustrated interactions.

What is the Edwards-Anderson model?

Proposed by Edwards and Anderson in 1975, this model places Ising spins (s = ±1) on a lattice with random nearest-neighbour couplings Jij ∈ {±1}. The Hamiltonian H = −Σ Jij si sj captures spatial disorder and is the standard lattice model for spin glasses.

What does the Metropolis algorithm do here?

A randomly chosen spin is flipped if the energy decreases (ΔE ≤ 0), or with probability exp(−ΔE/T) if it increases. This preserves detailed balance and drives the system toward thermal equilibrium. Many proposed flips are attempted each animation frame (one MC sweep = N² attempts).

What is the spin-glass order parameter q?

The Edwards-Anderson order parameter q = ⟨(1/N²) Σ ⟨si⟩²⟩ measures whether individual spins freeze into preferred orientations over time. q → 0 in the paramagnetic phase and q → 1 in the deeply frozen spin-glass phase, even though the global magnetisation remains near zero.

Why does the energy relax logarithmically?

The rugged energy landscape contains barriers of widely varying heights. Escaping each successive barrier is exponentially harder, so the system's energy decreases roughly as E(t) ∝ −log(t). This characteristic slow, non-exponential relaxation is a hallmark of spin glasses and distinguishes them from simple ferromagnets.

What is the freezing temperature Tf?

Below Tf the spin glass enters a frozen phase: thermal fluctuations are too weak to explore all metastable states ergodically, q becomes non-zero, and the system exhibits history-dependent (non-equilibrium) behaviour. The dashed vertical line in the energy plot marks your chosen Tf.

How is a spin glass different from a ferromagnet?

In a ferromagnet all couplings Jij are positive, the ground state has aligned spins, and global magnetisation is large. In a spin glass, random signs of Jij mean the time-averaged magnetisation is zero, yet individual spins freeze in fixed random directions. The relevant order parameter is q, not m.

What real materials behave as spin glasses?

Dilute magnetic alloys such as Cu:Mn and Au:Fe are canonical spin glasses. The RKKY interaction between magnetic impurities oscillates in sign with distance, producing random competing interactions. Spin-glass-like behaviour also appears in frustrated magnets, certain polymers, and protein-folding energy landscapes.

What is the connection to neural networks?

Hopfield's 1982 associative memory model has the same energy function as an Edwards-Anderson spin glass. Stored memories correspond to local energy minima. Parisi's replica theory for spin glasses was later applied to understand the loss landscape of deep neural networks and the typical-case complexity of NP-hard problems.

About this simulation

Written by MySimulator Team · Reviewed by MySimulator Editorial Review

Last updated: 5 July 2026

This model puts an Ising spin (±1) on every site of a square lattice and gives each bond between neighbours a randomly fixed sign — ferromagnetic or antiferromagnetic — the Edwards-Anderson spin glass. Because signs are mixed, no arrangement of spins can satisfy every bond at once: some triangles of interactions are inherently frustrated. A Metropolis Monte Carlo algorithm flips spins one at a time, accepting energy-raising moves with probability exp(−ΔE/T), letting the lattice hunt for low-energy states without ever fully settling.

🔬 What it shows

Coloured bonds mark whether each link between neighbouring spins is satisfied (blue) or frustrated (red), while the arrows show each spin's current orientation. The lower strip plots the average energy per site against Monte Carlo sweeps, revealing the slow, logarithmic-like decay typical of glassy relaxation rather than the fast exponential settling of an ordinary magnet.

🎮 How to use

Drag Temperature T (0.1–4.0) to control how readily energy-raising flips are accepted, and set the freezing marker T_f (0.3–2.0) as a reference line on the plot. Grid size N (10–50) resizes the lattice and reseeds random bonds, Steps/frame (1–100) sets how many sweeps run per animation frame, and Run/Pause and Reset control the simulation.

💡 Did you know?

Giorgio Parisi won the 2021 Nobel Prize in Physics for his replica-theory solution to the spin-glass problem, work that later proved useful for understanding neural network memory models and the difficulty of certain combinatorial optimisation problems.

Frequently asked questions

Why do the bond colours change as the simulation runs?

Each bond's colour reflects whether it is currently satisfied given the two spins either side of it and its own fixed random sign. As spins flip during Monte Carlo sweeps, a bond can switch between satisfied (blue) and frustrated (red) even though its underlying coupling strength never changes.

What does raising the temperature slider actually do?

Temperature T sets the probability of accepting a spin flip that increases the total energy, via the factor exp(−ΔE/T). Higher T means more disordering flips are accepted, keeping the lattice close to a random paramagnetic state; lower T makes the system increasingly reluctant to accept unfavourable flips, favouring slow settling into low-energy frustrated configurations.

Why does the energy plot flatten out so slowly?

Because bonds have mixed signs, the energy landscape has many nearly-equal-depth valleys separated by barriers of different heights. Escaping one valley for a deeper one gets progressively harder, so the average energy per site declines in a slow, roughly logarithmic manner instead of dropping quickly to a single ground state.

What happens when I change the grid size N?

Moving the Grid size slider (10–50) rebuilds the lattice at the new size and draws a completely fresh set of random bond signs and spin orientations, resetting the sweep counter and energy history. It does not resize the existing lattice in place.

Is there a genuine ordered phase in this simulation?

Not in the usual ferromagnetic sense. Because roughly half the bonds are antiferromagnetic, the global magnetisation stays close to zero even at low temperature. What can freeze instead is the order parameter q, which captures whether individual spins settle into a fixed (if random-looking) orientation over time — the hallmark of the spin-glass phase below the freezing temperature.