shnitsel.io.newtonx.format_reader

Attributes

_newtonx_default_pattern_regex

_newtonx_default_pattern_glob

Classes

NewtonXFormatInformation

Information to keep track of relevant information for

NewtonXFormatReader

Class for providing the NewtonX format reading functionality in the standardized FormatReader interface

Module Contents

class NewtonXFormatInformation

Bases: shnitsel.io.format_reader_base.FormatInformation

Information to keep track of relevant information for

nx_log_path: pathlib.Path | None = None
positions_file_path: pathlib.Path | None = None
_newtonx_default_pattern_regex
_newtonx_default_pattern_glob = 'TRAJ*'
class NewtonXFormatReader

Bases: shnitsel.io.format_reader_base.FormatReader

Class for providing the NewtonX format reading functionality in the standardized FormatReader interface

find_candidates_in_directory(path)

Function to return a all potential matches for the current file format within a provided directory at path.

Returns:

A list of paths that should be checked in detail for whether they represent the format of this FormatReader. None: No potential candidate found

Return type:

List[PathOptionsType]

Parameters:

path (shnitsel.io.helpers.PathOptionsType)

check_path_for_format_info(path, hints_or_settings=None)

Check if the path is a SHARC-style output directory.

Designed for a single input trajectory.

Parameters:
  • path (PathOptionsType) – The path to check for SHARC data

  • hints_or_settings (Dict) – Configuration options provided to the reader by the user

Raises:
Returns:

_description_

Return type:

FormatInformation

read_from_path(path, format_info, loading_parameters=None)

Read a NewtonX-style trajcetory from path at path. Implements FormatReader.read_from_path()

Parameters:
  • path (pathlib.Path) – Path to a NewtonX-format directory.

  • format_info (FormatInformation) – Format information on the provided path that has been previously parsed.

  • loading_parameters (shnitsel.io.helpers.LoadingParameters | None) – (LoadingParameters|None, optional): Loading parameters to e.g. override default state names, units or configure the error reporting behavior

Raises:
  • ValueError – Not enough loading information was provided via path and format_info, e.g. if both are None.

  • FileNotFoundError – Path was not found or was not of appropriate NewtonX format

Returns:

The loaded Shnitsel-conforming trajectory

Return type:

Trajectory

get_units_with_defaults(unit_overrides=None)

Apply units to the default unit dictionary of the format NewtonX

Parameters:

unit_overrides (Dict[str, str] | None, optional) – Units denoted by the user to override format default settings. Defaults to None.

Raises:

NotImplementedError – The class does not provide this functionality yet

Returns:

The resulting, overridden default units

Return type:

Dict[str, str]