Skip to content

Repository files navigation

Magnopy

Spin Hamiltonian, ground state, magnons.

License: GPL v3 PyPI version Python

Documentation Status tests (main) tests (dev)

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.

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.

Releases

Packages

Used by

Contributors

Languages