Skip to content

mcising

mcising

High-performance Ising model Monte Carlo simulation with a Rust core.

PyPI Downloads License


Install

uv add mcising
pip install mcising

Quick example

from mcising import Simulation, SimulationConfig, LatticeConfig

# Configure: 32x32 square lattice, three temperatures across Tc
config = SimulationConfig(
    lattice=LatticeConfig(size=32, j1=1.0),
    temperatures=(3.0, 2.269, 1.5),
    n_sweeps=1000,
    seed=42,
)

# Run
results = Simulation(config).run()

# Inspect
for T in results.temperatures:
    E = results.energy[T].mean()
    M = abs(results.magnetization[T]).mean()
    print(f"T={T:.3f}: <E>={E:.4f}, <|M|>={M:.4f}")

This runs a Monte Carlo simulation of the 2D Ising model on a 32x32 square lattice, scanning through three temperatures including the critical point Tc = 2.269.


What mcising gives you

  • 5 Lattice Geometries


    Square, triangular, honeycomb, cubic (3D), and chain (1D). All with periodic boundary conditions.

    Lattice types

  • 268M spin updates/sec


    Rust core via PyO3. 3.4x faster than peapods. 430x faster than pure Python.

    Performance

  • J1-J2-J3 Frustrated Magnetism


    Nearest, next-nearest, and third-nearest-neighbor couplings plus external field. 15 auto-optimized Metropolis strategies.

    Frustrated magnetism

  • 3 Execution Modes


    Sequential cool-down, independent parallel (Rayon), or parallel tempering with replica exchange.

    Parallel execution

  • 3 MC Algorithms


    Metropolis single-spin-flip, Wolff cluster, and Swendsen-Wang cluster. Choose the right tool for your physics.

    Algorithms

  • Adaptive Thermalization


    MSER equilibration detection + Sokal autocorrelation estimation. No more guessing warmup sweeps.

    Adaptive mode

Or use the CLI

mcising run -L 32 -T 3.0 -T 2.269 -T 1.5 -o results.h5
mcising summary results.h5
mcising plot energy results.h5 -o energy.png
mcising plot specific-heat results.h5 -o cv.png
mcising export results.h5 lattices.zip

Full CLI reference: CLI Guide

Next steps

New to mcising? Start with the Tutorial — it walks you through a complete simulation in 5 minutes.

Looking for a specific function or class? Check the API Reference.

Need CLI commands? See the CLI Reference.