shnitsel.io.ase

Submodules

Functions

read_ase(db_path[, db_format, loading_parameters])

Reads an ASE DB containing data in the SPaiNN or SchNet format

write_ase_db(traj, db_path, db_format[, ...])

Function to write a Dataset into a ASE db in either SchNet or SPaiNN format.

Package Contents

read_ase(db_path, db_format=None, loading_parameters=None)

Reads an ASE DB containing data in the SPaiNN or SchNet format

Parameters:
  • db_path (pathlib.Path) – Path to the database

  • db_format (Literal['spainn', 'schnet'] | None, optional) – Must be one of ‘spainn’ or ‘schnet’ or None; determines interpretation of array shapes If None is provided, no shape will be assumed

  • loading_parameters (LoadingParameters) – Potentially configured parameters to overwrite loading behavior

Return type:

An xr.Dataset of frames

Raises:
  • ValueError – If db_format is not one of ‘spainn’ or ‘schnet’

  • FileNotFoundError – If db_path is not a file

  • ValueError – If db_path does not contain data corresponding to the format db_format

write_ase_db(traj, db_path, db_format, keys_to_write=None, preprocess=True)

Function to write a Dataset into a ASE db in either SchNet or SPaiNN format.

Parameters:
  • traj (Trajectory) – The Dataset to be written to an ASE db style database

  • db_path (str) – Path to write the database to

  • db_format (Literal["schnet", "spainn";] | None) – Format of the target database. Used to control order of dimensions in data arrays. Can be either “schnet” or “spainn”.

  • keys_to_write (Collection | None, optional) – Optional parameter to restrict which data variables to . Defaults to None.

  • preprocess (bool, optional) – _description_. Defaults to True.

Raises:
  • ValueError – If neither frame nor time dimension is present on the dataset.

  • ValueError – If the db_format is neither schnet, spainn nor None

Notes

See https://spainn-md.readthedocs.io/en/latest/userguide/data_pipeline.html#generate-a-spainn-database for details on SPaiNN format.