Magnetic Space Group API

Contents

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.

CollinearMagneticCell

A crystal structure with collinear magnetic moments.

NonCollinearMagneticCell

A crystal structure with non-collinear (vector) magnetic moments.

MagneticOperations

A list of magnetic symmetry operations (rotation + translation + time reversal).

class moyopy.CollinearMagneticCell(basis: list[list[float]], positions: list[list[float]], numbers: list[int], magnetic_moments: list[float])#

A crystal structure with collinear magnetic moments.

as_dict() dict[str, Any]#

Convert this object to a dictionary.

property basis: list[list[float]]#

Row-wise basis vectors of the lattice.

classmethod deserialize_json(json_str: str) CollinearMagneticCell#

Deserialize an object from a JSON string.

classmethod from_dict(data: dict[str, Any]) CollinearMagneticCell#

Create an object from a dictionary.

property magnetic_moments: list[float]#

Scalar magnetic moment of each site.

property num_atoms: int#

Number of atoms in the magnetic cell.

property numbers: list[int]#

Atomic number of each site.

property positions: list[list[float]]#

Fractional coordinates of each site.

serialize_json() str#

Serialize this object to a JSON string.

class moyopy.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.

as_dict() dict[str, Any]#

Convert this object to a dictionary.

property basis: list[list[float]]#

Row-wise basis vectors of the lattice.

classmethod deserialize_json(json_str: str) NonCollinearMagneticCell#

Deserialize an object from a JSON string.

classmethod from_dict(data: dict[str, Any]) NonCollinearMagneticCell#

Create an object from a dictionary.

property magnetic_moments: list[list[float]]#

Three-component magnetic moment vector of each site.

property num_atoms: int#

Number of atoms in the magnetic cell.

property numbers: list[int]#

Atomic number of each site.

property positions: list[list[float]]#

Fractional coordinates of each site.

serialize_json() str#

Serialize this object to a JSON string.

class moyopy.MagneticOperations#

A list of magnetic symmetry operations (rotation + translation + time reversal).

as_dict() dict[str, Any]#

Convert this object to a dictionary.

classmethod deserialize_json(json_str: str) MagneticOperations#

Deserialize an object from a JSON string.

classmethod from_dict(data: dict[str, Any]) MagneticOperations#

Create an object from a dictionary.

property num_operations: int#

Number of magnetic symmetry operations.

property rotations: list[list[list[float]]]#

Rotation parts of the magnetic symmetry operations.

serialize_json() str#

Serialize this object to a JSON string.

property time_reversals: list[bool]#

Time-reversal flag for each magnetic symmetry operation.

property translations: list[list[float]]#

Translation parts of the magnetic symmetry operations (fractional coordinates).

Symmetry datasets#

Run a symmetry analysis on a magnetic cell and inspect the result.

MoyoCollinearMagneticDataset

A dataset containing magnetic symmetry information of the input collinear magnetic

MoyoNonCollinearMagneticDataset

A dataset containing magnetic symmetry information of the input non-collinear magnetic

class moyopy.MoyoCollinearMagneticDataset(magnetic_cell: moyopy._base.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.

property angle_tolerance: float | None#

Actually used angle_tolerance in iterative symmetry search.

as_dict() dict[str, Any]#

Convert an object to a dictionary.

classmethod deserialize_json(json_str: str) Self#

Deserialize an object from a JSON string.

classmethod from_dict(obj: dict[str, Any]) Self#

Create an object from a dictionary.

property mag_symprec: float | None#

Actually used mag_symprec in iterative symmetry search.

property magnetic_operations: moyopy._base.MagneticOperations#

Magnetic symmetry operations in the input cell.

property mapping_std_prim: list[int]#

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.

property orbits: list[int]#

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.

property prim_std_linear: list[list[float]]#

Linear part of transformation from the input magnetic cell to the primitive standardized magnetic cell.

property prim_std_mag_cell: moyopy._base.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)
property prim_std_origin_shift: list[float]#

Origin shift of transformation from the input magnetic cell to the primitive standardized magnetic cell.

serialize_json() str#

Serialize an object to a JSON string.

property std_linear: list[list[float]]#

Linear part of transformation from the input magnetic cell to the standardized magnetic cell.

property std_mag_cell: moyopy._base.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.

property std_origin_shift: list[float]#

Origin shift of transformation from the input magnetic cell to the standardized magnetic cell.

property std_rotation_matrix: list[list[float]]#

Rigid rotation (orthogonal matrix) applied to the lattice basis.

property symprec: float#

Actually used symprec in iterative symmetry search.

property uni_number: int#

UNI number for magnetic space-group type.

class moyopy.MoyoNonCollinearMagneticDataset(magnetic_cell: moyopy._base.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.

property angle_tolerance: float | None#

Actually used angle_tolerance in iterative symmetry search.

as_dict() dict[str, Any]#

Convert an object to a dictionary.

classmethod deserialize_json(json_str: str) Self#

Deserialize an object from a JSON string.

classmethod from_dict(obj: dict[str, Any]) Self#

Create an object from a dictionary.

property mag_symprec: float | None#

Actually used mag_symprec in iterative symmetry search.

property magnetic_operations: moyopy._base.MagneticOperations#

Magnetic symmetry operations in the input cell.

property mapping_std_prim: list[int]#

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.

property orbits: list[int]#

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.

property prim_std_linear: list[list[float]]#

Linear part of transformation from the input magnetic cell to the primitive standardized magnetic cell.

property prim_std_mag_cell: moyopy._base.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)
property prim_std_origin_shift: list[float]#

Origin shift of transformation from the input magnetic cell to the primitive standardized magnetic cell.

serialize_json() str#

Serialize an object to a JSON string.

property std_linear: list[list[float]]#

Linear part of transformation from the input magnetic cell to the standardized magnetic cell.

property std_mag_cell: moyopy._base.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.

property std_origin_shift: list[float]#

Origin shift of transformation from the input magnetic cell to the standardized magnetic cell.

property std_rotation_matrix: list[list[float]]#

Rigid rotation (orthogonal matrix) applied to the lattice basis.

property symprec: float#

Actually used symprec in iterative symmetry search.

property uni_number: int#

UNI number for magnetic space-group type.

Crystallographic data#

Classification tables and helpers to fetch operations by UNI number.

MagneticSpaceGroupType

Magnetic space-group type information.

magnetic_operations_from_uni_number(...)

class moyopy.MagneticSpaceGroupType(uni_number: int)#

Magnetic space-group type information.

as_dict() dict[str, Any]#

Convert an object to a dictionary

property bns_number: str#

BNS number e.g. ‘151.32’

property construct_type: int#

Construct type of magnetic space group from 1 to 4.

property litvin_number: int#

Serial number in Litvin’s Magnetic group tables.

property number: int#

ITA number for reference space group in BNS setting.

property og_number: str#

OG number e.g. ‘153.4.1270’

serialize_json() str#

Serialize an object to a JSON string

property uni_number: int#

Serial number of UNI (and BNS) symbols.

moyopy.magnetic_operations_from_uni_number(uni_number: int, *, primitive: bool = False) moyopy._base.MagneticOperations#

Group identification#

Identify magnetic space groups from a primitive list of magnetic symmetry operations.

MagneticSpaceGroup

Magnetic space group identified from a list of primitive magnetic operations.

class moyopy.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.

as_dict() dict[str, Any]#

Convert this object to a dictionary.

property linear: list[list[int]]#

Linear part of the transformation from the input primitive basis to the standardized basis.

property origin_shift: list[float]#

Origin shift of the transformation from the input primitive basis to the standardized basis.

serialize_json() str#

Serialize this object to a JSON string.

property uni_number: int#

Serial number of UNI (and BNS) symbols.

Adapters#

Convert between moyopy.NonCollinearMagneticCell and pymatgen Structure / ASE Atoms. Requires the optional dependencies installed via pip install moyopy[interface].

class moyopy.interface.MoyoNonCollinearMagneticAdapter[source]#
static from_disordered_structure(structure: pymatgen.core.Structure) tuple[moyopy.NonCollinearMagneticCell, dict[int, pymatgen.core.Composition]][source]#

Convert a disordered pymatgen Structure with non-collinear magnetic moments to a Moyo NonCollinearMagneticCell.

Parameters:

structure (Structure) – A pymatgen Structure object, which may contain disordered sites. Must have non-collinear magnetic moments in site_properties[‘magmom’].

Returns:

  • magnetic_cell (moyopy.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.

static from_structure(structure: pymatgen.core.Structure) moyopy.NonCollinearMagneticCell[source]#

Convert a pymatgen Structure with non-collinear magnetic moments to a Moyo NonCollinearMagneticCell.

static get_structure(magnetic_cell: moyopy.NonCollinearMagneticCell, *, unique_species_mapping: dict[int, pymatgen.core.Composition] | None = None) pymatgen.core.Structure[source]#

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:
  • magnetic_cell (moyopy.NonCollinearMagneticCell) – The Moyo NonCollinearMagneticCell to convert.

  • 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.

Returns:

structure – The converted pymatgen Structure object with magnetic moments in site_properties[‘magmom’].

Return type:

Structure