castep_outputs.tools.md_geom_parser#
Lazy MD/Geom parser object.
Classes
|
Lazy MD/Geom parser. |
- class castep_outputs.tools.md_geom_parser.MDGeomParser(md_geom_file)[source]#
Bases:
objectLazy MD/Geom parser.
Implements iterator and getitem approaches for lazily navigating .md/.geom files.
- Parameters:
md_geom_file (Path | str) – File to parse.
- __getitem__(frame)[source]#
- __getitem__(frames)
- __getitem__(frames)
- __getitem__(frame: int) MDGeomTimestepInfo
- __getitem__(frame: Iterable | slice) list[MDGeomTimestepInfo]
Get particular frame of md/geom.
- Parameters:
frame – Frame(s) to extract.
- Returns:
Requested frames.
- __iter__()[source]#
Get generator over all frames in system.
Jumps permitted through
send.- Yields:
MDGeomTimestepInfo – Information about each frame.
- Return type:
Generator[MDGeomTimestepInfo, int, None]
- get_frame(frame)[source]#
Get particular frame of md/geom.
- Parameters:
frame (int) – Frame to retrieve.
- Returns:
Parsed frame.
- Raises:
IndexError – Requested frame out of range.
- Return type:
- read_next()[source]#
Get the next frame.
- Returns:
Information about the next frame.
- Raises:
StopIteration – No next frame.
- Return type:
- property next_frame: int | None#
Get index of next frame to be read, or None if at file end.