magnopy.Energy.gradient#

method

Energy.gradient(spin_directions, _normalize=True)[source]#

Computes first derivatives of energy (\(E^{(0)}\)) with respect to the components of the spin directional vectors.

Parameters:
spin_directions(M, 3) array-like

Directions of spin vectors. Only directions of vectors are used, modulus is ignored. M is the amount of magnetic atoms in the Hamiltonian. The order of spin directions is the same as the order of magnetic atoms in spinham.magnetic_atoms.spins.

_normalizebool, default True

Whether to normalize the spin_directions or use the provided vectors as is. This parameter is technical and we do not recommend to use it at all.

Returns:
gradient(M, 3) numpy.ndarray

Gradient of energy.

[
    [dE / dz1x, dE / dz1y, dE / dz1z],
    [dE / dz2x, dE / dz2y, dE / dz2z],
    ...[dE / dzMx, dE / dzMy, dE / dzMz],
]