magnopy.SpinHamiltonian.add_21#

method

SpinHamiltonian.add_21(alpha: int, parameter, 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).

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