Skip to content

fix(parsers): Fix Jaguar Hessian unit bug + Check 1 validation test#196

Merged
ericchansen merged 4 commits intomasterfrom
feat/published-ff-validation
Apr 1, 2026
Merged

fix(parsers): Fix Jaguar Hessian unit bug + Check 1 validation test#196
ericchansen merged 4 commits intomasterfrom
feat/published-ff-validation

Conversation

@ericchansen
Copy link
Copy Markdown
Owner

@ericchansen ericchansen commented Apr 1, 2026

Summary

Fix a critical Jaguar Hessian unit bug that inflated force constants by ~9376x, and add the Check 1 published force-field evaluation harness for the Rh-enamide training set.

What this PR proves now

  • JaguarIn.get_hessian() returns raw Hartree/Bohr^2 values, matching the actual Jaguar .in file convention and the Gaussian/Psi4 parser contract.
  • replace_neg_eigenvalue() now defaults to AU, matching the Method C literature convention.
  • The repo now has a committed Check 1 harness that can:
    • load the published Donoghue 2008 force field,
    • evaluate it against the 9-molecule Jaguar training set with OpenMM,
    • compare it to a Seminario-derived baseline,
    • and pin results with a committed golden JSON.

Current Check 1 status

The OpenMM evaluation harness is working, but the published MacroModel/MM3* force field does not yet reproduce a better fit than the Seminario baseline under OpenMM. To keep that gap visible without blocking the units fix, the parity assertions are tracked as strict xfail promotion gates:

  • published FF beats Seminario baseline
  • per-molecule R^2 > 0
  • average R^2 > 0.80

Those gates are documented in the follow-up issue linked below.

Golden fixture behavior

The golden fixture is now opt-in rather than auto-generated in normal test runs.

Generate/update it locally with OpenMM via:

$env:Q2MM_UPDATE_GOLDEN='1'
python -m pytest test\integration\test_published_ff_validation.py -q -m openmm

That writes test\fixtures\published_ff\rh_enamide_donoghue2008.json, which should be reviewed and committed separately.

Changes

Commit 1: units bug fix

  • stop double-converting Jaguar Hessians to kJ/mol/A^2
  • keep Jaguar Hessians in AU end-to-end
  • switch Method C default replacement units from KJMOLA to GAUSSIAN
  • regenerate affected Seminario parity fixture
  • update unit tests for the AU default

Commit 2: Check 1 harness

  • add test/integration/test_published_ff_validation.py
  • add provenance/index doc for published FF assets
  • add placeholder directory for committed Check 1 golden fixtures

Commit 3: review/documentation cleanup

  • align docstrings with current unit behavior
  • add explicit golden-fixture generation path
  • convert currently unproven OpenMM parity assertions to strict promotion gates (xfail)

Follow-up

  • Follow-up issue: Check 1 OpenMM parity gap / retire temporary xfail gates

Testing

  • ruff check q2mm/ test/ scripts/
  • ruff format --check q2mm test scripts examples
  • python -m pytest test/ -x -q -m "not (openmm or tinker or jax or jax_md or psi4)"
  • OpenMM/cross-backend CI no longer fails on the temporary Check 1 promotion gates
  • Commit the first golden fixture JSON after generating it with OpenMM

Copilot AI review requested due to automatic review settings April 1, 2026 01:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a long-standing Jaguar Hessian unit double-conversion that inflated Seminario-derived force constants, and adds “Check 1” infrastructure to validate evaluation of a published force field (Donoghue 2008) using the OpenMM engine.

Changes:

  • Remove Jaguar .in Hessian unit conversion so JaguarIn.get_hessian() returns raw Hartree/Bohr² (AU), matching other QM parsers.
  • Switch replace_neg_eigenvalue() default unit system to AU and update related unit tests/fixtures.
  • Add published-FF provenance docs and a new OpenMM-based integration test for “Check 1” validation.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
q2mm/parsers/jaguar.py Returns Jaguar Hessians in AU (Hartree/Bohr²) instead of converting, preventing downstream double conversion.
q2mm/models/hessian.py Changes default eigenvalue-replacement units to AU and updates docstrings accordingly.
test/test_method_d_e.py Updates Method C expectation to AU-based replacement behavior.
test/test_linear_algebra.py Updates unit expectations and adds an explicit units=KJMOLA test.
test/integration/test_published_ff_validation.py Adds “Check 1” integration test that evaluates a published FF with OpenMM and pins results via a golden fixture.
test/fixtures/seminario_parity/rh_enamide_reference.json Regenerates rh-enamide parity fixture with corrected (non-inflated) values.
validation/published_ffs/README.md Documents provenance/status for published FF files used in validation.
test/fixtures/published_ff/.gitkeep Ensures the published-FF fixture directory exists in the repo.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/test_method_d_e.py Outdated
Comment thread test/integration/test_published_ff_validation.py Outdated
Comment thread test/test_linear_algebra.py Outdated
Comment thread q2mm/models/hessian.py Outdated
ericchansen and others added 3 commits March 31, 2026 21:45
JaguarIn.get_hessian() was multiplying raw Hessian values by
HESSIAN_CONVERSION (9375.83), converting from Hartree/Bohr2 to
kJ/mol/A2. Downstream code (Seminario, frequency computation) then
treated the result as atomic units, inflating force constants by
~9376x and producing unphysical values (e.g. 13700 mdyn/A for Rh-P
instead of ~1.5 mdyn/A).

Root cause: Jaguar .in files store Hessians in Hartree/Bohr2 (atomic
units), confirmed empirically by computing frequencies from raw values
and matching Jaguar .out output exactly. The old misleading docstring
said 'kJ/(mol*Angstrom^2)' but that described the post-conversion
value, not the raw file format.

Changes:
- Remove HESSIAN_CONVERSION multiplication from JaguarIn.get_hessian()
- Return raw AU to match Gaussian .fchk and Psi4 conventions
- Change replace_neg_eigenvalue default units from KJMOLA to GAUSSIAN
  (AU) since canonical internal Hessian unit is now AU throughout
- Regenerate rh_enamide_reference.json with corrected values
- Update tests for new default eigenvalue replacement behavior

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add integration test that loads the Donoghue 2008 published Rh-enamide
FF directly from mm3.fld and evaluates it against QM reference
frequencies using OpenMM. Compares against a Seminario baseline to
verify the published (optimized) FF produces a meaningfully lower
objective score.

Also add validation/published_ffs/README.md documenting provenance of
all published FFs in the old Q2MM repo and their readiness for
validation (only Rh-enamide has complete training data).

The golden fixture is generated on first OpenMM run and pinned for
reproducibility checks on subsequent runs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…trings

- Unpack synthetic_ts_hessian as (H, _, _) to avoid unused variable
- Skip test when golden fixture is missing instead of auto-generating
- Fix docstring references to match import aliases (co. vs constants.)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ericchansen ericchansen force-pushed the feat/published-ff-validation branch from 2bd7a5d to f7b5d3d Compare April 1, 2026 03:05
Copilot AI review requested due to automatic review settings April 1, 2026 03:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread validation/published_ffs/README.md Outdated
Comment thread q2mm/parsers/jaguar.py
Comment thread test/test_linear_algebra.py Outdated
Comment thread test/integration/test_published_ff_validation.py
Comment thread test/integration/test_published_ff_validation.py
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ericchansen ericchansen merged commit 7863227 into master Apr 1, 2026
11 checks passed
@ericchansen ericchansen deleted the feat/published-ff-validation branch April 1, 2026 03:24
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.

2 participants