magnon.interactions

Classes

Interaction

A class used to represent a single exchange interaction

InteractionList

A class used to represent a set of exchange coupling interactions associated with a given structure.

Functions

apply_bond_reversal_symmetry(interaction_list)

Applies the bond reversal symmetry due to bidirectionality of the exchange coupling.

symmetrize_couplings(interaction_list, atoms[, ...])

Generates the full exchange interaction data under the symmetry of a unit cell

read_interactions(filename[, atom_base_index])

Reads in interaction data from a file.

Module Contents

class magnon.interactions.Interaction

A class used to represent a single exchange interaction

Parameters:
  • i_index (int) – The index of the first site involved in the interaction

  • j_index (int) – The index of the second site involved in the interaction

  • r_ij_scaled (numpy.ndarray, dtype=float) – The interaction vector from i to j, in units of the lattice vectors

  • J_ij (numpy.ndarray, dtype=float) – The exchange coupling tensor

i_index: int
j_index: int
r_ij_scaled: numpy.ndarray
J_ij: numpy.ndarray
__iter__()

An iterator which enables unpacking of an Interaction object.

class magnon.interactions.InteractionList(interaction_data, atoms, cartesian=False)

A class used to represent a set of exchange coupling interactions associated with a given structure. This class also enables the application of symmetry operations to the exchange coupling dataset.

Parameters:
  • interaction_data (list) – A list either of Interaction objects or Interaction object initialisation inputs.

  • atoms (ase.Atoms object) – An ase.Atoms object describing the structure

  • cartesian (bool) – Whether the distance vectors are Cartesian or scaled, defaults to False.

atoms
interaction_list = []
__iter__()

An iterator that yields tuples of interaction data containing i_index, j_index, r_ij, J_ij.

insert_interaction(i_index, j_index, r_ij, J_ij, cartesian=False)

Appends an Interaction object to the list of interactions.

Parameters:
  • i_index (int) – The index of the first site involved in the new interaction

  • j_index (int) – The index of the second site involved in the new interaction

  • r_ij_scaled (numpy.ndarray, dtype=float) – The interaction vector from i to j, in units of the lattice vectors

  • J_ij (numpy.ndarray, dtype=float) – The exchange coupling tensor

find_interactions(i_index, j_index, r_ij_scaled)

Returns a list of Interaction objects matching the specified indices and vector.

Parameters:
  • i_index (int) – The index of the first site involved in the interaction(s) to be returned

  • j_index (int) – The index of the second site involved in the interaction(s) to be returned

  • r_ij_scaled (numpy.ndarray, dtype=float) – The interaction vector from i to j, in units of the lattice vectors, of the interaction(s) to be returned

Returns:

matches – A list of Interaction objects matching the specified indices and vector.

Return type:

list of Interaction objects

deduplicate()

Removes any duplicate interactions from the current instance.

get_interactions(i)

Returns a list of Interaction objects associated with a specified site index.

Parameters:

i (int) – The index of the site to get interactions for.

Return type:

A list of Interaction objects in which the first index is i

symmetrize(atoms)

Apply the symmetry of the cell to the couplings

Parameters:

atoms (ASE.Atoms object) – The ASE Atoms object of the cell whose symmetry to use.

Return type:

InteractionList object containing the symmetrized exchange coupling

update_indices(index_map)

Update the site indices based on a provided remapping

Parameters:

index_map (list) – A list in which the entry at each position is the new site index.

Raises:

ValueError – If one or more of the updated indices is invalid.

Return type:

InteractionList object containing the updated site indices.

Notes

This can be used to update the site indices when the nonmagnetic sites are removed - see magnon.MagnonSpectrum. The mapping in this case contains -1 for the nonmagnetic sites. If -1 is detected in the new couplings, a ValueError is raised.

magnon.interactions.apply_bond_reversal_symmetry(interaction_list)

Applies the bond reversal symmetry due to bidirectionality of the exchange coupling. Returns the new couplings generated under this symmetry which were not included in the original interaction data.

Parameters:

interaction_list (InteractionList object) – The exchange coupling to which the bond reversal symmetry will be applied.

Raises:

RuntimeError – If the symmetry results in inconsistent interactions.

Returns:

new_interaction_list – The new interactions generated under this symmetry which were not included in the original interaction data.

Return type:

InteractionList object

Notes

Applies the intrinsic symmetry

\[J(r_ij) = (J(r_ji))^T\]

Any symmetric couplings which are absent in the input are returned. If any existing couplings violate the intrinsic symmetry then a RuntimeError is raised. This will happen in the following cases: - More than 1 interaction is found that has the same \(i,j\) -> \(j,i\) and \(r_ij\) -> \(r_ji\) symmetry. This means the input data is incorrect or incompatible with our code (for example assuming that identical interactions will be summed). - An interaction is found with the \(i,j\) -> \(j,i\) and \(r_ij\) -> \(r_ji\) symmetry but the coupling matrix does not have the correct \(J(r_ij) = (J(r_ji))^T\) symmetry.

magnon.interactions.symmetrize_couplings(interaction_list, atoms, distance_tol=default_distance_tol)

Generates the full exchange interaction data under the symmetry of a unit cell

Parameters:
  • interaction_list (magnon.InteractionList object) – The InteractionList object containing the exchange coupling to be symmetrized

  • atoms (ASE.Atoms object) – The ASE Atoms object of the cell associated with the interactions

  • distance_tol (float, optional) – The precision used in determining equivalent coordinates, defaults to 1e-6

Raises:

RuntimeError – If the image of an atom under a symmetry operation does not correspond to another atom’s location

Returns:

new_interaction_list – The fully-symmetrized exchange coupling interactions

Return type:

magnon.InteractionList object

magnon.interactions.read_interactions(filename, atom_base_index=1)

Reads in interaction data from a file.

Parameters:
  • filename (str) – The location of the file containing the interaction data.

  • atom_base_index (int, optional) – The convention for the index of the first atom, defaults to 1

Raises:

ValueError – If the number of entries does not enable the construction of a scalar or 3x3 exchange coupling

Returns:

interaction_data – A list of data needed to create an Interaction object for each exchange coupling interaction in the file.

Return type:

list

Notes

Each line describes an interaction. The first two values are the atom indices in the unit cell, the next three give the vector between the atoms and the remainder give the coupling strength, either as a tensor or a scalar.