iphasimulator.trajectory_centering ================================== .. py:module:: iphasimulator.trajectory_centering .. autoapi-nested-parse:: Index-file helpers for reusable GROMACS centering groups. Attributes ---------- .. autoapisummary:: iphasimulator.trajectory_centering.GROUP_HEADER_PATTERN iphasimulator.trajectory_centering.DEFAULT_CENTER_GROUP iphasimulator.trajectory_centering.WORKFLOW_CENTER_SOURCES Classes ------- .. autoapisummary:: iphasimulator.trajectory_centering.GromacsIndex iphasimulator.trajectory_centering.CenterIndexResult Functions --------- .. autoapisummary:: iphasimulator.trajectory_centering.read_index iphasimulator.trajectory_centering.write_index iphasimulator.trajectory_centering.resolve_center_source_groups iphasimulator.trajectory_centering.merged_group_atoms iphasimulator.trajectory_centering.ensure_center_index Module Contents --------------- .. py:data:: GROUP_HEADER_PATTERN .. py:data:: DEFAULT_CENTER_GROUP :value: 'center' .. py:data:: WORKFLOW_CENTER_SOURCES :type: dict[str, tuple[str, ...]] .. py:class:: GromacsIndex Parsed GROMACS index groups, preserving group order. .. py:attribute:: groups :type: dict[str, tuple[int, ...]] .. py:property:: names :type: tuple[str, ...] .. py:method:: has_group(name: str) -> bool .. py:method:: group(name: str) -> tuple[int, ...] .. py:class:: CenterIndexResult Result from creating or reusing a dedicated centering index. .. py:attribute:: index_path :type: pathlib.Path .. py:attribute:: center_group :type: str .. py:attribute:: source_groups :type: tuple[str, ...] .. py:attribute:: created :type: bool .. py:attribute:: reused_existing_center :type: bool .. py:function:: read_index(index_path: str | pathlib.Path) -> GromacsIndex Read a GROMACS ``.ndx`` file into named atom groups. .. py:function:: write_index(index: GromacsIndex, index_path: str | pathlib.Path) -> pathlib.Path Write a GROMACS index file with stable 15-atom line wrapping. .. py:function:: 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. .. py:function:: merged_group_atoms(index: GromacsIndex, group_names: tuple[str, ...]) -> tuple[int, ...] Merge one or more index groups into a sorted unique atom list. .. py:function:: 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.