Skip to content

pdep: reuse one raw level under either year spelling - #229

Merged
alongd merged 1 commit into
mainfrom
i103-level-resolution
Nov 28, 2026
Merged

alongd merged 1 commit into
mainfrom
i103-level-resolution

Conversation

@alongd

@alongd alongd commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Summary

A no-year wb97xd key appeared in the corrections database beside the wb97xd2023 one, so ARC now
resolves a no-year request to a different key than older captures froze. T3's side of that
resolution is made spelling-agnostic.

 admission (pes_qm)
   for each frozen capture:
-    accept iff capture.model_chemistry == <the level this run resolves>
+    accept iff ARC resolves the request -- SP year removed, or pinned to the
+      capture's year -- to capture.model_chemistry
     energy-reference check (C4): unchanged

 emission (hybrid)
-    write the network under the capture's level, omitting an absent scale factor
+    write it under THIS run's resolved level; an absent frequencyScaleFactor
+      takes the run's frequency-level factor, and a missing one now raises

Evidence

Before: tests/test_pdep went red with no commit in this repository. RMG-database
1a2c04686 (PR #603, 2026-11-15) added a no-year
LevelOfTheory(method='wb97xd', basis='def2tzvp', software='gaussian') beside the existing
wb97xd2023. ARC's tie-break prefers the no-year entry when the request carries no year, so the
expectations frozen against wb97xd2023 became the stale side of a comparison that used to hold.

After: admission compares what ARC resolves rather than a literal, so either spelling of the
same raw level reuses the same capture. The tests no longer freeze ARC's answer: they request a
frozen literal by the level that names its year, compute ARC's own literal at run time, pin the
tie-break on a synthetic corrections database (skipping if ARC's section markers move), and carry a
guard against a yeared literal being reintroduced.

tests/test_pdep/test_pes_qm.py carries the bulk of it (+344/-…); the suite is green on the branch
and the 14 inherited failures on sibling branches are exactly this set.

Merge Danger

Door: two-way.

Blast Radius: capture reuse.

Admission decides which frozen QM captures a run may reuse, so a wrong widening would reuse a
capture computed at a genuinely different level. That is why the energy-reference check (C4) is
left untouched and the comparison is "ARC resolves the same request", not "the strings look
similar". The emission change makes a missing frequencyScaleFactor raise rather than be
omitted silently, which is a deliberate fail-closed: a network written without one is wrong in a
way nothing downstream would notice.

Scope of the repair

This repairs a round whose captures were all adopted under either spelling of the same raw
level. A round that mixes a new capture with an old-spelling one is still refused, and that
refusal is deliberate: the two were computed against different corrections entries, so reusing them
together would compare energies that do not share a reference.

The energy-reference check (C4) is untouched, and with the admission gate above the emitted level
label and the frozen atom energies agree by construction — admission only accepts a capture whose
model_chemistry is what this run's request resolves to, which is the same key the atom energies
were frozen under.

The corrections database gained no-year wb97xd and dlpno-f12 keys
beside the 2023 ones, so ARC now resolves a no-year request to a
different key than older captures froze.

- Admission: a capture is admissible when ARC resolves the same
  request, with its SP year removed or pinned to the capture's
  year, to the capture's model_chemistry. The energy-reference
  check (C4) is unchanged.
- Emission: a hybrid network is written under this run's resolved
  level; a capture with no frequency scale factor gets the run's
  frequency-level factor.
- The hybrid writer raises on a missing frequencyScaleFactor
  instead of omitting it.

Tests request frozen ARC literals by the level that names their
year, compute ARC's own literal at run time, pin the tie-break on
a synthetic corrections database (skipping if ARC's section
markers move), and guard against a reintroduced yeared literal.
@github-actions
github-actions Bot requested a balanced review from Copilot November 28, 2026 07:21
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.99%. Comparing base (4043bb9) to head (d5cd008).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #229      +/-   ##
==========================================
+ Coverage   81.92%   81.99%   +0.06%     
==========================================
  Files          78       78              
  Lines       12947    12982      +35     
  Branches     2732     2740       +8     
==========================================
+ Hits        10607    10644      +37     
+ Misses       1694     1689       -5     
- Partials      646      649       +3     
Flag Coverage Δ
unittests 81.99% <ø> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The regression tests can miss regressions in no-year capture adoption and model-chemistry relabeling because one requests the original yeared level and the other depends on installed database contents.

2 open issues
What changed in this PR

This PR makes pressure-dependent QM capture reuse tolerant of year-suffixed and yearless spellings that ARC resolves for the same raw level, while preserving energy-reference checks.

Changes:

  • Broaden capture admission through ARC-resolved spelling variants.
  • Emit hybrid networks under the run’s resolved level, fill missing frequency scale factors where available, and reject unresolved factors.
  • Update frozen fixtures and regression tests for spelling compatibility and stricter emission requirements.
File Description
tests/​test_pdep/​test_pes_qm.py Add spelling compatibility, emission, and frozen-expectation checks.
tests/​test_pdep/​test_pes_loop_source_seed.py Supply a frequency scale factor in the source-seed fixture.
tests/​test_pdep/​test_pes_loop_integration.py Read frozen chemistry from ARC output and explicitly request its year.
tests/​test_pdep/​test_main_wiring.py Add a scale factor to the wiring fixture.
tests/​test_pdep/​test_hybrid.py Test missing-factor rejection and update fixtures.
tests/​test_pdep/​test_capture.py Add a scale factor to the capture fixture.
t3/​pdep/​pes_qm.py Resolve admissible spelling variants and prepare run-specific emission settings.
t3/​pdep/​hybrid.py Require a frequency scale factor when writing hybrid networks.

Review effort: Balanced

Comment thread tests/test_pdep/test_pes_qm.py Resolved
Comment thread tests/test_pdep/test_pes_qm.py Resolved
@alongd
alongd marked this pull request as ready for review November 28, 2026 07:41
@greptile-apps

greptile-apps Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Confidence Score: 4/5 · The PR appears safe to merge, with a non-blocking gap in the new adoption test.RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect the bounded P-dep capture-reuse and hybrid-network workflow.

The PR appears safe to merge, with a non-blocking gap in the new adoption test.

Findings

  1. P2 Test misses cross-spelling reuse ▶

Summary

The PR lets capture admission consider ARC's year and no-year spellings of the same requested level.

  • T3 reuses QM captures across ARC's year and no-year level spellings.
  • Hybrid networks use the run's level and always include its frequency scale factor.

Intentional behavior acknowledged by alongd: rounds mixing new captures with old-spelling captures remain refused because their correction entries differ. Missing frequency factors also deliberately stop emission rather than being omitted.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Requested levels] --> B[Resolve original and year variants]
  C[Verified prior capture] --> D{Capture spelling admitted?}
  B --> D
  D -->|Yes| E[Read frozen settings]
  E --> F{Captured and adopted settings agree?}
  F -->|No| G[Refuse mixed references]
  F -->|Yes or adopted only| H[Use current resolved label]
  H --> I[Keep frozen numbers and fill missing factor]
  I --> J{Frequency factor present?}
  J -->|No| K[Refuse write]
  J -->|Yes| L[Extract conformers and write hybrid]
Loading

Reviews (1) · Last reviewed commit: "pdep: reuse one raw level under either y..." · Reviewed by Greptile

Comment thread tests/test_pdep/test_pes_qm.py Resolved
@alongd
alongd merged commit 0bd0edc into main Nov 28, 2026
6 checks passed
@alongd
alongd deleted the i103-level-resolution branch November 28, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants