GROMACS Topology (.top) Parser

Parses a GROMACS .top file to extract molecule names and their counts from the [ molecules ] section.

class kbkit.io.top.TopParser(path: str | Path)[source]

Bases: object

Parses GROMACS topology file to get molecules present and their counts.

Parameters:

top_path (str) – Path to the topology (.top) file.

parse() None[source]

Read the topology file and returns a dictionary of molecule names and counts.

Returns:

Dictionary containing molecules present and their number.

Return type:

dict

report_skipped() None[source]

Print a summary of lines that were skipped during parsing, including the line content and the reason for skipping.

property molecule_count: dict[str, int]

Dictionary of molecules present and their corresponding numbers.

Type:

dict[str, int]

property molecules: list[str]

Names of molecules present.

Type:

list[str]

property total_molecules: int

Total number of molecules present.

Type:

int

property electron_count: dict[str, int]

Empty dict of electron counts.

Type:

dict

property box_volume: float

NaN value for box volume.

Type:

float