API Reference#
The public API mirrors the Rust crate layout: base (crystal structures and
operation containers), dataset (symmetry analysis results), data
(crystallographic classification tables), and identify (group identification
primitives). The moyopy.interface adapters provide conversion
helpers to/from pymatgen and ASE.
This page documents the core types and the space-group API. Layer-group and magnetic-space-group APIs live on additional pages:
Core types#
Lattice + sites, the non-magnetic operation container, and the unimodular transformation type used across all group families.
A crystal structure: a lattice plus fractional positions and atomic numbers. |
|
A list of crystallographic symmetry operations (rotation + translation). |
|
A unimodular transformation: an integer linear part with determinant +-1 plus an |
- class moyopy.Cell(basis: list[list[float]], positions: list[list[float]], numbers: list[int])#
A crystal structure: a lattice plus fractional positions and atomic numbers.
- as_dict() dict[str, Any]#
Convert this object to a dictionary.
- property basis: list[list[float]]#
Row-wise basis vectors of the lattice.
- property num_atoms: int#
Number of atoms in the 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.Operations#
A list of crystallographic symmetry operations (rotation + translation).
- as_dict() dict[str, Any]#
Convert this object to a dictionary.
- classmethod deserialize_json(json_str: str) Operations#
Deserialize an object from a JSON string.
- classmethod from_dict(data: dict[str, Any]) Operations#
Create an object from a dictionary.
- property num_operations: int#
Number of symmetry operations.
- property rotations: list[list[list[float]]]#
Rotation parts of the symmetry operations.
- serialize_json() str#
Serialize this object to a JSON string.
- property translations: list[list[float]]#
Translation parts of the symmetry operations (fractional coordinates).
- class moyopy.UnimodularTransformation#
A unimodular transformation: an integer linear part with determinant +-1 plus an origin shift.
- as_dict() dict[str, Any]#
Convert this object to a dictionary.
- property linear: list[list[int]]#
Linear part (integer 3x3 matrix with determinant +-1).
- property origin_shift: list[float]#
Origin shift (fractional coordinates).
- serialize_json() str#
Serialize this object to a JSON string.
Symmetry datasets#
Run a symmetry analysis on a moyopy.Cell and inspect the result.
A dataset containing symmetry information of the input crystal structure. |
- class moyopy.MoyoDataset(cell: moyopy._base.Cell, *, symprec: float = 0.0001, angle_tolerance: float | None = None, setting: moyopy._data.Setting | None = None, rotate_basis: bool = True)#
A dataset containing symmetry information of the input crystal structure.
- property angle_tolerance: float | None#
Actually used
angle_tolerancein 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 hall_number: int#
Hall symbol number.
- property mapping_std_prim: list[int]#
Mapping sites in the input cell to those in the primitive standardized cell.
The
i-th atom in the input cell is mapped to themapping_to_std_prim[i]-th atom in the primitive standardized cell.
- property number: int#
Space group number.
- property operations: moyopy._base.Operations#
Symmetry operations in the input cell.
- property orbits: list[int]#
Spglib’s
crystallographic_orbitsnotequivalent_atoms.The
i-th atom in the input cell is equivalent to theorbits[i]-th atom in the input 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 pearson_symbol: str#
Pearson symbol for standardized cell.
- property prim_std_cell: moyopy._base.Cell#
Primitive standardized cell.
Same transformation convention as the standardized cell above:
prim_std_cell.basis.T = std_rotation_matrix @ cell.basis.T @ prim_std_linear x_prim_std = np.linalg.inv(prim_std_linear) @ (x_input - prim_std_origin_shift)
- property prim_std_linear: list[list[float]]#
Linear part of transformation from the input cell to the primitive standardized cell.
- property prim_std_origin_shift: list[float]#
Origin shift of transformation from the input cell to the primitive standardized cell.
- serialize_json() str#
Serialize an object to a JSON string.
- property site_symmetry_symbols: list[str]#
Site symmetry symbols for each site in the input cell.
The orientation of the site symmetry is w.r.t. the standardized cell.
- property std_cell: moyopy._base.Cell#
Standardized cell.
The input cell is related to the standardized cell by
(std_linear, std_origin_shift)andstd_rotation_matrix:Lattice:
std_cell.basis.T = std_rotation_matrix @ cell.basis.T @ std_linear
Fractional positions:
x_std = np.linalg.inv(std_linear) @ (x_input - std_origin_shift)
std_rotation_matrixis a rigid rotation (orthogonal matrix) applied only to the Cartesian lattice basis. It does not affect fractional coordinates.
- property std_linear: list[list[float]]#
Linear part of transformation from the input cell to the standardized cell.
- property std_origin_shift: list[float]#
Origin shift of transformation from the input cell to the standardized cell.
- property std_rotation_matrix: list[list[float]]#
Rigid rotation (orthogonal matrix) applied to the lattice basis.
- property symprec: float#
Actually used
symprecin iterative symmetry search.
- property wyckoffs: list[str]#
Wyckoff letters for each site in the input cell.
Crystallographic data#
Hall symbols, settings, centering, classification tables, and helpers to fetch operations by ITA number.
Preference for the setting of the space group. |
|
An entry containing space-group information for a specified hall_number. |
|
Space-group type information. |
|
Arithmetic crystal class information. |
|
|
- class moyopy.Setting#
Preference for the setting of the space group.
- as_dict() dict[str, Any]#
Convert an object to a dictionary
- serialize_json() str#
Serialize an object to a JSON string
- class moyopy.Centering#
- as_dict() dict[str, Any]#
Convert an object to a dictionary
- property lattice_points: list[list[float]]#
Unique lattice points.
- property linear: list[list[int]]#
Transformation matrix.
- property order: int#
Order of the centering.
- serialize_json() str#
Serialize an object to a JSON string
- class moyopy.HallSymbolEntry(hall_number: int)#
An entry containing space-group information for a specified hall_number.
- property arithmetic_number: int#
Number for arithmetic crystal classes (1 - 73).
- as_dict() dict[str, Any]#
Convert an object to a dictionary
- property hall_number: int#
Number for Hall symbols (1 - 530).
- property hall_symbol: str#
Hall symbol.
- property hm_full: str#
Hermann-Mauguin symbol in full notation.
- property hm_short: str#
Hermann-Mauguin symbol in short notation.
- property number: int#
ITA number for space group types (1 - 230).
- serialize_json() str#
Serialize an object to a JSON string
- class moyopy.SpaceGroupType(number: int)#
Space-group type information.
- property arithmetic_number: int#
Number for arithmetic crystal classes (1 - 73).
- property arithmetic_symbol: str#
Symbol for arithmetic crystal class.
See spglib/moyo for string values.
- as_dict() dict[str, Any]#
Convert an object to a dictionary
- property bravais_class: str#
Bravais class.
See spglib/moyo for string values.
- property crystal_family: str#
Crystal family.
See spglib/moyo for string values.
- property crystal_system: str#
Crystal system.
See spglib/moyo for string values.
- property geometric_crystal_class: str#
Geometric crystal class.
See spglib/moyo for string values.
- property hm_full: str#
Hermann-Mauguin symbol in full notation.
- property hm_short: str#
Hermann-Mauguin symbol in short notation.
- property lattice_system: str#
Lattice system.
See spglib/moyo for string values.
- property number: int#
ITA number for space group types (1 - 230).
- serialize_json() str#
Serialize an object to a JSON string
- class moyopy.ArithmeticCrystalClass(arithmetic_number: int)#
Arithmetic crystal class information.
- property arithmetic_number: int#
Number for arithmetic crystal classes (1 - 73).
- property arithmetic_symbol: str#
Symbol for arithmetic crystal class.
- as_dict() dict[str, Any]#
Convert an object to a dictionary
- property bravais_class: str#
Bravais class.
- property geometric_crystal_class: str#
Geometric crystal class.
- serialize_json() str#
Serialize an object to a JSON string
Group identification#
Identify point groups and space groups from a primitive list of symmetry operations.
Point group identified from a list of rotation matrices. |
|
Space group identified from a list of primitive symmetry operations. |
|
|
Compute the integral normalizer of a space group. |
- class moyopy.PointGroup(prim_rotations: list[list[int]], *, basis: list[list[float]] | None = None)#
Point group identified from a list of rotation matrices.
- property arithmetic_number: int#
Number for the arithmetic crystal class (1 - 73).
- as_dict() dict[str, Any]#
Convert this object to a dictionary.
- property prim_trans_mat: list[list[int]]#
Transformation matrix from the input primitive basis to the standardized basis.
- serialize_json() str#
Serialize this object to a JSON string.
- class moyopy.SpaceGroup(prim_rotations: list[list[int]], prim_translations: list[list[float]], *, basis: list[list[float]] | None = None, setting: moyopy._data.Setting | None = None, epsilon: float = 0.0001)#
Space group identified from a list of primitive symmetry operations.
- as_dict() dict[str, Any]#
Convert this object to a dictionary.
- property hall_number: int#
Hall symbol number (1 - 530) for the chosen setting.
- property linear: list[list[int]]#
Linear part of the transformation from the input primitive basis to the standardized basis.
- property number: int#
ITA number for the identified space group (1 - 230).
- 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.
- moyopy.integral_normalizer(prim_rotations: list[list[list[int]]], prim_translations: list[list[float]], *, prim_generators: list[int] | None = None, epsilon: float = 0.0001) list[moyopy._base.UnimodularTransformation]#
Compute the integral normalizer of a space group.
Returns the unimodular transformations that conjugate the given space group into itself.
- Parameters:
prim_rotations (list[list[list[int]]]) – Rotation matrices of the symmetry operations of the primitive cell.
prim_translations (list[list[float]]) – Translation vectors of the symmetry operations of the primitive cell.
prim_generators (list[int] | None) – Optional indices of operations to use as generators. If
None, a small generating set is derived automatically.epsilon (float) – Numerical tolerance for matching translations.
Adapters#
Convert between moyopy.Cell and pymatgen Structure / ASE
Atoms. Requires the optional dependencies installed via
pip install moyopy[interface]. The magnetic counterpart
moyopy.interface.MoyoNonCollinearMagneticAdapter lives on the
Magnetic Space Group page.
- class moyopy.interface.MoyoAdapter[source]#
- static from_atoms(atoms: ase.Atoms) moyopy.Cell[source]#
- static from_disordered_structure(structure: pymatgen.core.Structure) tuple[moyopy.Cell, dict[int, pymatgen.core.Composition]][source]#
Convert a disordered pymatgen Structure to a Moyo Cell.
- Parameters:
structure (Structure) – A pymatgen Structure object, which may contain disordered sites.
- Returns:
cell (moyopy.Cell) – The converted Moyo Cell object.
unique_species_mapping (dict[int, Composition]) – A mapping from integer indices used in the Moyo Cell to the original pymatgen SpeciesLike objects.
- static from_py_obj(struct: pymatgen.core.Structure | ase.Atoms | pymatgen.io.ase.MSONAtoms) moyopy.Cell[source]#
Convert a Python atomic structure object to a Moyo Cell.
- Parameters:
struct – Currently supports pymatgen Structure, ASE Atoms, and MSONAtoms
- Returns:
The converted Moyo cell
- Return type:
- static from_structure(structure: pymatgen.core.Structure) moyopy.Cell[source]#
Convert a pymatgen Structure to a Moyo Cell.
- static get_atoms(cell: moyopy.Cell) ase.Atoms[source]#
- static get_structure(cell: moyopy.Cell, *, unique_species_mapping: dict[int, pymatgen.core.Composition] | None = None) pymatgen.core.Structure[source]#
Convert a Moyo Cell to a pymatgen Structure.
If the Cell was created from a disordered Structure, the unique_species_mapping should be provided to reconstruct the original species.
- Parameters:
cell (moyopy.Cell) – The Moyo Cell to convert.
unique_species_mapping (dict[int, Composition] | None) – A mapping from integer indices used in the Moyo Cell to the original pymatgen SpeciesLike objects. If None, assumes the Cell was created from an ordered Structure.
- Returns:
structure – The converted pymatgen Structure object.
- Return type:
Structure