Skip to main content

ferrotherm

Thermodynamic computing from Python: state a problem, get named values back.

The physics is open and old — Ising (1925), Glauber dynamics (1963), Gibbs sampling (Geman & Geman 1984) — and a "thermodynamic sampling unit" accelerates exactly these loops. This package binds the ferrotherm Rust library through its C ABI: the solver is zero-dependency Rust, deterministic by seed, verified against exact physics.

pip install ferrotherm

State a problem in the vocabulary of the problem

Not a QUBO matrix. Variables have names and domains, constraints say what they mean, and the answer comes back keyed by the names you used.

import ferrotherm as ft

p = ft.Problem()
a = p.categorical("a", 3)
b = p.categorical("b", 3)
p.not_equal(a, b)
p.maximize(3 * a.is_(1) + 4 * b.is_(2))

ans = p.solve(tries=32)
print(ans.values)      # {'a': 1, 'b': 2}
print(ans.feasible)    # True

A constraint can be soft — a price rather than a wall — and the answer reports what it cost:

import ferrotherm as ft

p = ft.Problem()
x = p.categorical("x", 3)
y = p.categorical("y", 3)
p.not_equal(x, y, soft=2.0)     # breaking this costs 2.0 x amount squared
ans = p.solve(tries=32)
print(ans.soft_cost, ans.violated)

Or sample the physics directly

import ferrotherm as ft

s = ft.lattice2d(64, 1.0, beta=0.6)   # a magnet below critical temperature
s.sweep(2000)
print(f"|M| = {abs(s.magnetization):.4f}")        # 0.9736
print(f"Onsager = {ft.onsager(0.6):.4f}")         # 0.9736 — the closed form, matched to 4 dp

That second line is the check that matters: Onsager's 1944 closed form for the infinite 2D lattice, and a 64x64 sampler reproducing it to four decimals. The size is not decoration — 16x16 over 500 sweeps gives 0.898 against 0.974, because a small lattice sampled briefly is not the thermodynamic limit. Verify against exact physics before opinions.

ft.ring, ft.z1_grid, ft.frustrated and ft.wishart build the other standard graphs, and ft.Model takes an explicit edge list when you want to write the couplings yourself.

Every run carries its joules

The ledger is not an appendix. A sampler counts the work it did and prices it at Z1-class device figures, so the energy question is answerable rather than rhetorical. Note what is being priced: the modelled device, not the CPU this ran on.

import ferrotherm as ft

s = ft.lattice2d(64, 1.0, beta=0.6)
s.sweep(2000)
print(f"{s.node_updates} node updates -> {s.joules:.2e} J")

The library it binds

This package carries no solver of its own — it loads the shared library and calls it. In order:

  1. FERROTHERM_LIB, if you set it. An explicit path always wins.
  2. The copy shipped in the wheel.
  3. target/release/ of a checkout, for developing against a local build.

ft.library_path() tells you which one answered.

Apache-2.0. Source, the Rust crate and eight other bindings: https://github.com/dcharlot-physicalai-bmi/ferrotherm. From the Institute for Physical AI @ BMI.

Metadata

Release files for ferrotherm 0.34.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for ferrotherm 0.34.0
File Interpreter ABI Platform
ferrotherm-0.34.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
ferrotherm-0.34.0-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details
ferrotherm-0.34.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details

Total release size: 1.7 MB

Release files / ferrotherm-0.34.0-py3-none-win_amd64.whl

Download URL ferrotherm-0.34.0-py3-none-win_amd64.whl
Size 475.6 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
896008aaa9ebb6c4a0214bf5a8986e66f9ff4e056d4cecb5a0ea14d0761dfb93
BLAKE2b-256 checksum
How to use checksums
b0fa0af0a767e0296f777aba4f901fbccaf7fc795f5ff41f9fb1d0e838ddffc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release files / ferrotherm-0.34.0-py3-none-manylinux_2_28_x86_64.whl

Download URL ferrotherm-0.34.0-py3-none-manylinux_2_28_x86_64.whl
Size 631.3 kB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
4109ba8ad70cb03d3a807d1fbac9bd888506a6ede3c7471d081a098d00b366fa
BLAKE2b-256 checksum
How to use checksums
d46e9b7279badf9f9ba8fde83ed0ea49f507e58443c8a4c5cfd0fadae34604f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release files / ferrotherm-0.34.0-py3-none-macosx_11_0_arm64.whl

Download URL ferrotherm-0.34.0-py3-none-macosx_11_0_arm64.whl
Size 544.0 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
618583b75aa0bce85cbe342fe6e83f99dc6944db83d3e801085cde5cc976070e
BLAKE2b-256 checksum
How to use checksums
153701a3d8ab2e74061e79e7860a9aa8e5119005fff93b29b6110376a198d3c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page