adds new 3x3 matrix

Syntax

addmatrix(obj,Name,Value)

Description

addmatrix(obj,Name,Value) adds a new matrix to the spinw.matrix field of obj. The added matrices can be later assigned to bonds, single ion anisotropy terms or g-tensors of magnetic atoms. If the given matrix label already exists in obj, instead of adding new matrix the existing one will be overwritten.

Examples

The first example adds a diagonal matrix eye(3), that can describe Heisenberg interaction if assigned to a bond. The second example adds an ansisymmetric matrix that can decribe Dzyaloshinskii-Moriya (DM) interaction if assigned to a bond.

crystal = spinw
crystal.addmatrix('value',1,'label','J_1')
crystal.matrix.mat

Output

     1     0     0
     0     1     0
     0     0     1
crystal.addmatrix('value',[1 0 0],'label','J_1')
crystal.matrix.mat

Output

     0     0     0
     0     0     1
     0    -1     0

Input Arguments

obj
spinw object.

Name-Value Pair Arguments

'value'
The actual numerical values to be added as a matrix. It can have the following shapes:
  • the given values will be stored in spinw.matrix as they are given.
  • the given value will be multiplied with eye(3).
  • [Mx My Mz] the given triplet will be used to define an antisymmetric matrix M = [0 M3 -M2;-M3 0 M1;M2 -M1 0].
'label'
Label string for plotting default value is 'matI', where is the index of the matrix.
'color'
Color for plotting, either row vector that contains color RGB codes (values of 0-255), or a string with the name of the color, for possible colors names swplot.color. Default color is a random color.

Output Arguments

The obj output will contain the additional matrix in the spinw.matrix field.

See Also

spinw | swplot.color