spinoct
Optimal control paths and energy-efficient switching pulses for classical spin dynamics (Landau-Lifshitz-Gilbert).
spinoct computes the control (an applied magnetic field, an electric current, or both) that
drives a magnetic moment from one state to another in a given time for the least dissipated energy.
It is the reusable engine behind Espira, and
it is deliberately independent of any material database, so it works on any spin Hamiltonian.
Why this exists
The optimal control of magnetization switching has a small, rigorous literature (Kwiatkowski,
Badarneh, Berkov and Bessarab, Phys. Rev. Lett. 126, 177206 (2021), and the papers that follow it),
but no open implementation. The analytic solutions live only as equations in journal articles, and
the group's own code is not public. spinoct is that implementation, with the closed-form results
built in as positive controls that every numerical solver is validated against before it is trusted.
Install
pip install spinoct # core: numpy + scipy
pip install "spinoct[torch]" # add the batched GPU solvers
The dimensional contract
Read spinoct.units first. The same physical quantity is written four different ways across this
literature, and the central quantity of the package, the switching cost Phi = int |b|^2 dt, is in
tesla-squared-seconds, not joules. It becomes an energy only through an explicit circuit model. The
package refuses to hide that assumption: spinoct.units.CircuitModel is a required, described
object, never a buried constant.
Status
Pre-1.0, under active development. The analytic uniaxial optimal control path, its closed-form pulse and cost, and the negative-parameter Jacobi elliptic machinery it needs are complete and validated. The numerical image-based solver, the GRAPE and CRAB constrained solvers, and the batched GPU lane are in progress.
License
MIT. See LICENSE.
Release files for spinoct 0.12.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spinoct-0.12.0.tar.gz | 84.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spinoct-0.12.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 162.5 kB
Release files / spinoct-0.12.0.tar.gz
| Download URL | spinoct-0.12.0.tar.gz |
|---|---|
| Size | 84.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2ff571ad2a5398595819e7b81ff9ab1b4d8e3a0269a7aa0a8f5e2a07cc8f9c0
|
|
BLAKE2b-256 checksum How to use checksums |
44d8e99067a2b5d00f212e6448ab90ed98d6ea7710c5559fb0d49859581927fc
|
| 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 Sep 17, 2026.
Transparency logRelease files / spinoct-0.12.0-py3-none-any.whl
| Download URL | spinoct-0.12.0-py3-none-any.whl |
|---|---|
| Size | 78.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f91cfa48e1f2b27f397df523cff0b4432c034ec2b6bb776cf9d261fdf39155f1
|
|
BLAKE2b-256 checksum How to use checksums |
ddf4ea52f2ff9d8aeba57a7af741909994550bd2b091944f895bc6f14a89a4ca
|
| 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 Sep 17, 2026.
Transparency log