# SpinW

SpinW is a Matlab library that can plot and numerically simulate magnetic structures and excitations of given spin Hamiltonian using classical Monte Carlo simulation and linear spin wave theory.

This wiki is moving to a new address: www.psi.ch/spinw. The latest code and tutorials are available there. The documentation will be moved soon.

## Content of this wiki

Tutorials contain several example codes with explanation.

Documentation gives detailed explanation for functions and data structures.

Index lists all pages in this wiki in alphabetical order.

Publications lists publications using SpinW (slides of the talk at Neutrons 2.0 meeting can be found here spinw-toth.pdf).

## Forum

For questions and discussion see the SpinW Forum.

## What SpinW can do

In short spinW can solve the following spin Hamiltonian using classical and quasi classical methods:

$\mathcal{H}=\sum_{i,j}\mathbf{S}_iJ_{ij}\mathbf{S}_j + \sum_i \mathbf{S}_iA_i\mathbf{S}_i + \mathbf{B}\sum_i\mathbf{g}_i\mathbf{S}_i$,

where Si are spin vector operators, Jij are 3x3 matrices describing pair coupling between spins, Aij are 3x3 anisotropy matrices, B is external magnetic field and gi is the g-tensor.

Calculated spin wave spectra of the triangular lattice antiferromagnet, top: dispersion, middle: intensity, bottom: the intensity convoluted to the dispersion plus the 1 − Q2 factor introduced for neutron scattering.)

Crystal structures

• definition of crystals with arbitrary unit cell, using space group or symmetry operators
• definition of non-magnetic atoms and magnetic atoms with arbitrary moment size
• publication quality plotting of crystal structures (atoms, labels, axes, surrounding polyhedron, anisotropy ellipsoids, DM vector, etc.)

Magnetic structures

• definition of 1D, 2D and 3D magnetic structures
• representation of incommensurate structures using rotating coordinate system or complex basis vectors
• generation of magnetic structures on a magnetic supercell
• plotting of magnetic structures

Magnetic interactions

• simple assignment of magnetic interactions to neighbouring magnetic atoms based on distance
• possible interactions: Heisenberg, Dzyaloshinskii-Moriya, anisotropic and general 3x3 exchange tensor
• arbitrary single ion anisotropy tensor (easy-plane, easy-axis, etc)
• Zeeman energy in homogeneous magnetic field including g-tensor
• calculation of symmetry allowed elements of the above tensors based on the crystallographic space group
Simulated magnetisation of antiferromagnetic Heisenberg spin chain in magnetic field parallel to the easy axis anisotropy simulated by SpinW. Note the hysteresis at low temperature and the spin-flop transition at Hc1 and Hc2.

Simulation of magnetic structures

• classical energy minimization assuming single-k magnetic structure for fast and simple solution for ground state magnetic structure
• simulated annealing using the Metropolis algorithm on an arbitrary number of magnetic unit cells
• parallel tempering to calculate temperature dependent properties
• calculating equilibrium properties (heat capacity, magnetic susceptibility, etc.)
• magnetic structure factor calculation using FFT
• simulation of magnetic neutron diffraction and diffuse scattering

Simulation of magnetic excitations in general commensurate and incommensurate magnetic structures

• using linear spin-wave theory
• calculation of dispersion, correlation functions
• calculation of neutron scattering cross section for unpolarized neutrons including the magnetic form factor (when using FullProf notation e.g. 'MCr3' in the name of the magnetic ion)
• calculation of polarized neutron scattering
• arbitrary exchange interaction tensors
• including single ion anisotropy and magnetic field
• allows different moment sizes for different sites
• easy calculation of powder spectra
• the algorithm: spinwave_algorithm.pdf (Many thanks to Johannes Reim for the LaTeXing)
Simulated magnetic phase diagram of anisotropic XY triangular lattice in magnetic field using SpinW at zero temperture.

Plotting spin wave spectra

• plotting dispersions and correlation functions
• calculation and plotting of the convoluted spectra for direct comparison with inelastic neutron scattering
• full integration into Horace for plotting and fitting, see http://horace.isis.rl.ac.uk
• creation of iData objects from calculated spectra for plotting, data manipulation and fitting, see http://ifit.mccode.org

Fitting spin wave spectra

• using arbitrary parameter function
• robust fitting, even when the number of simulated spin wave modes differs from the measured number of modes

Feel free to ask questions & requests!

Dr. Sándor Tóth