Spin Hamiltonian, ground state, magnons.
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.
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 meVReading 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.5Extensive 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.
- Full installation guide is in docs.
To install Magnopy run (you may need to use pip3):
pip install magnopyTo install with visualization capabilities (recommended) run (you may need to use
pip3):
pip install "magnopy[visual]"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.
We welcome contributions to Magnopy. Visit the development guide or contact authors of the project to find out more.