magnopy.SpinHamiltonian.add_21#

method

SpinHamiltonian.add_21(alpha: int, parameter, units=None, replace=False) None#

Adds a (two spins & one site) parameter to the Hamiltonian.

Parameters:
alphaint

Index of an atom, with which the parameter is associated.

0 <= alpha < len(spinham.atoms.names).

parameter(3, ) array-like

Value of the parameter (\(3\times1\) vector). Given in the units of units.

unitsstr, optional

Units in which the parameter is given. Parameters have the the units of energy. By default assumes SpinHamiltonian.units. For the list of the supported units see Units of Hamiltonian's parameters. If given units are different from SpinHamiltonian.units, then the parameter's value will be converted automatically from units to SpinHamiltonian.units.

Added in version 0.3.0.

replacebool, default False

Whether to replace the value of the parameter if an atom already has a parameter associated with it.

Raises:
ValueError

If an atom already has a parameter associated with it.

See also

p21
remove_21