Skip to content

Enhances Arkane QM correction matching#858

Merged
calvinp0 merged 4 commits intomainfrom
arkane_m_fix
Apr 9, 2026
Merged

Enhances Arkane QM correction matching#858
calvinp0 merged 4 commits intomainfrom
arkane_m_fix

Conversation

@calvinp0
Copy link
Copy Markdown
Member

@calvinp0 calvinp0 commented Apr 8, 2026

Previously, Arkane's Atom Energy Corrections (AEC) and Bond Additivity Corrections (BAC) relied on a single model chemistry key for lookup in the RMG database. This limited flexibility and could lead to issues if only one type of correction was available or if the optimal database keys for AEC and BAC differed (e.g., differing software attribute requirements).

This update refactors the QM correction lookup to resolve AEC and BAC keys independently:

  • Independent Key Resolution: AEC and BAC keys are now searched for and matched separately within their respective sections of the RMG database (atom_energies, pbac, mbac).
  • Improved Validation: The ARC class now explicitly validates AEC availability even when BAC is not requested. Validation messages are enhanced to clearly distinguish scenarios where AEC, BAC, both, or neither are found, providing more informative feedback.
  • Robust Application: The underlying script for retrieving corrections (get_qm_corrections.py) has been updated to accept and process separate AEC and BAC keys, ensuring more accurate application of available corrections.

These improvements make Arkane thermochemistry calculations more robust and precise by ensuring ARC can correctly identify and apply the most appropriate energy corrections. New unit tests verify the independent key resolution and enhanced validation logic.

Comment thread arc/output.py Fixed
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

Refactors Arkane QM energy-correction lookup so Atom Energy Corrections (AEC) and Bond Additivity Corrections (BAC) are resolved independently, improving robustness when only one correction type is available or when their best-matching RMG database keys differ.

Changes:

  • Added AEC-only validation path (check_arkane_aec) and improved messaging in BAC validation (check_arkane_bacs).
  • Updated get_qm_corrections.py and arc.output._get_energy_corrections to pass/handle separate aec_key and bac_key.
  • Added unit tests covering independent key resolution and logging/validation behavior.

Reviewed changes

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

Show a summary per file
File Description
arc/statmech/arkane.py Adds AEC-only check and refines BAC/AEC validation logging.
arc/statmech/arkane_test.py Adds tests for new AEC/BAC matching and log behavior.
arc/scripts/get_qm_corrections.py Accepts separate AEC/BAC keys for correction extraction.
arc/output.py Resolves AEC/BAC keys independently before calling the extraction script.
arc/output_test.py Tests that AEC/BAC keys are resolved and passed independently.
arc/main.py Ensures AEC availability is validated even when BAC is disabled.

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

Comment thread arc/statmech/arkane.py Outdated
Comment thread arc/statmech/arkane.py Outdated
Comment thread arc/statmech/arkane.py Outdated
Comment thread arc/statmech/arkane.py
Comment thread arc/scripts/get_qm_corrections.py
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.13%. Comparing base (e782431) to head (606bbe2).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #858      +/-   ##
==========================================
+ Coverage   60.09%   60.13%   +0.04%     
==========================================
  Files         102      102              
  Lines       31009    31043      +34     
  Branches     8074     8082       +8     
==========================================
+ Hits        18636    18669      +33     
- Misses      10065    10067       +2     
+ Partials     2308     2307       -1     
Flag Coverage Δ
functionaltests 60.13% <ø> (+0.04%) ⬆️
unittests 60.13% <ø> (+0.04%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

Comment thread arc/output.py
Comment thread arc/statmech/arkane.py Outdated
Comment thread arc/statmech/arkane_test.py
Comment thread arc/output.py Outdated
Comment thread arc/main.py Outdated
@calvinp0 calvinp0 requested a review from alongd April 9, 2026 07:19
Comment thread arc/statmech/arkane_test.py Fixed
calvinp0 added 4 commits April 9, 2026 10:29
Updated Arkane validation logic to provide more granular feedback when atom energy corrections (AEC) or bond additivity corrections (BAC) are missing.

Key changes include:
- Added `check_arkane_aec` to verify atom energy corrections independently when BAC is disabled.
- Enhanced `check_arkane_bacs` to specifically identify and log whether AEC, BAC, or both are missing from the RMG database.
- Improved log reporting to distinguish between PBAC and MBAC types.

Enhance Arkane AEC and BAC validation logging and error handling

Updated the validation logic for Arkane energy corrections to handle potential input errors and provide more granular feedback when entries are missing.

Key changes include:
- Added exception handling to catch cases where Arkane quantum corrections data cannot be loaded from the RMG database.
- Improved logging to specifically identify the matched BAC key and correction type (PBAC or MBAC).
- Added a general warning message when no matching Arkane entry is found for a given level of theory.
Updated the energy correction retrieval logic to perform independent fuzzy matching for AEC and BAC keys. This ensures corrections can be retrieved even if they are stored under slightly different level-of-theory definitions in the RMG database (e.g., one including the software attribute and the other not).

Key changes include:
- Added specific search ranges for PBAC and MBAC sections within the database files.
- Updated the `get_qm_corrections.py` script interface to handle separate keys for atom and bond corrections.
- Remove unused import "get_arkane_model_chemistry"
Updated the logic for determining the Arkane level of theory to provide logging regarding its source and integrated AEC validation when BAC is not used.

Key changes include:
- Added logging to identify if the Arkane level of theory was explicitly set or inferred from the composite method or single point level.
- Integrated a call to `check_arkane_aec` to verify atom energy corrections when `bac_type` is not specified.
Updated the logic for retrieving QM corrections to handle separate keys for atom energy corrections (AEC) and bond additivity corrections (BAC). This ensures that corrections can be resolved independently if they are stored under different level-of-theory definitions in the RMG database.

Key changes include:
- Updated the script to process `aec_key` and `bac_key` independently.
- Maintained backward compatibility by using `matched_key` as a fallback for `aec_key`.
- Modified BAC retrieval to utilize the dedicated `bac_key`.

Support backward compatibility for BAC keys in the QM corrections script

Updated the logic for retrieving QM corrections to handle legacy input formats where atom and bond corrections are not defined as independent keys.

Key changes include:
- Maintained backward compatibility by using `matched_key` as a fallback for `bac_key`, mirroring the existing behavior for `aec_key`.
Copy link
Copy Markdown
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

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

Thanks!!

@calvinp0 calvinp0 merged commit 78e7505 into main Apr 9, 2026
8 checks passed
@calvinp0 calvinp0 deleted the arkane_m_fix branch April 9, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants