peapods: A Rust-Accelerated Monte Carlo Package for Ising Spin Systems
Yan Ru Pei
Abstract
We present peapods (github.com/PeaBrane/peapods), an open-source Python package for Monte Carlo simulation of Ising spin systems with arbitrary coupling constants on arbitrary-dimensional hypercubic lattices with periodic boundary conditions. The computational core is written in Rust and exposed to Python via PyO3, combining the ergonomic interface of Python with the performance of compiled, memory-safe code. The package implements Metropolis and Gibbs single-spin-flip algorithms, Swendsen--Wang and Wolff cluster updates, and parallel tempering. Replica-level parallelism is achieved through the Rayon work-stealing scheduler. We validate the implementation against the exact critical temperature of the two-dimensional Ising model via finite-size scaling of the Binder cumulant.
