Hamiltonian

#include "Spirit/Hamiltonian.h"

This currently only provides an interface to the Heisenberg Hamiltonian.

DMI chirality

SPIRIT_CHIRALITY_BLOCH 1

Bloch chirality.

SPIRIT_CHIRALITY_NEEL 2

Neel chirality.

SPIRIT_CHIRALITY_BLOCH_INVERSE -1

Bloch chirality, inverted DM vectors.

SPIRIT_CHIRALITY_NEEL_INVERSE -2

Neel chirality, inverted DM vectors.

Dipole-Dipole method

SPIRIT_DDI_METHOD_NONE 0

Do not use dipolar interactions.

SPIRIT_DDI_METHOD_FFT 1

Use fast Fourier transform (FFT) convolutions.

SPIRIT_DDI_METHOD_FMM 2

Use the fast multipole method (FMM)

SPIRIT_DDI_METHOD_CUTOFF 3

Use a direct summation with a cutoff radius.

Hamiltonian classification id (legacy support)

SPIRIT_HAMILTONIAN_CLASS_GENERIC 0

Fallback if no other category applies.

SPIRIT_HAMILTONIAN_CLASS_GAUSSIAN 1

Only Gaussian interaction.

SPIRIT_HAMILTONIAN_CLASS_HEISENBERG 2

No Gaussian interaction.

Setters

void Hamiltonian_Set_Boundary_Conditions(State *state, const bool *periodical, int idx_image = -1, int idx_chain = -1)

Deprecated:

Use Geometry_Set_Boundary_Conditions() instead.

Set the boundary conditions along the translation directions [a, b, c]

void Hamiltonian_Set_Field(State *state, scalar magnitude, const scalar *direction, int idx_image = -1, int idx_chain = -1)

Set the (homogeneous) external magnetic field [T].

void Hamiltonian_Set_Anisotropy(State *state, scalar magnitude, const scalar *normal, int idx_image = -1, int idx_chain = -1)

Set a global uniaxial anisotropy [meV].

void Hamiltonian_Set_Biaxial_Anisotropy(State *state, const scalar *magnitude, const int exponents[][3], const scalar *primary, const scalar *secondary, int n_terms, int idx_image = -1, int idx_chain = -1)

Set a global biaxial anisotropy [meV].

void Hamiltonian_Set_Exchange(State *state, int n_shells, const scalar *jij, int idx_image = -1, int idx_chain = -1)

Set the exchange interaction in terms of neighbour shells [meV].

void Hamiltonian_Set_DMI(State *state, int n_shells, const scalar *dij, int chirality = SPIRIT_CHIRALITY_BLOCH, int idx_image = -1, int idx_chain = -1)

Set the Dzyaloshinskii-Moriya interaction in terms of neighbour shells [meV].

void Hamiltonian_Set_DDI(State *state, int ddi_method, int n_periodic_images[3], scalar cutoff_radius = 0, bool pb_zero_padding = true, int idx_image = -1, int idx_chain = -1)

Configure the dipole-dipole interaction

  • ddi_method: see integers defined above

  • n_periodic_images: how many repetition of the spin configuration to append along the translation directions [a, b, c], if periodical boundary conditions are used

  • cutoff_radius: the distance at which to stop the direct summation, if used

  • pb_zero_padding: if True zero padding is used even for periodical directions

Getters

void Hamiltonian_Get_Boundary_Conditions(State *state, bool *periodical, int idx_image = -1, int idx_chain = -1)

Deprecated:

Use Geometry_Get_Boundary_Conditions() instead.

Retrieves the boundary conditions

void Hamiltonian_Get_Field(State *state, scalar *magnitude, scalar *direction, int idx_image = -1, int idx_chain = -1)

Retrieves the external magnetic field [T].

void Hamiltonian_Get_Anisotropy(State *state, scalar *magnitude, scalar *normal, int idx_image = -1, int idx_chain = -1)

Retrieves the uniaxial anisotropy [meV].

int Hamiltonian_Get_Biaxial_Anisotropy_N_Atoms(State *state, int idx_image = -1, int idx_chain = -1)

Retrieves the number of atoms in the magnetic unit cell for which a biaxial anisotropy has been set.

int Hamiltonian_Get_Biaxial_Anisotropy_N_Terms(State *state, int idx_image = -1, int idx_chain = -1)

Retrieves the total number of terms that contribute to the biaxial anisotropy.

void Hamiltonian_Get_Biaxial_Anisotropy(State *state, int *indices, scalar primary[][3], scalar secondary[][3], int *site_p, int n_indices, scalar *magnitude, int exponents[][3], int n_terms, int idx_image = -1, int idx_chain = -1)

Retrieves the biaxial anisotropy [meV].

void Hamiltonian_Get_Exchange_Shells(State *state, int *n_shells, scalar *jij, int idx_image = -1, int idx_chain = -1)

Retrieves the exchange interaction in terms of neighbour shells.

Note: if the interactions were specified as pairs, this function will retrieve n_shells=0.

int Hamiltonian_Get_Exchange_N_Pairs(State *state, int idx_image = -1, int idx_chain = -1)

Returns the number of exchange interaction pairs.

void Hamiltonian_Get_Exchange_Pairs(State *state, int idx[][2], int translations[][3], scalar *Jij, int idx_image = -1, int idx_chain = -1)
void Hamiltonian_Get_DMI_Shells(State *state, int *n_shells, scalar *dij, int *chirality, int idx_image = -1, int idx_chain = -1)

Retrieves the Dzyaloshinskii-Moriya interaction in terms of neighbour shells.

Note: if the interactions were specified as pairs, this function will retrieve n_shells=0.

int Hamiltonian_Get_DMI_N_Pairs(State *state, int idx_image = -1, int idx_chain = -1)

Returns the number of Dzyaloshinskii-Moriya interaction pairs.

void Hamiltonian_Get_DDI(State *state, int *ddi_method, int n_periodic_images[3], scalar *cutoff_radius, bool *pb_zero_padding, int idx_image = -1, int idx_chain = -1)

Retrieves the dipole-dipole interaction configuration.

  • ddi_method: see integers defined above

  • n_periodic_images: how many repetitions of the spin configuration to append along the translation directions [a, b, c], if periodical boundary conditions are used

  • cutoff_radius: the distance at which to stop the direct summation, if method_cutoff is used

  • pb_zero_padding: if True zero padding is used even for periodical directions

void Hamiltonian_Write_Hessian(State *state, const char *filename, bool triplet_format = true, int idx_image = -1, int idx_chain = -1)

Writes the 3Nx3N embedding Hessian to a file. If triplet_format is set to true the hessian is written as a list of triplets, recommended for large and sparse Hessians.