{"id":8330,"library":"moyopy","title":"moyopy","description":"moyopy is a Python binding for the moyo library, a fast and robust crystal symmetry finder written in Rust. It provides functionalities for crystallographic analysis, including space group determination and primitive cell finding. The library is actively maintained, with a current version of 0.7.9, and requires Python 3.10 or newer. New releases appear with an active cadence.","status":"active","version":"0.7.9","language":"en","source_language":"en","source_url":"https://github.com/spglib/moyo/tree/main/moyopy","tags":["materials science","crystallography","symmetry","solid state physics","rust binding"],"install":[{"cmd":"pip install moyopy","lang":"bash","label":"Basic installation"},{"cmd":"pip install moyopy[interface]","lang":"bash","label":"With Pymatgen/ASE interfaces"}],"dependencies":[{"reason":"Required for type hints and compatibility.","package":"typing-extensions","optional":false},{"reason":"Optional dependency for converting structures to Pymatgen objects or utilizing Pymatgen's symmetry analysis methods that can leverage moyopy as a backend.","package":"pymatgen","optional":true},{"reason":"Optional dependency for converting structures to ASE objects.","package":"ase","optional":true}],"imports":[{"note":"The primary symmetry analysis function `get_symmetry_dataset` is exposed directly under the top-level `moyopy` package, not in a nested `moyo` submodule.","wrong":"import moyopy.moyo","symbol":"get_symmetry_dataset","correct":"from moyopy import get_symmetry_dataset"}],"quickstart":{"code":"import numpy as np\nfrom moyopy import get_symmetry_dataset\n\n# Define crystal structure (lattice, positions, numbers)\n# Example: Diamond cubic silicon\nlattice = np.array([\n    [0, 2.735, 2.735],\n    [2.735, 0, 2.735],\n    [2.735, 2.735, 0]\n])\npositions = np.array([\n    [0.0, 0.0, 0.0],\n    [0.25, 0.25, 0.25]\n])\nnumbers = [14, 14] # Atomic numbers for Si\n\ncell = (lattice, positions, numbers)\n\nsymprec = 1e-5 # Symmetry precision in Angstrom\nangle_tolerance = 1.0 # Angle tolerance in degrees\n\ndataset = get_symmetry_dataset(cell, symprec=symprec, angle_tolerance=angle_tolerance)\n\nprint(f\"Space group number: {dataset['number']}\")\nprint(f\"International symbol: {dataset['international']}\")\nprint(f\"Hall symbol: {dataset['hall']}\")\n# print(f\"Rotations: {dataset['rotations']}\")\n# print(f\"Translations: {dataset['translations']}\")","lang":"python","description":"This quickstart demonstrates how to define a simple crystal structure and use `moyopy.get_symmetry_dataset` to obtain its symmetry properties, including the space group number, international symbol, and Hall symbol. The structure is provided as a tuple `(lattice, positions, numbers)`."},"warnings":[{"fix":"Upgrade Python to 3.10 or a later supported version (e.g., `pyenv install 3.10.10`, `conda install python=3.10`).","message":"moyopy versions 0.6.1 and later dropped support for Python 3.9. Users on Python 3.9 must upgrade their Python environment to 3.10 or newer.","severity":"breaking","affected_versions":">=0.6.1"},{"fix":"Review your code for any assumptions about the standardization output. If specific standardization behavior is required, consult moyopy documentation for available flags or methods to control standardization.","message":"The default setting for crystal standardization in moyo-core (which moyopy binds to) changed to International Tables for Crystallography (ITA) standard. This may affect the output of standardized cells compared to previous versions.","severity":"breaking","affected_versions":">=0.6.1"},{"fix":"If relying on `prim_std_cell.basis` or comparing results with `spglib`, implement explicit checks or re-ordering of lattice vectors. Consider applying constraints like a < b < c for cell parameters if needed for a specific standardization convention.","message":"There can be differences in lattice vector ordering between the underlying Rust moyo-core and its Python bindings (moyopy), which may lead to discrepancies in `prim_std_cell.basis` results compared to other symmetry libraries like spglib. This often necessitates additional explicit ordering constraints for consistent results in downstream applications.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install moyopy` to install the package.","cause":"The moyopy library is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'moyopy'"},{"fix":"Import the relevant function directly, e.g., `from moyopy import get_symmetry_dataset`.","cause":"Attempting to import a non-existent class or accessing functionality through an incorrect path. `moyopy` directly exposes functions like `get_symmetry_dataset` at its top level, rather than through a main class like `Moyo` or `SpaceGroupAnalyzer` as seen in other libraries.","error":"AttributeError: module 'moyopy' has no attribute 'Moyo' (or 'SpaceGroupAnalyzer')"},{"fix":"Ensure that `cell` is a tuple where `lattice` is a 3x3 array (float), `positions` is an Nx3 array (float, fractional coordinates), and `numbers` is a list of N integers.","cause":"The input structure `cell` passed to `get_symmetry_dataset` (or similar functions) does not adhere to the expected `(lattice, positions, numbers)` tuple format.","error":"ValueError: Invalid cell format. The cell must be a tuple of (lattice, positions, numbers)."}]}