pymatgen/structure format#
Aliases#
pymatgen/structure
Implementation: PyMatgenStructureFormat
Overview#
In-memory pymatgen Structure objects for periodic systems.
pymatgen (Python Materials Genomics) is a robust, open-source Python library for materials analysis.
This adapter converts without writing a file and requires the optional pymatgen dependency. Writing a multi-frame System returns one Structure object per frame.
Quick examples#
The examples use the preferred alias pymatgen/structure; any alias listed above is equivalent.
import dpdata
from pymatgen.core import Lattice, Structure
structure = Structure(
Lattice.cubic(1.0), ["H"], [[0.0, 0.0, 0.0]]
)
# Geometry-only data
system = dpdata.System(structure, fmt="pymatgen/structure")
# Write geometry-only data
converted = system.to("pymatgen/structure")
Conversions#
Convert from this format to System#
- dpdata.System(structure, fmt: Literal['pymatgen/structure'] = None, **kwargs) dpdata.system.System
- dpdata.System.from_pymatgen_structure(structure, **kwargs) dpdata.system.System
Convert pymatgen.core.Structure to System.
- Parameters:
- structurepymatgen.core.Structure
a Pymatgen Structure, containing a structure
- **kwargsdict
other parameters
- Returns:
- System
converted system
Convert from System to this format#
- dpdata.System.to(fmt: Literal['pymatgen/structure'], **kwargs)
- dpdata.System.to_pymatgen_structure(**kwargs)
Convert System frames to pymatgen Structure objects.
- Parameters:
- **kwargsdict
Additional format arguments accepted for API compatibility.
- Returns:
- list[pymatgen.core.Structure]
One structure per frame.
Convert from LabeledSystem to this format#
- dpdata.LabeledSystem.to(fmt: Literal['pymatgen/structure'], **kwargs)
- dpdata.LabeledSystem.to_pymatgen_structure(**kwargs)
Convert System frames to pymatgen Structure objects.
- Parameters:
- **kwargsdict
Additional format arguments accepted for API compatibility.
- Returns:
- list[pymatgen.core.Structure]
One structure per frame.