iphasimulator.trajectory_centering

Index-file helpers for reusable GROMACS centering groups.

Attributes

GROUP_HEADER_PATTERN

DEFAULT_CENTER_GROUP

WORKFLOW_CENTER_SOURCES

Classes

GromacsIndex

Parsed GROMACS index groups, preserving group order.

CenterIndexResult

Result from creating or reusing a dedicated centering index.

Functions

read_index(→ GromacsIndex)

Read a GROMACS .ndx file into named atom groups.

write_index(→ pathlib.Path)

Write a GROMACS index file with stable 15-atom line wrapping.

resolve_center_source_groups(→ tuple[str, ...])

Return source groups for a workflow, filtering to groups present in the index.

merged_group_atoms(→ tuple[int, ...])

Merge one or more index groups into a sorted unique atom list.

ensure_center_index(→ CenterIndexResult)

Create or reuse a GROMACS index file containing a dedicated center group.

Module Contents

iphasimulator.trajectory_centering.GROUP_HEADER_PATTERN
iphasimulator.trajectory_centering.DEFAULT_CENTER_GROUP = 'center'
iphasimulator.trajectory_centering.WORKFLOW_CENTER_SOURCES: dict[str, tuple[str, ...]]
class iphasimulator.trajectory_centering.GromacsIndex

Parsed GROMACS index groups, preserving group order.

groups: dict[str, tuple[int, ...]]
property names: tuple[str, ...]
has_group(name: str) → bool
group(name: str) → tuple[int, ...]
class iphasimulator.trajectory_centering.CenterIndexResult

Result from creating or reusing a dedicated centering index.

index_path: pathlib.Path
center_group: str
source_groups: tuple[str, ...]
created: bool
reused_existing_center: bool
iphasimulator.trajectory_centering.read_index(index_path: str | pathlib.Path) → GromacsIndex

Read a GROMACS .ndx file into named atom groups.

iphasimulator.trajectory_centering.write_index(index: GromacsIndex, index_path: str | pathlib.Path) → pathlib.Path

Write a GROMACS index file with stable 15-atom line wrapping.

iphasimulator.trajectory_centering.resolve_center_source_groups(index: GromacsIndex, *, workflow_type: str = 'polymer', source_groups: tuple[str, ...] | list[str] | None = None) → tuple[str, ...]

Return source groups for a workflow, filtering to groups present in the index.

iphasimulator.trajectory_centering.merged_group_atoms(index: GromacsIndex, group_names: tuple[str, ...]) → tuple[int, ...]

Merge one or more index groups into a sorted unique atom list.

iphasimulator.trajectory_centering.ensure_center_index(source_index: str | pathlib.Path, output_index: str | pathlib.Path | None = None, *, workflow_type: str = 'polymer', source_groups: tuple[str, ...] | list[str] | None = None, center_group: str = DEFAULT_CENTER_GROUP) → CenterIndexResult

Create or reuse a GROMACS index file containing a dedicated center group.

Existing [ center ] groups are reused. Otherwise the group is generated from the workflow source groups, currently PHA for polymer-only systems.