Skip to content

Parse Mayer bond orders from ESS log files - #951

Open
kfir4444 wants to merge 1 commit into
mainfrom
mayer_bond_orders_parser
Open

Parse Mayer bond orders from ESS log files#951
kfir4444 wants to merge 1 commit into
mainfrom
mayer_bond_orders_parser

Conversation

@kfir4444

@kfir4444 kfir4444 commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

What

Adds parse_bond_orders(), returning the Mayer bond order matrix from a Gaussian or Orca log file.

Why

ARC infers connectivity from interatomic distances alone — get_bonds_from_dmat() (arc/common.py), covalent radii scaled by 1.2. That heuristic is least reliable exactly where it matters most: IRC endpoints, loose pre-reactive complexes, and stretched or partially formed bonds, where a distance cutoff either fuses two fragments or splits one.

The electronic structure calculation already reports a density-derived bond index. Nothing in ARC read it until now — a repo-wide grep for mayer|wiberg|nbo finds only NBO TRUE written for Q-Chem orbitals jobs, whose output is never parsed back.

How

  • ESSAdapter.parse_bond_orders() is concrete and returns None, following parse_opt_steps / parse_ess_version. Making it @abstractmethod would have forced all nine adapters to implement it; this way the other seven are untouched.
  • Gaussian — the full N×N matrix under Atomic Valencies and Mayer Atomic Bond Orders:, printed in Fortran-style six-column blocks. The last such section in the file is used, which matters for multi-step jobs. The result is symmetrized to absorb print precision.
  • Orca — printed by default. The ATOM NA ZA QA VA BVA FA table gives the atom count and the diagonal, then the sparse pair list B( 0-O , 1-C ) : 1.0172 (already 0-indexed). Orca only prints pairs above 0.1 by default, so weaker interactions come back as exactly 0 — stated in the docstring, since it bounds how low a threshold is meaningful downstream.

Return value: a symmetric N×N np.ndarray in the log file's atom order, with the diagonal holding the Mayer atomic valence. Gaussian's diagonal and Orca's VA column are the same quantity, so the two adapters return the same thing.

Test data

arc/testing/bond_orders/ gains one Gaussian and one Orca log. The test additionally covers three Orca logs already in the repo — a TS with two partial bonds, and a formaldehyde opt with a 2.14 C=O — and asserts None for logs with no Mayer section.

Testing

pytest arc/parser/ — 33 passed.

🤖 Generated with Claude Code


Stack (merge bottom-up; ARC uses merge commits, so GitHub retargets each PR as the one below it lands):

  1. Parse Mayer bond orders from ESS log files #951 — parse Mayer bond orders ← this is 1/5
  2. Print Mayer bond orders in Gaussian jobs #952 — print them in Gaussian jobs
  3. Perceive connectivity from Mayer bond orders (mol_from_dft) #953mol_from_dft()
  4. Use Mayer bond orders for the IRC endpoint check #954 — IRC endpoint check
  5. Add a TS bond order check #955 — TS bond order check

@calvinp0
calvinp0 force-pushed the mayer_bond_orders_parser branch from 50f615b to 3e0e0c0 Compare August 10, 2026 09:08
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.57%. Comparing base (a35caaa) to head (3e0e0c0).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #951      +/-   ##
==========================================
+ Coverage   63.56%   63.57%   +0.01%     
==========================================
  Files         114      114              
  Lines       38375    38443      +68     
  Branches    10031    10052      +21     
==========================================
+ Hits        24394    24442      +48     
- Misses      11063    11077      +14     
- Partials     2918     2924       +6     
Flag Coverage Δ
functionaltests 63.57% <ø> (+0.01%) ⬆️
unittests 63.57% <ø> (+0.01%) ⬆️

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.

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.

1 participant