Research entry
Ising Model Simulation in Rust + WebAssembly
Active · March 2026
A publication-grade Monte Carlo simulation engine for classical spin models, achieving 0.01% accuracy on the 3D critical temperature. Supports three universality classes, GPU acceleration via CUDA, and finite-size scaling analysis — targeting Physical Review E.
Live Demo
Try the interactive 3D Ising model simulation running entirely in your browser via WebAssembly:
Key Results
The simulator recovers known exact solutions and experimental values with high precision:
| Quantity | Measured | Reference | Error |
|---|---|---|---|
| 3D cubic T_c | 4.512(4) J/k_B | 4.5115 (Hasenbusch 2010) | 0.01% |
| 2D square T_c | 2.269 J/k_B | 2.2692 (Onsager exact) | < 0.02% |
| gamma/nu | 1.933(30) | 1.964 (theory) | 1.6% |
| beta/nu | 0.492(26) | 0.518 (theory) | 5.0% |
| nu | 0.667(37) | 0.630 (theory) | 5.9% |
| Fe Curie temp | 1043 K | 1043 K (experiment) | < 1% |
| Ni Curie temp | ~631 K | ~627 K (experiment) | ~1% |
| KZ exponent kappa | 0.258(15) | 0.279 (theory) | 7.4% |
The hyperscaling relation 2(beta/nu) + gamma/nu = d is satisfied to within 2.7%.
Finite-Size Scaling
The core analysis technique is finite-size scaling (FSS) on 3D simple-cubic lattices from L=8 to L=48, using the Wolff cluster algorithm.
Binder Cumulant Crossing
The Binder cumulant U_4 is a dimensionless ratio that crosses at the same point for all lattice sizes, pinning the critical temperature independently of any exponent assumptions.

Histogram Reweighting
Ferrenberg-Swendsen histogram reweighting extrapolates from 41 simulated temperatures to a fine 200-point grid near T_c, giving much sharper resolution than raw data alone.

Peak Scaling
The heights of thermodynamic peaks follow power laws in system size. Log-log fits extract the critical exponent ratios gamma/nu and beta/nu.

Scaling Collapse
When axes are rescaled using the extracted exponents, data from all lattice sizes collapse onto a single universal curve — the hallmark of a continuous phase transition.

Three Universality Classes on GPU
The same engine supports three spin symmetries, each belonging to a distinct universality class. GPU-accelerated runs on an RTX 2060 produce finite-size scaling results for all three:
Ising (Z_2 discrete symmetry)

Heisenberg (O(3) continuous symmetry)

XY (O(2) planar symmetry)

Each model recovers the expected critical exponents for its universality class, confirming that the GPU implementation is correct across all three symmetries.
Algorithms and Performance
Wolff Cluster Algorithm
The Wolff algorithm grows correlated spin clusters from a random seed and flips the entire cluster in one step. Near T_c, it achieves a dynamic exponent z_W of roughly 0.3, compared to z of roughly 2.17 for single-spin Metropolis — approximately 7x faster decorrelation at the critical point.
GPU Checkerboard Metropolis
The lattice is coloured like a chessboard so that all same-colour spins can update simultaneously without neighbour conflicts. On an RTX 2060 this enables over 10,000 simultaneous spin updates, providing an estimated 50-200x speedup over CPU single-core Metropolis.
GPU Parallel Tempering
Replica exchange Monte Carlo runs multiple copies of the system at different temperatures on the GPU, swapping configurations between adjacent replicas to improve sampling efficiency — especially near the critical point where autocorrelation times diverge.
Non-Equilibrium Physics
Kibble-Zurek Mechanism
When the system is cooled through T_c at a finite rate, it cannot keep up with the changing equilibrium. Topological defects (domain walls) freeze in, with density following a power law in the quench timescale.
The measured exponent kappa = 0.258(15) at L=80 agrees well with the theoretical prediction kappa = nu/(1 + nu*z) = 0.279.

Domain Coarsening (Allen-Cahn)
After a sudden quench below T_c, domains of aligned spins grow over time. The domain wall density decays as rho(t) ~ t^(-1/2), consistent with Allen-Cahn theory for non-conserved order parameter dynamics.

Materials Science: From Simulation to Experiment
By fitting the exchange coupling constant J to reproduce experimental Curie temperatures, the simulator bridges lattice models to real magnetic materials:
| Material | Lattice | J_fit | Predicted T_c | Experimental T_c |
|---|---|---|---|---|
| Iron (Fe) | BCC | 14.3 meV | 1043 K | 1043 K |
| Nickel (Ni) | FCC | 5.6 meV | ~631 K | ~627 K |
Supporting arbitrary graph topologies (BCC, FCC, bond-diluted, custom edge lists) makes this possible without changing the core simulation engine.
Bond Dilution
Randomly removing bonds weakens the magnetic coupling. The critical temperature decreases approximately linearly with dilution fraction, consistent with the Harris criterion.

Validation
The simulator is validated against exact analytical solutions and consistency checks:
- Onsager exact solution — 2D Monte Carlo matches the exact analytical result to within 0.02%
- Exact enumeration — full brute-force calculation on a 4x4 lattice matches Monte Carlo averages
- Fluctuation-dissipation theorem — heat capacity from energy fluctuations agrees with the direct numerical derivative
- Autocorrelation scaling — autocorrelation times grow with system size as expected
- Known limits — fully ordered at T=0, fully disordered at T → infinity

Engineering and Reproducibility
This is not just a simulation — it is a reproducible research platform:
- 87 tests (74 unit + 13 integration) across the full codebase
- CI/CD via GitHub Actions: format, build, test, clippy, cargo-deny on Ubuntu/Windows/macOS
- Versioned result packs with checksums, manifests, and full parameter provenance
- Scripted reproduction —
reproduce_validation.py,reproduce_classical_baseline.py,reproduce_dilution.py,reproduce_kz.py - Graph-agnostic architecture —
neighbours: Vec<Vec<usize>>works for any topology - WASM compilation for the interactive browser demo via wasm-bindgen
The entire codebase is roughly 5,000 lines of Rust across 46 source files, with optional CUDA support gated behind a feature flag.
Publication Status
A manuscript is in preparation targeting Physical Review E, covering:
- Finite-size scaling validation on the 3D cubic Ising model
- GPU-accelerated Monte Carlo for three universality classes
- Exchange coupling fitting for BCC iron and FCC nickel
- Bond dilution and the Harris criterion
- Kibble-Zurek defect scaling
Research Roadmap
| Phase | Focus | Timeline |
|---|---|---|
| 1. Benchmark Platform | Lock down correctness, finish L≤192 GPU analysis | Current |
| 2. Anisotropy Crossover | Heisenberg-to-Ising crossover via uniaxial anisotropy | Next |
| 3. Materials-Inspired | BCC/FCC Heisenberg with fitted couplings, competing interactions | Future |
| 4. Quantum Bridge | Transverse-field Ising model as first quantum-critical benchmark | Long-term |
Sources
- Repository: github.com/faulknco/ising-rs
- Live demo: faulknco.github.io/ising-rs
- Knowledge base: KNOWLEDGE_BASE.md
- Figure gallery: docs/gallery.md