shnitsel.io.pyrai2md.parse

Attributes

_int_pattern

_float_pattern

_double_whitespace_pattern

_colon_whitespace_pattern

_setting_name_pattern

_re_nac_header_line

_re_soc_line

Functions

parse_pyrai2md(traj_path[, loading_parameters])

Function to read a trajector of the PyrAI2md format.

parse_md_energies(path, trajectory_in)

Function to parse energy and time information into the provided trajectory.

read_pyrai2md_settings_from_log(f)

Function to read the settings from a pyrai2md log file.

parse_observables_from_log(f, trajectory_in)

Function to read multiple observables from a PyrAI2md log file.

Module Contents

_int_pattern
_float_pattern
_double_whitespace_pattern
_colon_whitespace_pattern
_setting_name_pattern
_re_nac_header_line
_re_soc_line
parse_pyrai2md(traj_path, loading_parameters=None)

Function to read a trajector of the PyrAI2md format.

Parameters:
  • pathlist (PathOptionsType) – Path to the directory containing a PyrAI2md output file list

  • loading_parameters (LoadingParameters | None, optional) – Parameter settings for e.g. standard units or state names.

  • traj_path (shnitsel.io.helpers.PathOptionsType)

Returns:

The Dataset object containing all of the loaded data in default shnitsel units

Return type:

xr.Dataset

parse_md_energies(path, trajectory_in)

Function to parse energy and time information into the provided trajectory.

Returns the number of discovered time steps and the resulting trajectory

Parameters:
  • path (pathlib.Path) – The path to a “*.md.energies” file.

  • trajectory_in (xr.Dataset) – The trajectory to store the data in

Returns:

The resulting state of the trajectory after reading and the number of time steps actually found in the data. Finally, the actual values of absolute time read from the energy file for each step

Return type:

Tuple[xr.Dataset, int, np.ndarray]

read_pyrai2md_settings_from_log(f)

Function to read the settings from a pyrai2md log file.

Parameters:

f (TextIOWrapper) – The input file stream.

Returns:

The resulting dictionary of settings

Return type:

Dict[str, Any]

parse_observables_from_log(f, trajectory_in)

Function to read multiple observables from a PyrAI2md log file.

Returns the trajectory with added observables data. To calculate the NACs accurately, the trajectory requires state-energy data to be set so that we can renormalize the NACs data with energy deltas.

Parameters:
  • f (TextIOWrapper) – The file input stream from which the log is read

  • trajectory_in (xr.Dataset) – The initial trajectory state

Raises:
  • ValueError – If no state information could be read from an iteration’s output in a frame

  • ValueError – Number of steps could not be read from the trajectory input

  • ValueError – Multiple end messages found in log.

Returns:

The updated trajectory and the true final time step seen in the log

Return type:

Tuple[xr.Dataset,int]