iphasimulator.trajectory_processing

Configuration-driven, streaming GROMACS XTC processing for enzyme–PHA systems.

Run python -m iphasimulator.trajectory_processing instrcution.txt --dry-run. Paths in YAML are relative to that file. No simulation or viewer is launched.

Attributes

WORKFLOW

Classes

ProcessingConfig

Validated settings; all filesystem paths are absolute after loading.

Functions

load_config(→ ProcessingConfig)

Read strict YAML, rejecting unknown/duplicate keys and invalid values.

resolved_settings(→ dict)

Return JSON/YAML-serialisable settings, including resolved paths.

check_output_safety(→ None)

Refuse raw-input containment and replacement of unowned output folders.

preflight(cfg)

Validate files/tools, topology, named selections and the first XTC frame.

command_plan(→ list[dict])

Construct separate preparation and optional fitting trjconv operations.

process_trajectory(→ dict)

Load, validate and run once; a dry run reads only metadata/first frame.

main([argv])

CLI entry point shared with the notebook.

Module Contents

iphasimulator.trajectory_processing.WORKFLOW = 'iphasimulator.trajectory_processing.v1'
class iphasimulator.trajectory_processing.ProcessingConfig

Validated settings; all filesystem paths are absolute after loading.

instruction_file: pathlib.Path
input_trajectory: pathlib.Path
structure: pathlib.Path
index: pathlib.Path
output_dir: pathlib.Path
schema_version: int = 1
stride: int = 100
pbc: str = 'none'
center: bool = False
center_group: str | None = None
fit: str = 'none'
fit_group: str | None = None
output_group: str = 'SYSTEM'
prepare_vmd: bool = True
overwrite: bool = False
dry_run: bool = False
gmx: str = 'gmx'
custom_groups: dict[str, str]
iphasimulator.trajectory_processing.load_config(path: str | pathlib.Path) → ProcessingConfig

Read strict YAML, rejecting unknown/duplicate keys and invalid values.

iphasimulator.trajectory_processing.resolved_settings(cfg: ProcessingConfig) → dict

Return JSON/YAML-serialisable settings, including resolved paths.

iphasimulator.trajectory_processing.check_output_safety(cfg: ProcessingConfig) → None

Refuse raw-input containment and replacement of unowned output folders.

iphasimulator.trajectory_processing.preflight(cfg: ProcessingConfig)

Validate files/tools, topology, named selections and the first XTC frame.

This is read-only, including in dry-run mode. XTC contains no atom identities: its atom count can be checked, but provenance/order must be supplied correctly.

iphasimulator.trajectory_processing.command_plan(cfg: ProcessingConfig, executable: str, directory: pathlib.Path | None = None) → list[dict]

Construct separate preparation and optional fitting trjconv operations.

iphasimulator.trajectory_processing.process_trajectory(instruction_file: str | pathlib.Path, *, dry_run: bool | None = None) → dict

Load, validate and run once; a dry run reads only metadata/first frame.

Results are assembled in a staging directory and published locally only after streaming verification. Explicit overwrite archives the previous owned result. Failures retain logs in the staging directory and leave previous results intact.

iphasimulator.trajectory_processing.main(argv=None)

CLI entry point shared with the notebook.