pySpinW is capable of calculating magnon dispersion curves, optimising magnetic structures, visualising systems, and predicting the results of inelastic scattering experiments. In general, we solve a system with a Hamiltonian of the form:
$\mathcal{H}=\sum_{i,j} \mathbf{S}i J{ij}\mathbf{S}j + \sum{i} \mathbf{S}i A_i \mathbf{S}_i + \mathbf{B} \sum{i} \mathbf{g}_i\mathbf{S}_i $
where $S_i$ are spin vector operators, $J_{ij}$ are 3x3 matrices describing pair coupling between spins, $A_{ij}$ are 3x3 anisotropy matrices, $B$ is external magnetic field and $g_i$ is the g-tensor.
The core calculations in pySpinW are a rust port of the core calculations in SpinW, calculations are set up using a python interface. Unlike SpinW, pySpinW uses a constructive method for specifying simulations, a simple example is this for a Heisenberg ferromagnetic chain:
from pyspinw import *
# Define the unit cell
unit_cell = UnitCell(1,1,1)
# Specify a magnetic atom at (0,0,0), with moment (0,0,1)
x = LatticeSite(0, 0, 0, 0, 0, 1, name="X")
# Create a magnetic structure (this could include a spacegroup, or
# supercell structure, but we don't do so here)
structure = Structure([x], unit_cell=unit_cell)
# A single exchange between atoms in neighbouring unit cells (in the x direction)
exchanges = [HeisenbergExchange(x, x, cell_offset=(1,0,0), j=-1)]
# Create a Hamiltonian object that holds things together
hamiltonian = Hamiltonian(structure, exchanges)
The following is a list of the classes and functions that users will likely want to use. There are three broad categories (1) classes that users might create directly (2) helper functions (3) classes that users will use, but not create directly.
Classes and functions designed to called directly by the user are made accessible by doing from pyspinw import *
User Facing Classes
The user facing classes are for defining the system, there are also a number of helper functions that make it easier to create large numbers of them.
LatticeSite- Lattice position and spin of unit cellsUnitCell- The unit cellStructureContains the magnetic structure details: a list of sites, the unit cell, spacegroup and supercell- Exchange interactions, one of
HeisenbergExchangescalar exchange termDMExchangeDzyaloshinskii–Moriya exchangeExchangeis the most general exchange term, specify a matrixDiagonalExchangediagonal matrix with independent entriesXYExchangematrix with same value entries, and on in x and y diagonalsXXZExchangediagonal, same value in x and y, different in zIsingExchangeonly a z term
- Anisotropy, either
AxisMagnitudeAnisotropyspecified by an axis and signed magnitudeAnisotropygeneral matrix form
Hamiltonianthis holds all the data for doing energy calculations, it is the main object that functions are called on, these includeenergy_plot,spagetti_plotandspaghetti_plot_dualfor plottingenergies_and_intensitiesfor getting the data from calculationstext_summaryandprint_summaryfor getting information in text formexpandedConverts a supercell structure into single large cellground_statereturns a new Hamiltonian with an minimal energy ground stateparameterizedconstructs a function (callable) of specifed coupling/anisotropy parameters
- Sample definitions, these are used to define the macroscoptic structure
Twinis used to represent twinned systemsPowderis used to represent powder samples, and provides some methods for fitting
- Supercell definitions:
PropagationVectorandCommensuratePropagationVectorare used to define propagation vectors- There are various
Supercellsubclasses:TiledSupercellSummationSupercellTransformationSupercellRotationSupercell
SupercellTransformis for use with theTransformationSupercell
Helper Functions
spacegroup- takes a string describing a spacegroup and returns aSpacegroupobject. This function is capable of dealing with many different ways of writing the spacegroup, including though an partial operator list.generate_*functionsgenerate_sitesautomatically creates a list of sitesgenerate_exchangesautomatically creates a list of exchanges
viewGraphically show a Hamiltonian
Indirectly Created Classes
Spacegroup- these contain detailsHamiltonianParameterizationPowderParameterization