Magnopy
Spin Hamiltonian, ground state, magnons.
What is Magnopy?
Magnopy is a Python code that, given a spin Hamiltonian in any convention, computes bosonic (magnon) Hamiltonian.
- Any convention - You declare how your parameters are defined once; Magnopy converts when necessary.
- Read your files - interfaced with TB2J and GROGU.
- Interactions up to four spins - Bilinear exchange, single-ion anisotropy, three- and four-spin terms, Zeeman, dipole-dipole. All with full interaction tensors.
- Ground state and magnons - Minimization of classical energy and Linear Spin Wave Theory.
- Two interfaces - A Python API for scripting. Command-line tools that take you from a file to a plot without writing code.
Quick example
import magnopy
# Load exchange parameters (TB2J, GROGU, or build your own)
spinham = magnopy.examples.cubic_ferro_nn(J_iso=1.0, S=2.5)
# Find the classical ground state
energy = magnopy.Energy(spinham)
spin_directions = energy.optimize()
# Magnon dispersion from Linear Spin Wave Theory
lswt = magnopy.LSWT(spinham, spin_directions=spin_directions)
for label, k in [("Γ", [0, 0, 0]), ("X", [0.5, 0, 0]), ("R", [0.5, 0.5, 0.5])]:
print(f"omega({label}) = {lswt.omega(k)[0].real:.4f} meV")
omega(Γ) = 0.0000 meV
omega(X) = 0.6121 meV
omega(R) = 1.8363 meV
Reading from a file instead:
spinham = magnopy.io.load_tb2j("exchange.out", spin_values=[2.5, 2.5])
Or from the command line, no Python scripting required:
magnopy-lswt -ss TB2J -sf exchange.out -sv 2.5 2.5
Documentation
Extensive documentation is available at magnopy.org.
Magnopy can be used both as a Python library and as a command line tool.
- For details about black box style usage see magnopy-optimize-sd or magnopy-lswt.
- For code examples see User guide.
- For full public API see API.
- To get some support and ask questions see User support.
- For summary of releases see Release notes.
Installation
- Full installation guide is in docs.
To install Magnopy run (you may need to use pip3):
pip install magnopy
To install with visualization capabilities (recommended) run (you may need to use
pip3):
pip install "magnopy[visual]"
User support
If you have a question about Magnopy, have an idea for its improvement, or found a bug, do not hesitate to contact us via one of the support channels.
Development
We welcome contributions to Magnopy. Visit the development guide or contact authors of the project to find out more.
License
The source code of Magnopy is licensed under the GNU General Public License (GPL-3.0). See the "LICENSE" file in the Magnopy's repository.
In addition, if you use magnopy in the scientific publication, cite the preprint
available at arxiv.org/abs/2611.06833 <https://arxiv.org/abs/2611.06833>_.
Rybakov, A. and Marino, M. and Blanter, Y. M. and Coronado, E. and Ferrer, J, 2026.
Quantum Spin Wave Theory with Multi-Spin Interactions for Magnetic Materials Modeling.
Preprint available at https://arxiv.org/abs/2611.06833
@misc{magnopy-preprint,
doi = {10.48550/ARXIV.2611.06833},
url = {https://arxiv.org/abs/2611.06833},
author = {Rybakov, Andrey and Marino, Marco and Blanter, Yaroslav M. and Coronado, Eugenio and Ferrer, Jaime},
keywords = {Other Condensed Matter (cond-mat.other), Computational Physics (physics.comp-ph), FOS: Physical sciences},
title = {Quantum Spin Wave Theory with Multi-Spin Interactions for Magnetic Materials Modeling},
publisher = {arXiv},
year = {2026},
}
For the detailed guide on how to cite the papers on which Magnopy depends see Citation guide.
Metadata
Release files for magnopy 0.6.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| magnopy-0.6.2.tar.gz | 125.7 kB | With provenance | Details for magnopy-0.6.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| magnopy-0.6.2-py3-none-any.whl | Python 3 | none | any | Details for magnopy-0.6.2-py3-none-any.whl |
Total release size: 322.4 kB
Release files / magnopy-0.6.2.tar.gz
| Download URL | magnopy-0.6.2.tar.gz |
|---|---|
| Size | 125.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac994851a7afba74853155b1b4435ed68a4d266c2ae5cd92c61d9476d80031a8
|
|
BLAKE2b-256 checksum How to use checksums |
05a01b978e41f415a07d8061299217f5018810e94e04bd81fb72a12a9238693f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 9, 2026.
Transparency logRelease files / magnopy-0.6.2-py3-none-any.whl
| Download URL | magnopy-0.6.2-py3-none-any.whl |
|---|---|
| Size | 196.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16761fc68ba4e814aeb6be991558c28dc6240bb324925f6abd70757075bb0fcf
|
|
BLAKE2b-256 checksum How to use checksums |
e0deab865de779acd9ab884f9820495ee79bb2994cbaa0142eb988d7e52fd4a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 9, 2026.
Transparency logSecurity for magnopy 0.6.2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for magnopy-0.6.2.tar.gz
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 Nov 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.