magnopy.SpinHamiltonian.add_magnetic_field#
method
- SpinHamiltonian.add_magnetic_field(B=None, alphas=None, h=None) None[source]#
Adds external magnetic field to the Hamiltonian in the form of one spin parameters.
\[\mu_B g_{\alpha} \boldsymbol{B}\cdot\boldsymbol{S}_{\mu,\alpha} = C_1 \boldsymbol{S}_{\mu,\alpha} \cdot \boldsymbol{J}_{Zeeman}(\boldsymbol{r}_{\alpha})\]where \(\boldsymbol{J}_{Zeeman}(\boldsymbol{r}_{\alpha})\) is defined as
\[\boldsymbol{J}_{Zeeman}(\boldsymbol{r}_{\alpha}) = \dfrac{\mu_B g_{\alpha}}{C_1}\boldsymbol{B}\]- Parameters:
- B(3, ) array-like
Vector of magnetic field (magnetic flux density, B) given in the units of Tesla.
- alphaslist of int, optional
Indices of atoms, to which the magnetic field effect should be added.
- h(3, ) array-like
Vector of magnetic field given in the units of Tesla.
Deprecated since version 0.4.0: The argument will be removed in May of 2026. Use
Binstead.
Notes
To minimize the energy the magnetic moment will be aligned with the direction of the external field. But spin vector will be directed opposite to the direction of the magnetic field.
If
alphas is None, then parameters of the magnetic field added only to the magnetic atoms. In other words only to atoms that already have at least one other parameter (any) associated with it.If
alpha is not None, then parameters of magnetic field are added to the atoms with the provided indices (based on the order inSpinHamiltonian.atoms)