shnitsel.core

Submodules

Functions

open_frames(path)

Opens a NetCDF4 file saved by shnitsel-tools, specially interpreting certain attributes.

save_frames(frames, path[, complevel])

Save a Dataset, presumably (but not necessarily) consisting of frames of trajectories, to a file at path.

dihedral(atXYZ, i, j, k, l, *[, deg, full])

Calculate all dihedral angles between the atoms specified.

get_per_state(frames)

get_inter_state(frames)

assign_fosc(ds)

spectra_all_times(inter_state)

Package Contents

open_frames(path)

Opens a NetCDF4 file saved by shnitsel-tools, specially interpreting certain attributes.

Parameters:

path – The path of the file to open.

Return type:

An xarray.Dataset with any MultiIndex restored.

Raises:
  • FileNotFoundError – If there is is nothing at path, or path is not a file.

  • ValueError (or other exception) – Raised by the underlying h5netcdf engine if the file is corrupted.

save_frames(frames, path, complevel=9)

Save a Dataset, presumably (but not necessarily) consisting of frames of trajectories, to a file at path.

Parameters:
  • accessor) (frames (omit if using) – The Dataset to save

  • path – The path at which to save it

  • complevel – The level of gzip compression which will be applied to all variables in the Dataset, by default 9

  • optional – The level of gzip compression which will be applied to all variables in the Dataset, by default 9

Notes

This function/accessor method wraps xarray.Dataset.to_netcdf() but not numpy.any().

dihedral(atXYZ, i, j, k, l, *, deg=False, full=False)

Calculate all dihedral angles between the atoms specified. The atoms specified needed be bonded.

Parameters:
  • atXYZ (AtXYZ) – A DataArray of coordinates, with atom and direction dimensions

  • i (int) – The four atom indices

  • j (int) – The four atom indices

  • k (int) – The four atom indices

  • l (int) – The four atom indices

  • deg (bool) – Whether to return angles in degrees (True) or radians (False), by default False

  • full (bool) – Whether to return signed angles between -180° and 180° (True) or unsigned angles between 0 and 180° (False), by default False

Return type:

A DataArray containing dihedral angles

get_per_state(frames)
Parameters:

frames (Frames)

Return type:

PerState

get_inter_state(frames)
Parameters:

frames (Frames)

Return type:

InterState

assign_fosc(ds)
Parameters:

ds (xarray.Dataset)

Return type:

xarray.Dataset

spectra_all_times(inter_state)
Parameters:

inter_state (xarray.Dataset)