This folder contains all the spectral functions and general functions that are related to SpinW.


Transforming and plotting calculated spin wave spectrum

These functions operate on the calculated spectra, which is the output of spinw.spinwave or spinw.powspec commands. They enable to post process the calculated spin-spin correlation function, including instrumental resolution, cross section calculation, binning etc.

  • sw_econtract converts (Q,E) values to Q values for diffraction instrument
  • sw_egrid calculates energy bins of a spectrum
  • sw_filelist lists spinw objects in the Matlab workspace or in a .mat file
  • sw_instrument convolutes spectrum with resolution function
  • sw_magdomain calculates the spin-spin correlation function for magnetic domains
  • sw_neutron calculates neutron scattering cross section
  • sw_omegasum removes degenerate and ghost magnon modes from spectrum
  • sw_plotspec plots spectrum
  • sw_xray calculates x-ray scattering cross section

Generate list of vectors in reciprocal space

These two functions can generate a set of 3D points in reciprocal space defining either a path made out of straigh lines or a volume.

  • sw_qgrid creates a Q grid
  • sw_qscan creates continuous line between coordinates

Resolution claculation and convolution

These functions can import Energy resolution function and convolute it with arbitrary multidimensional dataset

  • sw_res fits energy resolution with polynomial
  • sw_resconv convolution of a matrix and a Gaussian
  • sw_tofres convolutes the spectrum with a Q bin

Constraint functions

Contraint functions for spinw.optmagstr.

  • gm_planar planar magnetic structure constraint function
  • gm_planard planar magnetic structure constraint function
  • gm_spherical3d magnetic structure constraint function with spherical parameterisation
  • gm_spherical3dd magnetic structure constraint function with spherical parameterisation

Geometrical calculations

Basic geometrical calculators, functions to generatate rotation operators, generate Cartesian coordinate system from a set of vectors, calculate normal vector to a set of vector, etc.

  • sw_basismat determines allowed tensor components in a given point group symmetry
  • sw_cartesian creates a right handed Cartesian coordinate system
  • sw_fsub simple graph vertex coloring
  • sw_mattype classifies square matrices
  • sw_nvect determines the best normal vector for the set of vectors sw_quadell
  • sw_mirror mirrors a 3D vector
  • sw_rot rotates vectors in 3D
  • sw_rotmat generates 3D rotation matrix
  • sw_rotmatd generates 3D rotation matrix

Text and graphical input/output for different high level commands

Acessing the SpinW database

Functions to read the different data files that store information on atomic properties, such as magnetic form factor, charge, etc.

  • sw_atomdata returns information on chemical elements
  • sw_cff returns the atomic charge form factor values for X-ray scattering
  • sw_mff returns the magnetic form factor values and coefficients
  • sw_nb returns the bound coherent neutron scattering length

Useful physics functions

The two functions can calculate the Bose factor and convert energy/momentum units, both usefull for neutron and x-ray scattering.

  • sw_bose coefficient for boson correlation functions
  • sw_converter converts energy and momentum units for a given particle

Import functions

Functions to import tables in text format.

  • sw_import create SpinW object from .cif and FullProf Studio .fst files
  • sw_readspec read spin wave dispersion data from file
  • sw_readtable reads tabular data from text