paper

peapods: A Rust-Accelerated Monte Carlo Package for Ising and XY Spin Systems

arXiv:2602.19045

Abstract

We present peapods, an open-source Python package for Monte Carlo simulation of classical spin models with arbitrary couplings, whose sampling loop runs in Rust. It samples Ising models on periodic Bravais lattices given by user-specified neighbor offsets, optionally with open or antiperiodic boundaries, and XY models with signed couplings and site dilution on hypercubic lattices. Besides Metropolis and heat-bath sweeps, Swendsen-Wang and Wolff cluster updates and parallel tempering, it provides a family of replica cluster moves for spin glasses: the Houdayer, Jörg and Chayes-Machta-Redner moves, multi-pair variants of the first two, replica-permutation moves and a gauged form of them, and Swendsen-Wang replica Monte Carlo across temperatures. The same-temperature moves share one construction, a symmetry of the replicas' joint energy applied on clusters, and one-step stationarity tests from exact Boltzmann samples on small lattices check each family of moves that satisfies detailed balance. The package measures overlap distributions, spin-glass correlation lengths, autocorrelation times, equilibration and tempering-flow diagnostics, and jackknife errors over disorder samples. It reproduces the exact critical temperatures of the square and triangular Ising lattices, and its Binder curves for simple-cubic, BCC and FCC lattices agree at the literature critical temperatures. For the three-dimensional spin glass, the crossings of for extrapolate, with the Janus correction exponent held fixed, to , consistent with the Janus value . For the two-dimensional XY model, the helicity modulus, correlation length and structure factor agree with high-precision reference data within standard errors. This article describes version 0.3.0.

arXiv comment18 pages, 2 figures, 4 tables. v4 describes peapods 0.3.0: adds the XY model, new replica cluster moves, boundary conditions, diagnostics and validation against the 3D +-J spin glass and the 2D XY model; lists bugs in earlier versions that biased results; corrects the equilibration diagnostic of v3. Code: https://github.com/PeaBrane/peapods (tag v0.3.0)