shnitsel

Submodules

Functions

write_shnitsel_file(dataset, savepath[, complevel])

Function to write a trajectory in Shnitsel format (xr.) to a ntcdf hdf5 file 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

write_shnitsel_file(dataset, savepath, complevel=9)

Function to write a trajectory in Shnitsel format (xr.) to a ntcdf hdf5 file format.

Strips all internal attributes first to avoid errors during writing. When writing directly with to_netcdf, errors might occur due to internally set attributes with problematic types.

Parameters:
  • dataset (xr.Dataset | Trajectory | ShnitselDB) – The dataset or trajectory to write (omit if using accessor).

  • savepath (PathOptionsType) – The path at which to save the trajectory file.

  • complevel (int, optional) – The compression level to apply during saving.

Returns:

Returns the result of the final call to xr.Dataset.to_netcdf() or xr.DataTree.to_netcdf()

Return type:

Unknown

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.