magnon.utils¶
Functions¶
|
Check if the input object is an array-like structure with a specific number of dimensions. |
|
Check whether all input arrays have the same shape. |
|
Check whether all input arrays have the same length. |
Ensure that the ASE Atoms object has vector (3D) magnetic moments for each atom. |
Module Contents¶
- magnon.utils.is_array_like(obj, ndim)¶
Check if the input object is an array-like structure with a specific number of dimensions.
- magnon.utils.all_same_shape(*arrays)¶
Check whether all input arrays have the same shape.
- Parameters:
arrays (array-like) – Variable number of arrays to compare.
- Returns:
True if all arrays have the same shape, False otherwise.
- Return type:
- magnon.utils.all_same_length(*arrays)¶
Check whether all input arrays have the same length.
- Parameters:
arrays (array-like) – Variable number of arrays to compare.
- Returns:
True if all arrays have the same length, False otherwise.
- Return type:
- magnon.utils.ensure_vector_magnetic_moments(atoms)¶
Ensure that the ASE Atoms object has vector (3D) magnetic moments for each atom.
- Parameters:
atoms (ase.Atoms) – ASE atoms object to be validated.
- Returns:
atoms – ASE Atoms object with vector magnetic moments.
- Return type:
ase.Atoms
Notes
ASE allows initial_magnetic_moments to be either scalar or vector. This function guarantees vector format, which is useful for handling non-collinear magnetism.