Skip to content

dft.periodic_phonon_persistence

Portable no-pickle persistence for periodic phonon force samples.

import mlx_atomistic.dft.periodic_phonon_persistence

def read_periodic_phonon_samples(path: str | Path, plan: PeriodicDisplacementPlan) -> PeriodicPhononSampleSet

Load and validate a no-pickle periodic phonon sample collection.

Parameters

NameTypeDefaultDescription
pathstr | PathExisting sample NPZ path.
planPeriodicDisplacementPlanExact displacement plan expected by the artifact.

Returns

  • PeriodicPhononSampleSet — Immutable partial or complete central-force sample collection.

Raises

  • TypeError — If plan has an unsupported type.
  • ValueError — If schema, inventory, dtypes, shapes, values, or identity are invalid.
def write_periodic_phonon_samples(path: str | Path, plan: PeriodicDisplacementPlan, samples: PeriodicPhononSampleSet) -> Path

Atomically publish a partial or complete phonon sample collection.

Parameters

NameTypeDefaultDescription
pathstr | PathPreviously absent destination NPZ path.
planPeriodicDisplacementPlanExact displacement plan bound by samples.
samplesPeriodicPhononSampleSetImmutable central-force sample collection.

Returns

  • Path — Resolved published path.

Raises

  • FileExistsError — If the destination already exists.
  • TypeError — If plan or samples use unsupported types.
  • ValueError — If sample and plan identities differ.