Micromagnetics in JAX
Simulate magnetic textures — and differentiate through them.
Finite-difference and finite-element solvers behind one interface, FFT and fast-multipole stray fields, float64 on GPU, and automatic differentiation straight through the Landau–Lifshitz–Gilbert equation. Written in Python, fast enough for 216 million cells.
Two backends, one API
The mesh decides the method: create it with jm.fd.make_mesh or
jm.fe.make_mesh / jm.fe.from_gmsh, and the same
jm.make_demag, jm.make_exchange, … run FFT demag on the
grid and fast multipole on the tetrahedral mesh. Only the mesh line differs.
Differentiable physics
Field terms and whole trajectories are differentiable, so inverse design and parameter fitting become gradient descent instead of guesswork.
Geometry that follows a surface
Per-element surface normals drive anisotropy and interfacial DMI, so a measured AFM topography becomes a magnetic film with curvature effects included.
Scales past one card
Domain-decomposed FFT demag across GPUs, agreeing with the single-GPU result to under 1 A/m; 600³ cells on eight GPUs.
02 · Run online
Describe a simulation, get a report
Write what you want to simulate, in English or German. An assistant turns it into a jaxmag run: one of the templates below, or a script written for your case (other geometries and materials, several phases, custom observables such as the skyrmion number, extra plots). It rents a GPU, runs the job and returns a PDF report; afterwards it can analyse the stored results on request. Every run keeps its own folder with the exact script, inputs, outputs, report and log (Files panel, one zip).
Permalloy switching
500 × 125 × 3 nm, field 1 — the reference benchmark every code is measured against.
Skyrmion relaxation
Cortés-Ortuño standard problem: settles at R ≈ 22 nm with Q = −1.
Your own box
Pick the size, material and field, and see where the magnetisation settles.
Your jobs
Only this browser sees your chat, jobs and reports.
03 · Meshing service
Turn your geometry into a mesh
Upload a measured topography or an existing mesh and get back a tetrahedral mesh
for jaxmag.fe, built with gmsh — with a preview, the element count and the
curvature-induced DMI to expect from it.
Then use it locally
# the download contains topo_verts.npy, topo_tets.npy and mesh.msh import numpy as np from jaxmag.fe import FEMesh, fix_orientations v = np.load('topo_verts.npy'); t = np.load('topo_tets.npy').astype('int32') mesh = FEMesh(v, fix_orientations(v, t), mu0_Ms=4e-7*np.pi*860e3, scale_len=1e-9)
04 · Viewer
Watch the magnetisation move
Every simulation keeps 24 snapshots of the full magnetisation. Play them back, scrub through time, switch between the components and read the topological charge as it changes.
05 · Files
Everything you have made here
Reports from your simulations, meshes from your uploads, and the jaxmag source bundle — in one place, scoped to this browser.
06 · Install & use
Get jaxmag running
Install from GitLab, or download the self-contained bundle with vendored dependencies, every example and the documentation.
# from GitLab (pulls jax-ode and jaxfmm automatically) pip install git+https://gitlab.com/dietersuess1/jaxmag.git # or from the downloaded bundle, offline pip install "jax[cuda12]" # or plain "jax" for CPU pip install ./vendor/jax-ode ./vendor/jaxfmm . python examples/sp4_fd.py # muMAG standard problem 4
What the bundle documents
| file | what it covers |
|---|---|
| README.md | package structure and the unified FD/FE API, choosing an integrator |
| INSTALL.md | setup online and offline, GPU requirements, how to verify it works |
| METHODS.md | the physics and the numerics: field terms, demag splitting, BDF + GMRES, curved films |
| EXAMPLES.md | every example script, plus the skyrmion quickstart |
| TESTING.md | the test suite and what each test proves |
A skyrmion in ten lines
import jaxmag as jm # the only backend-specific line (jm.fe.make_mesh / jm.fe.from_gmsh for tets + FMM): mesh = jm.fd.make_mesh(lx=100e-9, ly=100e-9, lz=2e-9, dx=2e-9) fields = [jm.make_exchange(mesh, A=13e-12, Ms=860e3), jm.make_dmi(mesh, D=3e-3, Ms=860e3), jm.make_demag(mesh, Ms=860e3)] m_sky = jm.relax(jm.init_m(mesh, (0, 0, 1)), fields) # Néel skyrmion
07 · Benchmarks
Measured, on real hardware
Pure integration time, measured on the MUSICA cluster (ASC Vienna) on 16–17 October 2026
with the scripts in jaxmag_paper/; setup (demag kernel or FMM tree, JIT compilation) is
measured separately and not included, for jaxmag and mumax3 alike (mumax3: marker-file timestamps around
run(), its own relaxation excluded). The 600³ cube uses the distributed FFT with the native
NCCL all-to-all; the step counts of jaxmag and mumax3 agree within 3 % (stability-limited at 1 nm), so the
gain is the single stray-field evaluation per step instead of six.
| problem | backend | hardware | time |
|---|---|---|---|
| SP4, 1 nm cells (187 500), 1 ns, Dopri5 + demag extrapolation | FD | H100 / B200 | 13.1 s / 11.0 s |
| mumax3 3.12, same grid, same GPUs | FD | H100 / B200 | 36.4 s / 28.1 s |
| SP4, 1 nm, 1 ns, Dopri5 without extrapolation | FD | H100 / B200 | 47.1 s / 33.6 s |
| SP4, 1 nm, 1 ns, BDF + gmres_approx (2.0 Newton, 92 GMRES per step) | FD | H100 / B200 | 103 s / 95 s |
| SP4, 1 nm (252 504 nodes), 1 ns, BDF + gmres_approx | FE | H100 | 147.6 s |
| SP4, 1 nm, 1 ns, Dopri5 + demag extrapolation | FE | H100 | 224.0 s |
| 600³ = 216 M cells, 1 ns, Dopri5 + demag extrapolation | FD | 8× B200 / 4× B200 | 12.2 s / 22.3 s |
| mumax3 3.12, same cube | FD | 1× B200 | 329 s |
Cross-code comparison on rented GPUs (vast.ai, 12–13 October 2026)
One right-hand-side evaluation = exchange + full stray field (FFT, no extrapolation) on a 100 × 100 × 100 cube of 2 nm cells (1 M cells); minimum over repeated calls, ms. magnum.np 2.2.0 and neuralmag 1.0.0 measured with M. Steinbauer's timing suite, jaxmag with the same measurement, using the FFT demag path pushed on Oct 13 (pad- and crop-as-you-go, real kernels, no z transform for single-layer meshes). mumax3 3.12 (float32 only) is timed separately, see the note. All seven cards are complete (H100: 203 of 216 suite processes, every mesh covered).
| GPU | magnum.np f32 / f64 | neuralmag f32 / f64 | jaxmag f32 / f64 | mumax3 f32, per torque eval |
|---|---|---|---|---|
| B200 | 1.88 / 2.39 | 0.99 / 1.64 | 0.64 / 1.10 | 0.69 |
| H200 NVL | 2.11 / 3.44 | 1.19 / 2.42 | 0.93 / 1.67 | 0.92 |
| H100 SXM | 2.26 / 3.75 | 1.52 / 2.83 | 0.93 / 1.81 | 0.93 |
| A100 SXM4 80 GB | 3.70 / 6.50 | 2.34 / 4.48 | 1.64 / 3.14 | 1.48 |
| RTX PRO 6000 | 1.92 / 9.01 | 1.58 / 7.81 | 1.32 / 5.34 | 0.80 |
| L40S | 3.30 / 14.93 | 2.87 / 11.85 | 2.27 / 8.52 | 1.25 |
| RTX 5090 | 2.46 / 8.41 | 1.63 / 6.96 | 1.16 / 4.81 | 0.77 |
B200, all five large meshes, float32, ms per evaluation:
| mesh | cells | magnum.np | neuralmag | jaxmag | mumax3 |
|---|---|---|---|---|---|
| cube 46³ | 97 k | 1.61 | 0.19 | 0.13 | 0.18 |
| cube 100³ | 1.0 M | 1.88 | 0.99 | 0.64 | 0.69 |
| cube 144³ | 3.0 M | 3.97 | 2.69 | 1.71 | 1.84 |
| film 707 × 707 × 2 | 1.0 M | 3.36 | 2.51 | 0.74 | 1.22 |
| monolayer 1000 × 1000 × 1 | 1.0 M | 1.67 | 0.57 | 0.37 | 0.34 |
A100 SXM4 80 GB, all five large meshes, float32, ms per evaluation (mumax3: per torque evaluation):
| mesh | mumax3 | magnum.np | neuralmag | jaxmag |
|---|---|---|---|---|
| cube 46³ | 0.35 | 2.42 | 0.31 | 0.21 |
| cube 100³ | 1.48 | 3.70 | 2.34 | 1.64 |
| cube 144³ | 4.15 | 11.91 | 6.51 | 4.51 |
| film 707 × 707 × 2 | 2.57 | 7.45 | 5.67 | 2.02 |
| monolayer 1000 × 1000 × 1 | 0.74 | 2.59 | 1.29 | 1.17 |
All meshes, per-step times, memory and dollars per evaluation: slide deck of the campaign.
08 · About
Who runs this, and who pays
jaxmag is developed in the Physics of Functional Materials group at the University of Vienna by Dieter Suess and contributors, and released as open source.
Rented per job
Simulations run on a GPU rented on demand from vast.ai and destroyed when the job ends. A typical job costs a few cents.
Claude API
The chat that turns your description into a simulation runs on the Anthropic Claude API, billed per token.
Paid personally
Both the GPU time and the API tokens are funded by Dieter Suess so this stays free and open for everyone. Please use it fairly.
Your session is yours
A random id in your browser scopes your chat, jobs, meshes and reports. Nobody else can list or download them; clearing browser data starts a fresh, empty session.