pymatgen/molecule format#

Aliases#

pymatgen/molecule

Implementation: PyMatgenMoleculeFormat

Overview#

In-memory pymatgen Molecule objects for nonperiodic systems.

pymatgen (Python Materials Genomics) is a robust, open-source Python library for materials analysis.

Periodic boundary conditions are removed during conversion. The optional pymatgen dependency is required, and writing returns one Molecule object per frame.

Quick examples#

The examples use the preferred alias pymatgen/molecule; any alias listed above is equivalent.

import dpdata

from pymatgen.core import Molecule

molecule = Molecule(["H"], [[0.0, 0.0, 0.0]])

# Geometry-only data
system = dpdata.System(molecule, fmt="pymatgen/molecule")

# Write geometry-only data
converted = system.to("pymatgen/molecule")

Conversions#

Convert from this format to System#

dpdata.System(file_name, fmt: Literal['pymatgen/molecule'] = None, **kwargs) → dpdata.system.System
dpdata.System.from_pymatgen_molecule(file_name, **kwargs) → dpdata.system.System

Convert a pymatgen Molecule into System data.

Parameters:
file_namepymatgen.core.Molecule

In-memory molecule to convert.

**kwargsdict

Additional format arguments accepted for API compatibility.

Returns:
System

converted system

Convert from System to this format#

dpdata.System.to(fmt: Literal['pymatgen/molecule'], **kwargs)
dpdata.System.to_pymatgen_molecule(**kwargs)

Convert System frames to pymatgen Molecule objects.

Parameters:
**kwargsdict

Additional format arguments accepted for API compatibility.

Returns:
list[pymatgen.core.Molecule]

One molecule per frame.

Convert from LabeledSystem to this format#

dpdata.LabeledSystem.to(fmt: Literal['pymatgen/molecule'], **kwargs)
dpdata.LabeledSystem.to_pymatgen_molecule(**kwargs)

Convert System frames to pymatgen Molecule objects.

Parameters:
**kwargsdict

Additional format arguments accepted for API compatibility.

Returns:
list[pymatgen.core.Molecule]

One molecule per frame.