Simulating spin glasses at scale has always been a pain — Python is too slow, and C++ is too painful. Peapods is my attempt at a middle ground: a Monte Carlo package for Ising spin systems where the hot loops are written in Rust and everything else stays in Python, glued together with PyO3. You just pip install peapods and go.

The package supports the usual suspects — Metropolis and Gibbs single-spin flips, Swendsen–Wang and Wolff cluster updates, and parallel tempering — on arbitrary-dimensional hypercubic lattices with arbitrary coupling constants. Replicas run in parallel via Rayon, so you get multi-core scaling essentially for free.

The whole thing started because I needed a fast, flexible simulator for my spin glass phase transition work and got tired of fighting with Numba. Rust turned out to be a surprisingly pleasant language for this kind of thing.

Back to projects