AtomRelaxTrajectory
- class emmet.core.trajectory.AtomRelaxTrajectory(**data)
Bases:
BaseModelAtomistic only, low-memory schema for relaxation trajectories that can interface with parquet, pymatgen, and ASE.
- Parameters:
elements (list[int])
cart_coords (list[list[tuple[float, float, float]] | None])
num_ionic_steps (int)
lattice (list[tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]]] | None)
energy (list[float] | None)
forces (list[list[tuple[float, float, float]]] | None)
stress (list[tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]]] | None)
ionic_step_properties (set[str])
- property ionic_step_properties_used: set[str]
Return list of populated fields.
- static reorder_sites(structure, ref_z)
Ensure that the sites in a structure match the order in a set of reference Z values.
Quick returns if the structure already matches the reference order.
- Return type:
tuple[Structure|Molecule,list[int],bool]- Parameters:
structure (Structure | Molecule)
ref_z (list[int])
Parameters
- structurepymatgen .Structure or .Molecule
Structure or Molecule to order sites in
- ref_zlist of int
List of proton numbers / Z values in the reference structure.
Returns
pymatgen .Structure or .Molecule : structure matching the reference order of sites list of int : indices in the original structure which are reordered bool : Whether the order changed
- classmethod from_pmg(traj, **kwargs)
Create a trajectory from a pymatgen .Trajectory.
- Return type:
Self- Parameters:
traj (Trajectory)
Parameters
traj : pymatgen.core.trajectory.Trajectory constant_lattice : bool (default = False)
Whether the lattice is constant thoughout the trajectory
- lattice_match_tolfloat or None (default = 1e-6)
If a float and constant_lattice is False, this defines the tolerance for determining if the lattice has changed during the course of the trajectory. If None, no check is performed.
Returns
Trajectory
- to_arrow(file_name=None, **write_file_kwargs)
Create a PyArrow Table from a Trajectory.
- Return type:
Table- Parameters:
file_name (str | Path | None)
Parameters
- file_namestr, .Path, or None (default)
If not None, a file to write the parquet-format output to. Accepts any compression extension used by pyarrow.write_table
- **write_file_kwargs
If file_name is not None, any kwargs to pass to pyarrow.parquet.write_file
Returns
pyarrow.Table
- classmethod from_arrow(pa_table, identifier=None)
Create a trajectory from an arrow Table.
- Return type:
Self- Parameters:
pa_table (Table)
identifier (str | None)
Parameters
- file_namestr or .Path
The parquet file to read from
- identifierstr or None (default)
If not None, the identifier of the trajectory to return from a dataset of multiple trajectories.
Returns
Trajectory
- classmethod from_parquet(file_name, identifier=None)
Create a Trajectory from a parquet file.
- Return type:
Self- Parameters:
file_name (str | Path)
identifier (str | None)
Parameters
- file_namestr | Path
Path to the parquet file. Can be a remote path, e.g. AWS.
- identifierstr | None = None
The string identifier for the task.
- to_pmg(frame_props=None, indices=None)
Create a pymatgen Trajectory.
- Return type:
Trajectory- Parameters:
frame_props (Iterable[str] | None)
indices (int | slice | Iterable[int] | None)
Parameters
- frame_propsSequence of str or None (default)
If not None, a list of model fields to populate the frame properties of the pymatgen Trajectory with. If None, defaults to all available fields. If an empty iterable, no frame properties will be returned.
- indicesint, slice, iterable of int, or None
If None (default), returns all frames If an int, the index of the frame to return If a slice, returns that range of frames If an iterable of int, returns those specific frames
Frames are always returned in sequential order, even if the user-supplied indices are unsorted.
Returns
pymatgen.core.trajectory.Trajectory
- to(file_name=None, fmt=None, **kwargs)
Generic interface to multiple trajectory formats.
- file_namestr, .Path, or None (default)
If not None, the name of the file to write to. If fmt is None, the file format will be inferred from this.
- fmtTrajFormat, str, or None (default)
The format of the output trajectory. If file_name is None, and fmt is None, defaults to a parquet-compatible PyArrow table.
- **kwargs
Any kwargs supported by Trajectory.to_* methods.
- Parameters:
file_name (str | Path | None)
fmt (TrajFormat | str | None)
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].