The SpinW object

Fields of the SpinW object
spinw properties >>properties(spinw)
lattice unit_cell matrix sinlge_ion coupling mag_str unit
angle r mat aniso dl F kB
lat_const S label g atom1 k muB
sym label field atom2 nExt mu0
ff T mat_idx label
idx

Example:

                
obj.lattice.lat_const = [3 3 4];
                
                
Functions:
                
obj.genlattice('lat_const',[3 3 4], 'sym', 1,'angled',[90 90 120]);
                
                

lattice properties

How to describe a lattice.
Coordinate systems
Most of the data stored in the fields of SpinW has a coordinate system. There are 3 coordinate systems.

Lattice unit (lu):

  • defined by the unit cell: (a, b, c, $\alpha$, $\beta$, $\gamma$)
  • atomic position


Reciprocal lattice unit (rlu):

  • momentum transfer
  • magnetic propagation vector(s)


xyz Descartes coordinate system:

  • momentum transfer in $\unicode{x212B}^{-1}$ unit
  • magnetic field
  • magnetic moments
  • J, A, g matrices
  • components of the spin-spin correlation function

Unit cell

The crystal lattice information is stored in spinw.lattice , to define the parameters use:

  • spinw.genlattice() with options: lat_const, angle, angled, sym
  • sym option accept name of space group or symmetry operators in matrix

The symmetry inequivalent atoms are stored in spinw.unit_cell with following parameters:

  • position in lattice units in r
  • spin quantum number in S
  • string label with magnetic form factor definition (FullProf convention, e.g. MCr3 for Cr$^{3+}$ ions)
  • color for plotting (RGB code for each atom)


To define the atoms use:

  • spinw.addatom() function with options as above
  • function checks the validity of the input and has default values (e.g. S can be generated from the label)
  • defines magnetic form factor
Magnetic lattice from symmetry

Magnetic lattice is dynamically generated from:

  • unit cell parameters (a, b, c, angles) stored in spinw.lattice
  • magnetic atoms (S>0) stored in spinw.unit_cell
  • space group stored in spinw.lattice.sym

The function M = spinw.matom() generates the positions:

  • we call the number of magnetic atoms in the unit cell: nMagAtom
  • position in l.u. in M.r
  • index pointing to the atom in spinw.unit_cell stored in M.idx
  • spin quantum number stored in M.S

The space group generators are stored in the symmetry.dat file, and spinw.lattice.sym stores all symmetry operators of the space group

204 I m -3 : x+1/2,y+1/2,z+1/2; -x,-y,z; -x,y,-z; z,x,y; -x,-y,-z

205 P a -3 : -x+1/2,-y,z+1/2; -x,y+1/2,-z+1/2; z,x,y; -x,-y,-z

206 I a -3 : x+1/2,y+1/2,z+1/2; -x+1/2,-y,z+1/2; -x,y+1/2,-z+1/2; z,x,y; -x,-y,-z


The first nMagAtom magnetic moment directions stored in spinw.mag_str.S are corresponding to the magnetic lattice generated by spinw.matom().

Space groups

The generators of the 230 space group with standard settings are stored in symmetry.dat.

  • to add a new setting or permute axes, use
    sym = swsym.add(symStr, {symName})
  • use the line number in spinw.lattice.sym
  • P0 $\neq$ P1


The space group is used:

  • generate the atomic positions $\rightarrow$ ALWAYS
  • determines equivalent bonds
  • allowed terms in the magnetic Hamiltonian
  • magnetic structure? Not yet

If symmetry is off for bonds, the equivalent bonds will be generated based on length.

Reduce symmetry:

  • spinw.no_sym() removes all symmetries $\rightarrow$ P0 and repopulates spinw.unit_cell with all the originally generated positions.
  • {T} = spinw.newcell(bvect, {bshift}) creates a new unit cell and reduce the symmetry to P0 and return the transformation matrix: Qrlu_new = T * Qrlu_old
All other symmetry information

This will be covered in the symmetry presentation.

Symmetry Presentation

matrix properties

How to describe a matrix.
Matrices

3x3 matrices can be stored in the spinw.matrix field:

  • values are stored in a 3x3xnMat matrix (mat subfield)
  • label and color stores corresponding label and color for plotting

These matrices are really just numbers. They will be part of the Hamiltonian once they are assigned to a single ion anisotropy, g-tensor or exchange coupling.


To add new matrix use spinw.addmatrix().

The matrix value is given in the mat option:

  • single number gives Heisenberg interaction, e.g. mat = J1
  • vector gives a Dzyaloshinskii-Moriya interaction, e.g. mat = [D1 0 D2]
  • generall accept 3x3 matrices, e.g. mat = diag([Jxy Jxy Jz])

Each matrix can be referenced by its index (e.g. mat(:,:,idx)) or by ist label (e.g. J1).

coupling properties

How to describe the coupling in a cell.
Bonds

Bonds are stored in spinw.coupling field:

  • each bond is defined by the index of 2 interacting magnetic atoms of the magnetic lattice...
  • ... and a translation vector in lattice units (dl)
  • the bond has a direction: matom.r(:,atom1) $\rightarrow$ matom.r(:,atom2) + dl
  • each bond has an increasing index (idx), starting with 1
  • equivalent bonds have the same index
  • each bond can have a pointer to 3 different matrices that define the J value (mat_idx)

The bonds are generated from the magnetic lattice and the space group (if any) using the spinw.gencoupling() method:

  • maxDistance option determines the maximum bond length that will be generated
  • can generate up $10^6$ bonds/s, can be used for very large unit cell for dipole-dipole interaction

To assign a matrix to a bond use spinw.addcoupling():

  • assigned matrix is given by a matrix label or index (option mat)
  • bond can be given by an index (option bond)
  • sub indices can be also given (option subIdx)
spinw.gencoupling()

GENerates COUPLINGs

  • all inter-ion distances are calculated within a fixed radius
  • couplings are sorted by length

spinw.gencoupling()

GENerates COUPLINGs

  • all inter-ion distances are calculated within a fixed radius
  • couplings are sorted by length

obj.coupling
dl(1,:) 1 0 1 1 2 1 ...
dl(2,:) 0 1 -1 1 1 2 ...
dl(3,:) 0 0 0 0 0 0 ...
atom1 1 1 1 1 1 1 ...
atom2 1 1 1 1 1 1 ...
mat_idx(1,:) 0 0 0 0 0 0 ...
mat_idx(2,:) 0 0 0 0 0 0 ...
mat_idx(3,:) 0 0 0 0 0 0 ...
idx 1 1 2 2 3 3 ...
spinw.gencoupling()
obj.matrix
mat(1,:,1) 1 0 0
mat(2,:,1) 0 1 0
mat(3,:,1) 0 0 1

GENerates COUPLINGs

  • all inter-ion distances are calculated within a fixed radius
  • couplings are sorted by length
  • after spinw.gencoupling():

obj.coupling
dl(1,:) 1 0 1 1 2 1 ...
dl(2,:) 0 1 -1 1 1 2 ...
dl(3,:) 0 0 0 0 0 0 ...
atom1 1 1 1 1 1 1 ...
atom2 1 1 1 1 1 1 ...
mat_idx(1,:) 0 0 0 0 0 0 ...
mat_idx(2,:) 0 0 0 0 0 0 ...
mat_idx(3,:) 0 0 0 0 0 0 ...
idx 1 1 2 2 3 3 ...
spinw.gencoupling()
obj.matrix
mat(1,:,1) 1 0 0
mat(2,:,1) 0 1 0
mat(3,:,1) 0 0 1

GENerates COUPLINGs

  • all inter-ion distances are calculated within a fixed radius
  • couplings are sorted by length
  • after spinw.gencoupling():

obj.coupling
dl(1,:) 1 0 1 1 2 1 ...
dl(2,:) 0 1 -1 1 1 2 ...
dl(3,:) 0 0 0 0 0 0 ...
atom1 1 1 1 1 1 1 ...
atom2 1 1 1 1 1 1 ...
mat_idx(1,:) 0 0 0 0 0 0 ...
mat_idx(2,:) 0 0 0 0 0 0 ...
mat_idx(3,:) 1 1 0 0 0 0 ...
idx 1 1 2 2 3 3 ...
sw.addcoupling('mat','J1','bond',idx)

single_ion properties

How to add single ion properties.
Single ion properties

Single ion

g-tensor and external field values are stored in spinw.single_ion.

Subfields:

  • aniso single ion anisotropy is stored with 1xnMagAtom and a pointer to a matrix
  • g g-tensor is nMagAtom
  • field stored as a row vector

To assign anisotropy use spinw.addaniso(matLabel,{atomIdx}) with matrix label and optional atom indices of labels.

Similar function spinw.addg().

mag_srt properties

How to add a magnetic structure.
Magnetic structure

Magnetic structure is stored in the spinw.mag_str field.

It can store arbitrary magnetic structures using Fourier components.

Subfields:

  • magnetic supercell in l.u. stored in nExt
  • k-vector(s) stored in k
  • Fourier transform of the spin expectation value in F

The number of magnetic moments stored in F are: nMagExt = prod(nExt)*nMagAtom

Mag_str

Ordering of the unit cell in the magnetic super-cell.

The experimental magnetization can be obtained by multiplying F with the g-tensor!

Magnetic structure in rotating frame

For spin wave calculation, the complex magnetic structure is converted to the rotating frame representation using the spinw.magstr() function.

Output of spinw.magstr() is a struct with fields:

  • size of magnetic supercell in l.u. stored in nExt
  • single k-vector stored in k
  • vector normal to the spiral plane is stored in n
  • real magnetic moment directions (spin quantization axis) are stored in S

The representation allows an additional k=0 component parallel to n, however this is rarely used.

The conversion from Fourier components to rotating frame representation is not always possible, in this case magstr() gives the best approximation and gives a warning. The conversion is approximate:

  • multi-k structures
  • non-Bravais lattice with counter-rotating incommensurate spirals
  • non-Bravais lattice with non-coplanar spirals
  • non-Bravais antiferromagnet with non-coplanar moments
All other information

This will be covered in the magnetic structure presentation.

Magnetic Structure Presentation

Evaluating the Hamiltonian

Details about actually solving a system.
Definition of the spin Hamiltonian

The spin Hamiltonian from LSWT:

$$H = \sum_{mi, mj} S^{T}_{mi}J_{mi, nj}S_{nj} + \sum_{mi}S^{T}_{mi}A_{i}S_{mi} + \mu_BH^{T}\sum_{mi}g_iS_{mi}$$

Identify the symbols:

  • ($m$,$n$) unit cell indices: SpinW only stores the (0,0) cell the rest is taken care by a Fourier- transformation
  • ($i$,$j$) index of the magnetic atom on the magnetic supercell
  • $S_{mi}$ are stored in spinw.mag_str.S
  • $J_{mi, nj}$ are given by:
    • spinw.coupling.atom1 $\rightarrow$ $i$
    • spinw.coupling.atom2 $\rightarrow$ $j$
    • spinw.coupling.dl $\rightarrow$ $m-n$
    • spinw.matrix.mat(:,:,spinw.coupling.mat_idx) $\rightarrow$ $J$
  • $H$ is given by spinw.single_ion.field
spinw.gencoupling()
                            
cryst=spinw;
cryst.genlattice('sym','P 4','lat_const',[8 8 6]);
cryst.addatom('r',[1/4 1/4 0],’S’,1);
cryst.gencoupling;
cryst.addmatrix('label','A',’value',1-eye(3));
cryst.addaniso('A’);
                            
                        
                            
cryst=spinw;
cryst.genlattice('lat_const',[8 8 6]);
cryst.addatom('r',[1/4 1/4 0],'S',1);
cryst.addatom('r',[3/4 1/4 0],'S',1);
cryst.addatom('r',[1/4 3/4 0],'S',1);
cryst.addatom('r',[3/4 3/4 0],'S',1);
cryst.gencoupling;
cryst.addmatrix('label','A','value',1-eye(3));
cryst.addaniso('A');
                            
                        
spinw.gencoupling()
                            
cryst=spinw;
cryst.genlattice('sym','P 4','lat_const',[8 8 6]);
cryst.addatom('r',[1/4 1/4 0],’S’,1);
cryst.gencoupling;
cryst.addmatrix('label','D',’value',[1 -1 0]);
cryst.addcoupling(‘mat’,'D',’bond’,1);
                            
                        
                            
cryst=spinw;
cryst.genlattice('lat_const',[8 8 6]);
cryst.addatom('r',[1/4 1/4 0],'S',1);
cryst.addatom('r',[3/4 1/4 0],'S',1);
cryst.addatom('r',[1/4 3/4 0],'S',1);
cryst.addatom('r',[3/4 3/4 0],'S',1);
cryst.gencoupling;
cryst.addmatrix('label','D','mat',[1 -1 0]);
cryst.addcoupling(‘mat’,'D',’bond’,1);
                            
                        
spinw.spinwave(Q)

swSpec = spinw.spinwave({Q1 Q2 nQ})

  • Solves the general Hamiltonian
  • Commensurate and incommensurate magnetic structures
  • Calculates the spin-spin correlation function in xyz coordinate system:

  • $$ S^{\alpha\beta}(k, \omega) $$
  • Two methods:
    • diagonalizing Hermitian matrixa $\rightarrow$ fast but only for strictly positive definite matrices
    • diagonalizin non-Hermitian matrixa $\rightarrow$ bit slower, but works for non positive definite matrices
  • $Q$ can be a $3\cdot nQ$ matrix or cell that defines linear scans between points
spinw.spinwave(Q,’option’,value,...)

There are a few important options:


formfact

  • true: Includes magnetic form factor stored in spinw.unit_cell
  • false: Magnetic form factor is not considered.


gtensor

  • true: g-tensor is included in the spin-spin correlation function.
  • false: g-tensor is not considered


hermit

  • true: Colpa method is used.
  • false: White method is used


usemex

  • true: Use compiled code for speedup (especially for small magnetic unit cells)
  • false: Use MATLAB JIT code
Spin-spin correlation function

swSpec = spinw.spinwave({Q1 Q2 nQ})

swSpec structure for commensurate structures:

  • .omega- D:$[2\cdot nMagExt, nHkl]$, dispersion at every Q-point
  • .Sab- D:$[3, 3, 2, \cdot nMagExt, nHkl]$, 3x3 correlation function for every omega and Q
  • .hkl- D:$[3, nHkl]$, Q points in r.l.u.
  • .hklA- D:$[3, nHkl]$, Q points in $\unicode{x212B}^{-1}$, xyz coordinate system
  • .incomm- Whether the spectrum is calculated in incommensurate mode.
  • .obj- Copy of the input spinw object.

If there are several crystallographic twins, .omega and .Sab are packaged into a cell that contains nTwin number of matrices.

For incommensurate magnetic structures nHkl is tripled: $(k-k_m,k,k+k_m)$.

Spin-spin correlation function - Neutron cross-section

swSpec = sw_neutron(swSpec, ‘pol’,true,’uv’,{u1 v1})

Calculates the polarised/unpolarised neutron scattering cross section.

New fields:

  • .Sperp- D:$[2\cdot nMagExt, nHkl]$, neutron scattering intensity for each .omega and Q
  • .intP- D:$[3, 2, \cdot nMagExt, nHkl]$, polarised intensity
  • .Pab- D:$[3, 3, 2\cdot nMagExt, nHkl]$, polarisation matrix for every mode and Q
  • .Mab- D:$[3, 3, 2\cdot nMagExt, nHkl]$, spin-spin correlation function in the Blue-Maleev coordinate system ($x\parallel Q$, $y$ in scattering plane, $z$ vertical)
Spin-spin correlation function - Energy dependence

swSpec = sw_egrid(swSpec, ‘component’,{’Sxx’ ‘Syy’},’Evect’,E)

Convolutes selected elements of the spin-spin correlation function.

  • component: selects either a single element: ‘Sperp’, ‘S$_{xx}$+S$_{yy}$+S$_{zz}$’, ‘S$_{xx}$’, etc. or several components to compare: {‘S$_{xx}$’, ‘S$_{yy}$’}, etc.
  • 'Evect': energy bin (bin edges)

New fields:

  • .swConv- D:$[nE, nHKL]$, convoluted spectrum
  • .swInt- D:$[nMode, nHKL]$, polarised intensity
Spin-spin correlation function - Instrumental Resolution

swSpec = sw_instrument(swSpec, ‘dE’,dE1, ‘dQ’, dQ1, ...)

Introduces instrumental and other factors to the convoluted spectrum.

  • Finite energy and Q resolution (Gaussian).
  • ($k_i$, $Theta_{Min}$) to calculate the measurable ($E$,$Q$) volume.
  • energy transfer dependent energy resolution for TOF.
  • 'norm':true to normalize the spectrum to mbarn/meV/cell units

New fields:

  • .swRaw- D:$[nE, nHKL]$, original convoluted spectrum
  • .norm
  • .ki
  • .dE
  • .dQ

Evaluating the Hamiltonian - Symbolically

Solving the system symbolically.
Symbolic calculation example
                chainS = spinw;
chainS.symbolic(true)
chainS.genlattice('lat_const', [3 8 8])
chainS.addatom('r', [0 0 0], 'S', sym(1))
chainS.gencoupling;
chainS.addmatrix('label', 'J1')
chainS.addmatrix('label', 'J2')
chainS.addcoupling('mat', 'J1', 'bond', 1);
chainS.addcoupling('mat', 'J2', 'bond', 2);
chainS.genmagstr('mode', 'helical', 'k', sym([1/2 0 0]), 'nExt',[2 1 1], 'n', sym([0 0 1]), 'S', sym([0 1 0])');
chSpecSym = chainS.spinwave;
            

$$-(e^{-4\pi h i} - 1)\sqrt{J_2^2 - 2J_2^2e^{4\pi h i} +J_2^2e^{8\pi h i} - J_1^2e^{4\pi h i} + 4J_1J_2e^{4\pi h i}}$$

$$ 2\cos (2\pi h)\sqrt{J_1^2 + 4J_1J_2 - 4J_2^2\sin^2(2\pi h) }$$

Symbolic calculation example

To generate the dispersion

                syms('J1','J2');
omega1 = subs(chSpecSym.omega(1),[J1 J2],[1 0.2]);
ezplot(real(omega1),[0 1])
            

Available functions

Reference list of all available functions.
All methods of the spinw object

SpinW methods:

  • abc
  • addaniso
  • addatom
  • addcoupling
  • addg
  • addmatrix
  • addtwin
  • anneal
  • annealloop
  • atom
  • basisvector
  • copy
  • corespec
  • couplingtable
  • delete
  • disp
  • energy
  • export
  • field
  • fileid
  • fitpow
  • fitspec
  • formula
  • fourier
  • fouriersym
  • gencoupling
  • genlattice
  • genmagstr
  • getmatrix
  • horace
  • intmatrix
  • isvalid
  • magtable
  • matom
  • matparser
  • meanfield
  • moment
  • natom
  • nbond
  • newcell
  • nmagext
  • nmat
  • nosym
  • notwin
  • ntwin
  • optmagsteep
  • optmagstr
  • phonon
  • phononsym
  • plot
  • powspec
  • setmatrix
  • spinw
  • spinwave
  • spinwavesym
  • struct
  • structfact
  • symbolic
  • symmetry
  • temperature
  • tisza
  • twinq
  • unitcell
  • version
All methods of the spinw object

Tools:

  • sw_atomdata
  • sw_freemem
  • sw_cmod
  • sw_converter
  • sw_idata
  • sw_initialize
  • sw_parstr
  • sw_qscan
  • sw_readparam
  • sw_rootdir
  • sw_status
  • sw_uniquetol
  • sw_update
  • sw_version

Magnetic Structure:

  • sw_annealfigure
  • sw_annealplot
  • sw_intsf
  • sw_fstat
  • sw_fsub
  • sw_mff
  • sw_plotsf

Basic Geometry:

  • sw_cartesian
  • sw_mirror
  • sw_nvect
  • sw_rot

Spectrum:

  • sw_econtract
  • sw_extendlattice
  • sw_conv
  • sw_instrument
  • sw_neutron
  • sw_omegasum
  • sw_plotspec
  • sw_readspec

Plotting:

  • +sw_plot

Symmetry:

  • +swsym