httk.atomistic.integrations.pymatgen.models

Pymatgen interoperability without importing the optional dependency.

Classes

PymatgenStructureProtocol

The three native attributes that identify a pymatgen structure.

PymatgenStructure

Import a pymatgen-compatible structure eagerly.

Module Contents

class httk.atomistic.integrations.pymatgen.models.PymatgenStructureProtocol[source]

Bases: Protocol

The three native attributes that identify a pymatgen structure.

lattice supplies the cell and periodicity, frac_coords supplies the reduced coordinates, and species_and_occu supplies one per-site composition mapping. This small surface is disjoint from ASE Atoms and httk structure objects while allowing pymatgen-compatible duck-typed inputs without importing pymatgen.

lattice: Any[source]
frac_coords: Any[source]
species_and_occu: Any[source]
class httk.atomistic.integrations.pymatgen.models.PymatgenStructure(obj, **hints)[source]

Bases: httk.atomistic.models.structure.backend.StructureBackend

Import a pymatgen-compatible structure eagerly.

Pymatgen properties, site labels, and site properties other than magmom are intentionally discarded because they have no exact httk structure-family counterpart. Pymatgen DummySpecies values with the default zero oxidation state are imported with an unstated charge because pymatgen cannot distinguish that default from an explicitly supplied zero; nonzero dummy oxidation states remain exact charges.

Partial occupancy and its exact Fraction values are retained. An occupancy shortfall becomes an explicit vacancy constituent, which views omit when exporting to pymatgen. The original object remains available through unwrap().

Parameters:
  • obj (PymatgenStructureProtocol) – A pymatgen Structure object or compatible duck-typed object.

  • **hints (Any) – Backend-selection hints.

kind: ClassVar[str] = 'pymatgen'[source]
property cell: httk.atomistic.models.cell.cell.Cell[source]

Return the converted cell and periodicity.

property sites: httk.atomistic.models.sites.sites.Sites[source]

Return the converted reduced coordinates.

property species: tuple[httk.atomistic.models.species.species.Species, Ellipsis][source]

Return the imported distinct species and occupancies.

property species_at_sites: tuple[str, Ellipsis][source]

Return the imported species name at each site.

property site_moments: Any[source]

Return imported collinear or Cartesian site moments, if present.

property charge: fractions.Fraction | None[source]

Return the exact structure charge, or None when unstated.

unwrap()[source]

Return the original pymatgen-compatible object.