Magnetic Space Group API¶
Magnetic crystal structures, symmetry analysis, classification tables, and
group identification for the 1,651 magnetic space groups. Shared types such
as moyopy.Cell, moyopy.Operations,
moyopy.UnimodularTransformation, and
moyopy.PointGroup are documented on the
API Reference hub.
Magnetic core types¶
Lattice + sites with magnetic moments, plus the magnetic operation container.
moyopy.CollinearMagneticCell
¶
CollinearMagneticCell(basis: list[list[float]], positions: list[list[float]], numbers: list[int], magnetic_moments: list[float])
A crystal structure with collinear magnetic moments.
Create a new CollinearMagneticCell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
basis
|
list[list[float]]
|
Row-wise basis vectors of the lattice. |
required |
positions
|
list[list[float]]
|
Fractional coordinates of each site. |
required |
numbers
|
list[int]
|
Atomic number of each site. |
required |
magnetic_moments
|
list[float]
|
Scalar magnetic moment of each site (collinear). |
required |
deserialize_json
classmethod
¶
deserialize_json(json_str: str) -> CollinearMagneticCell
Deserialize an object from a JSON string.
from_dict
classmethod
¶
from_dict(data: dict[str, Any]) -> CollinearMagneticCell
Create an object from a dictionary.
moyopy.NonCollinearMagneticCell
¶
NonCollinearMagneticCell(basis: list[list[float]], positions: list[list[float]], numbers: list[int], magnetic_moments: list[list[float]])
A crystal structure with non-collinear (vector) magnetic moments.
Create a new NonCollinearMagneticCell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
basis
|
list[list[float]]
|
Row-wise basis vectors of the lattice. |
required |
positions
|
list[list[float]]
|
Fractional coordinates of each site. |
required |
numbers
|
list[int]
|
Atomic number of each site. |
required |
magnetic_moments
|
list[list[float]]
|
Three-component magnetic moment vector of each site. |
required |
magnetic_moments
property
¶
Three-component magnetic moment vector of each site.
deserialize_json
classmethod
¶
deserialize_json(json_str: str) -> NonCollinearMagneticCell
Deserialize an object from a JSON string.
from_dict
classmethod
¶
from_dict(data: dict[str, Any]) -> NonCollinearMagneticCell
Create an object from a dictionary.
moyopy.MagneticOperations
¶
A list of magnetic symmetry operations (rotation + translation + time reversal).
rotations
property
¶
Rotation parts of the magnetic symmetry operations.
time_reversals
property
¶
Time-reversal flag for each magnetic symmetry operation.
translations
property
¶
Translation parts of the magnetic symmetry operations (fractional coordinates).
deserialize_json
classmethod
¶
deserialize_json(json_str: str) -> MagneticOperations
Deserialize an object from a JSON string.
from_dict
classmethod
¶
from_dict(data: dict[str, Any]) -> MagneticOperations
Create an object from a dictionary.
Symmetry datasets¶
Run a symmetry analysis on a magnetic cell and inspect the result.
moyopy.MoyoCollinearMagneticDataset
¶
MoyoCollinearMagneticDataset(magnetic_cell: CollinearMagneticCell, *, symprec: float = 0.0001, angle_tolerance: float | None = None, mag_symprec: float | None = None, is_axial: bool = False, rotate_basis: bool = True)
A dataset containing magnetic symmetry information of the input collinear magnetic structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
magnetic_cell
|
CollinearMagneticCell
|
Input collinear magnetic structure. |
required |
symprec
|
float
|
Symmetry search tolerance in the unit of magnetic_cell.basis. |
0.0001
|
angle_tolerance
|
float | None
|
Symmetry search tolerance in the unit of radians. |
None
|
mag_symprec
|
float | None
|
Symmetry search tolerance in the unit of magnetic moments. |
None
|
is_axial
|
bool
|
Whether the magnetic moments are axial on improper operations. |
False
|
rotate_basis
|
bool
|
Whether to rotate the basis vectors of the input cell to those of the standardized cell. |
True
|
angle_tolerance
property
¶
angle_tolerance: float | None
Actually used angle_tolerance in iterative symmetry search.
mag_symprec
property
¶
mag_symprec: float | None
Actually used mag_symprec in iterative symmetry search.
magnetic_operations
property
¶
magnetic_operations: MagneticOperations
Magnetic symmetry operations in the input cell.
mapping_std_prim
property
¶
Mapping sites in the input magnetic cell to those in the primitive standardized magnetic cell.
The i-th atom in the input magnetic cell is mapped to the
mapping_to_std_prim[i]-th atom in the primitive standardized magnetic cell.
orbits
property
¶
The i-th atom in the input magnetic cell is equivalent to the orbits[i]-th
atom in the input magnetic cell. For example, orbits=[0, 0, 2, 2, 2, 2] means
the first two atoms are equivalent and the last four atoms are equivalent to each other.
prim_std_linear
property
¶
Linear part of transformation from the input magnetic cell to the primitive standardized magnetic cell.
prim_std_mag_cell
property
¶
prim_std_mag_cell: CollinearMagneticCell
Primitive standardized magnetic cell.
Same transformation convention as the standardized magnetic cell above::
prim_std_mag_cell.cell.basis.T = (
std_rotation_matrix @ mag_cell.cell.basis.T @ prim_std_linear
)
x_prim_std = np.linalg.inv(prim_std_linear) @ (x_input - prim_std_origin_shift)
prim_std_origin_shift
property
¶
Origin shift of transformation from the input magnetic cell to the primitive standardized magnetic cell.
std_linear
property
¶
Linear part of transformation from the input magnetic cell to the standardized magnetic cell.
std_mag_cell
property
¶
std_mag_cell: CollinearMagneticCell
Standardized magnetic cell.
The input magnetic cell is related to the standardized magnetic cell by
(std_linear, std_origin_shift) and std_rotation_matrix:
Lattice::
std_mag_cell.cell.basis.T = std_rotation_matrix @ mag_cell.cell.basis.T @ std_linear
Fractional positions::
x_std = np.linalg.inv(std_linear) @ (x_input - std_origin_shift)
std_rotation_matrix is a rigid rotation (orthogonal matrix) applied
only to the Cartesian lattice basis. It does not affect fractional
coordinates.
std_origin_shift
property
¶
Origin shift of transformation from the input magnetic cell to the standardized magnetic cell.
std_rotation_matrix
property
¶
Rigid rotation (orthogonal matrix) applied to the lattice basis.
moyopy.MoyoNonCollinearMagneticDataset
¶
MoyoNonCollinearMagneticDataset(magnetic_cell: NonCollinearMagneticCell, *, symprec: float = 0.0001, angle_tolerance: float | None = None, mag_symprec: float | None = None, is_axial: bool = True, rotate_basis: bool = True)
A dataset containing magnetic symmetry information of the input non-collinear magnetic structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
magnetic_cell
|
NonCollinearMagneticCell
|
Input non-collinear magnetic structure. |
required |
symprec
|
float
|
Symmetry search tolerance in the unit of magnetic_cell.basis. |
0.0001
|
angle_tolerance
|
float | None
|
Symmetry search tolerance in the unit of radians. |
None
|
mag_symprec
|
float | None
|
Symmetry search tolerance in the unit of magnetic moments. |
None
|
is_axial
|
bool
|
Whether the magnetic moments are axial on improper operations. |
True
|
rotate_basis
|
bool
|
Whether to rotate the basis vectors of the input cell to those of the standardized cell. |
True
|
angle_tolerance
property
¶
angle_tolerance: float | None
Actually used angle_tolerance in iterative symmetry search.
mag_symprec
property
¶
mag_symprec: float | None
Actually used mag_symprec in iterative symmetry search.
magnetic_operations
property
¶
magnetic_operations: MagneticOperations
Magnetic symmetry operations in the input cell.
mapping_std_prim
property
¶
Mapping sites in the input magnetic cell to those in the primitive standardized magnetic cell.
The i-th atom in the input magnetic cell is mapped to the
mapping_to_std_prim[i]-th atom in the primitive standardized magnetic cell.
orbits
property
¶
The i-th atom in the input magnetic cell is equivalent to the orbits[i]-th
atom in the input magnetic cell. For example, orbits=[0, 0, 2, 2, 2, 2] means
the first two atoms are equivalent and the last four atoms are equivalent to each other.
prim_std_linear
property
¶
Linear part of transformation from the input magnetic cell to the primitive standardized magnetic cell.
prim_std_mag_cell
property
¶
prim_std_mag_cell: NonCollinearMagneticCell
Primitive standardized magnetic cell.
Same transformation convention as the standardized magnetic cell above::
prim_std_mag_cell.cell.basis.T = (
std_rotation_matrix @ mag_cell.cell.basis.T @ prim_std_linear
)
x_prim_std = np.linalg.inv(prim_std_linear) @ (x_input - prim_std_origin_shift)
prim_std_origin_shift
property
¶
Origin shift of transformation from the input magnetic cell to the primitive standardized magnetic cell.
std_linear
property
¶
Linear part of transformation from the input magnetic cell to the standardized magnetic cell.
std_mag_cell
property
¶
std_mag_cell: NonCollinearMagneticCell
Standardized magnetic cell.
The input magnetic cell is related to the standardized magnetic cell by
(std_linear, std_origin_shift) and std_rotation_matrix:
Lattice::
std_mag_cell.cell.basis.T = std_rotation_matrix @ mag_cell.cell.basis.T @ std_linear
Fractional positions::
x_std = np.linalg.inv(std_linear) @ (x_input - std_origin_shift)
std_rotation_matrix is a rigid rotation (orthogonal matrix) applied
only to the Cartesian lattice basis. It does not affect fractional
coordinates.
std_origin_shift
property
¶
Origin shift of transformation from the input magnetic cell to the standardized magnetic cell.
std_rotation_matrix
property
¶
Rigid rotation (orthogonal matrix) applied to the lattice basis.
Crystallographic data¶
Classification tables and helpers to fetch operations by UNI number.
moyopy.MagneticSpaceGroupType
¶
MagneticSpaceGroupType(uni_number: int)
moyopy.magnetic_operations_from_uni_number
¶
magnetic_operations_from_uni_number(uni_number: int, *, primitive: bool = False) -> MagneticOperations
Group identification¶
Identify magnetic space groups from a primitive list of magnetic symmetry operations.
moyopy.MagneticSpaceGroup
¶
MagneticSpaceGroup(prim_rotations: list[list[int]], prim_translations: list[list[float]], prim_time_reversals: list[bool], *, basis: list[list[float]] | None = None, epsilon: float = 0.0001)
Magnetic space group identified from a list of primitive magnetic operations.
Identify the magnetic space group from primitive magnetic operations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prim_rotations
|
list[list[list[int]]]
|
Rotation matrices of the magnetic operations of the primitive cell. |
required |
prim_translations
|
list[list[float]]
|
Translation vectors of the magnetic operations of the primitive cell. |
required |
prim_time_reversals
|
list[bool]
|
Time-reversal flag for each magnetic operation of the primitive cell. |
required |
basis
|
list[list[float]] | None
|
Row-wise basis vectors of the primitive lattice. If |
None
|
epsilon
|
float
|
Numerical tolerance for matching translations. |
0.0001
|
Adapters¶
Convert between moyopy.NonCollinearMagneticCell
and pymatgen Structure / ASE Atoms. Requires the optional dependencies
installed via pip install moyopy[interface].
moyopy.interface.MoyoNonCollinearMagneticAdapter
¶
from_disordered_structure
staticmethod
¶
from_disordered_structure(structure: Structure) -> tuple[NonCollinearMagneticCell, dict[int, Composition]]
Convert a disordered pymatgen Structure with non-collinear magnetic moments to a Moyo NonCollinearMagneticCell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
structure
|
Structure
|
A pymatgen Structure object, which may contain disordered sites. Must have non-collinear magnetic moments in site_properties['magmom']. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
magnetic_cell |
NonCollinearMagneticCell
|
The converted Moyo NonCollinearMagneticCell object. |
unique_species_mapping |
dict[int, Composition]
|
A mapping from integer indices used in the Moyo NonCollinearMagneticCell to the original pymatgen SpeciesLike objects. |
from_structure
staticmethod
¶
from_structure(structure: Structure) -> NonCollinearMagneticCell
Convert a pymatgen Structure with non-collinear magnetic moments to a Moyo NonCollinearMagneticCell.
get_structure
staticmethod
¶
get_structure(magnetic_cell: NonCollinearMagneticCell, *, unique_species_mapping: dict[int, Composition] | None = None) -> Structure
Convert a Moyo NonCollinearMagneticCell to a pymatgen Structure.
If the NonCollinearMagneticCell was created from a disordered Structure, the unique_species_mapping should be provided to reconstruct the original species.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
magnetic_cell
|
NonCollinearMagneticCell
|
The Moyo NonCollinearMagneticCell to convert. |
required |
unique_species_mapping
|
dict[int, Composition] | None
|
A mapping from integer indices used in the Moyo NonCollinearMagneticCell to the original pymatgen SpeciesLike objects. If None, assumes the NonCollinearMagneticCell was created from an ordered Structure. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
structure |
Structure
|
The converted pymatgen Structure object with magnetic moments in site_properties['magmom']. |