fix(explorer): absolutize spliced stat-mech file paths to the source's directory - #201
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes explorer handoffs by converting relative stat-mechanics paths to absolute source-relative paths when generating inputs.
Changes:
- Absolutizes
species()andtransitionState()external paths. - Records rewritten paths in
ExplorerInputSummary. - Adds regression coverage and a real stat-mechanics fixture.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Summary |
|---|---|
t3/pdep/explorer/input_file.py |
Rewrites and records stat-mechanics paths. Moderate issue: positional-label species(label, path) forms are rewritten but not fully supported by species registration and bath-gas handling. |
tests/test_pdep/test_explorer_input_file.py |
Tests path absolutization and resolution to an existing file. |
tests/data/pdep_hybrid/cho2_round0/qm/TS2.py |
Adds the referenced stat-mechanics fixture. |
Suppressed comments (1)
t3/pdep/explorer/input_file.py:367
- This new branch explicitly promises to absolutize both
species()andtransitionState()file references, but the regression coverage only drives the latter. Please add an end-to-end case for the positionalspecies('S', 'qm/S.py')form (and assert its summary record/path), so a species-specific argument-handling regression cannot pass unnoticed.
if call_name in ('species', 'transitionState'):
path_node = _stat_mech_file_path_node(call)
if path_node is not None and not os.path.isabs(path_node.value):
absolute_path = os.path.join(source_dir, path_node.value)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
alongd
force-pushed
the
i019-seed-label
branch
from
August 25, 2026 06:29
b0be7fb to
0b8dec1
Compare
alongd
force-pushed
the
i021-spliced-path
branch
from
August 25, 2026 06:38
eaa2c31 to
0f9a870
Compare
alongd
force-pushed
the
i019-seed-label
branch
from
August 25, 2026 08:44
0b8dec1 to
5d5cb14
Compare
…s directory
The hybrid writer emits transitionState('TS2', 'qm/TS2.py') with the qm/ tree
vendored beside the hybrid -- a path relative to the hybrid, deliberately portable.
But write_arkane_explorer_input_file splices that block verbatim into a generated
Arkane explorer input in a DIFFERENT directory with no qm/ sibling, so Arkane
resolves the raw 'qm/TS2.py' against its own working directory and dies with
FileNotFoundError at arkane/statmech.py load time.
Rewrite each spliced species()/transitionState() external file path (Arkane's
<name>(label, path) form) from relative to absolute, anchored at the SOURCE file's
own directory, so it resolves wherever the generated file lands and whatever cwd
Arkane runs in. An absolute path is passed through Arkane's os.path.join rebase
unchanged; the inner Log('logs/...') references then rebase (statmech.py:319)
relative to the now-correct species-file directory and resolve too. The hybrid's
relative convention is untouched -- only the spliced copy is edited -- and a string
literal stays a string literal, so both guards in the module still accept it. The
rewrite is recorded in ExplorerInputSummary.stat_mech_paths_absolutized.
Regression test drives the real committed round-0 hybrid through the writer into an
unrelated directory and asserts the emitted path resolves to a file that exists
(os.path.isfile), with the real qm/TS2.py vendored beside the fixture.
alongd
force-pushed
the
i021-spliced-path
branch
from
August 25, 2026 08:51
0f9a870 to
963aa83
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #200 → #199 → #198 → #197. Base is
i020-generated-modelchem, so this diff shows only its own change; GitHub retargets as each parent merges. Review in order.What this fixes
T3's hybrid writer references a QM transition state's stat-mech data by a relative path —
transitionState('TS2', 'qm/TS2.py'), with theqm/tree vendored beside the hybrid. That convention is deliberate and keeps a run directory portable. Butinput_file.pysplices that line verbatim into a generated Arkane input in a different directory, and Arkane then cannot find the file:The mechanism is worth stating precisely, because the obvious reading is wrong.
arkane/input.py:690doesjob.path = os.path.join(directory, job.path)— Arkane does rebase, against the input file's directory. That is exactly the problem: the input file is the generated explorer input, not the hybrid, so a path meaningful relative to the hybrid is rebased against a directory with noqm/tree in it.The change
Each spliced
species()/transitionState()external file path — Arkane's<name>(label, path)form — is rewritten from relative to absolute, anchored at the source file's own directory, where the vendoredqm/tree actually lives. Adds_stat_mech_file_path_node, an edit in the existing AST walk, and astat_mech_paths_absolutizedrecord onExplorerInputSummary.The hybrid writer's relative convention is untouched — only the spliced copy is rewritten, so hybrids stay portable. A string literal remains a string literal, so neither the inbound source guard nor the outbound self-check is weakened, and there is no
chdir.Position-dependence sweep
Since this is the second defect caused by the same verbatim splice moving text into a new context, the other position-dependent references were enumerated rather than assumed:
species()/transitionState()external paths — the defect; fixed for both call names.Log('logs/TS2/...')insideqm/TS2.py— a different level.statmech.py:319rebases those against the species file's own directory, which is now correct, so they resolve. Confirmed by the run reading them.database()carries library names, not paths.Testing
transitionState('TS2', '/abs/path/to/qm/TS2.py'); Arkane loads the transition state and its logs and proceeds to the master-equation solve. No cluster, no quantum chemistry.test_real_hybrid_transition_state_path_is_absolutized_to_an_existing_fileassertsos.path.isfile(emitted_path)— that it resolves to a file that exists, not merely that it is absolute.qm/TS2.pyis committed beside the existing hybrid fixture so that assertion is meaningful.tests/test_pdep: 1930 passed, 133 s.Known next failure, not chased
The run now gets all the way to the physics and stops there:
numpy.linalg.LinAlgError: Singular matrixatrmgpy/pdep/msc.pyx:147, in the Modified Strong Collision solve. That is a numerical/scientific issue rather than a plumbing one, and it is tracked separately. With this change, the round-0 → round-1 handoff no longer fails on any file-contract defect.