# Hamiltonian¶

Set the parameters of the Heisenberg Hamiltonian, such as external field or exchange interaction.

`spirit.hamiltonian.``CHIRALITY_BLOCH` = 1

DMI Bloch chirality type for neighbour shells

`spirit.hamiltonian.``CHIRALITY_BLOCH_INVERSE` = -1

DMI Bloch chirality type for neighbour shells with opposite sign

`spirit.hamiltonian.``CHIRALITY_NEEL` = 2

DMI Neel chirality type for neighbour shells

`spirit.hamiltonian.``CHIRALITY_NEEL_INVERSE` = -2

DMI Neel chirality type for neighbour shells with opposite sign

`spirit.hamiltonian.``DDI_METHOD_CUTOFF` = 3

Dipole-dipole interaction: use a direct summation with a cutoff radius

`spirit.hamiltonian.``DDI_METHOD_FFT` = 1

Dipole-dipole interaction: use FFT convolutions

`spirit.hamiltonian.``DDI_METHOD_FMM` = 2

Dipole-dipole interaction: use a fast multipole method (FMM)

`spirit.hamiltonian.``DDI_METHOD_NONE` = 0

Dipole-dipole interaction: do not calculate

`spirit.hamiltonian.``get_anisotropy`(p_state, idx_image=-1, idx_chain=-1)

Set the (homogeneous) magnetocrystalline anisotropy.

`spirit.hamiltonian.``get_boundary_conditions`(p_state, idx_image=-1, idx_chain=-1)

Returns an array of shape(3) containing the boundary conditions in the three translation directions [a, b, c] of the lattice.

`spirit.hamiltonian.``get_cubic_anisotropy`(p_state, idx_image=-1, idx_chain=-1)

Set the (homogeneous) magnetocrystalline anisotropy.

`spirit.hamiltonian.``get_ddi`(p_state, idx_image=-1, idx_chain=-1)

Returns a dictionary, containing information about the used ddi settings

`spirit.hamiltonian.``get_field`(p_state, idx_image=-1, idx_chain=-1)

Returns the magnitude and an array of shape(3) containing the direction of the external magnetic field.

`spirit.hamiltonian.``get_name`(p_state, idx_image=-1, idx_chain=-1)

Returns a string containing the name of the Hamiltonian currently in use.

`spirit.hamiltonian.``set_anisotropy`(p_state, magnitude, direction, idx_image=-1, idx_chain=-1)

Set the (homogeneous) magnetocrystalline anisotropy.

`spirit.hamiltonian.``set_boundary_conditions`(p_state, boundaries, idx_image=-1, idx_chain=-1)

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

0 = open, 1 = periodical

`spirit.hamiltonian.``set_cubic_anisotropy`(p_state, magnitude, idx_image=-1, idx_chain=-1)

Set the (homogeneous) magnetocrystalline anisotropy.

`spirit.hamiltonian.``set_ddi`(p_state, ddi_method, n_periodic_images=[4, 4, 4], radius=0.0, pb_zero_padding=True, idx_image=-1, idx_chain=-1)

Set the dipolar interaction calculation method.

• ddi_method: one of the integers defined above
• n_periodic_images: the number of periodical images in the three translation directions, taken into account when boundaries in the corresponding direction are periodical
`spirit.hamiltonian.``set_dmi`(p_state, n_shells, D_ij, chirality=1, idx_image=-1, idx_chain=-1)

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

`spirit.hamiltonian.``set_exchange`(p_state, n_shells, J_ij, idx_image=-1, idx_chain=-1)

Set the Exchange interaction in terms of neighbour shells.

`spirit.hamiltonian.``set_field`(p_state, magnitude, direction, idx_image=-1, idx_chain=-1)

Set the (homogeneous) external magnetic field.

`spirit.hamiltonian.``write_hessian`(p_state, filename, triplet_format=True, idx_image=-1, idx_chain=-1)

RWrites the embedding Hessian to a file