Skip to content

Fix orca ess status - #928

Open
calvinp0 wants to merge 3 commits into
mainfrom
fix_orca_ess_status
Open

Fix orca ess status#928
calvinp0 wants to merge 3 commits into
mainfrom
fix_orca_ess_status

Conversation

@calvinp0

Copy link
Copy Markdown
Member

This pull request improves how the code determines and handles the electronic-structure software (ESS) identity for job adapters, especially for cases where an adapter wraps another ESS (like Orca NEB using Orca logs). It also makes the Orca SCF energy parsing logic more robust and adds comprehensive tests to cover tricky log file formats and edge cases.

Job Adapter and ESS Software Identity:

  • Added a new ess_software property to the base JobAdapter class, defaulting to the adapter's own name, and overridden in OrcaNEBAdapter to return 'orca', ensuring correct dispatch to ESS log parsers. [1] [2]
  • Updated internal calls in _check_job_ess_status to use ess_software instead of job_adapter, so that status checks use the correct ESS name even for adapters that wrap another ESS. [1] [2]

Orca SCF Energy Parsing Improvements:

  • Improved the SCF energy extraction logic in determine_ess_status to handle Orca NEB log files where the first SCF iteration line may not immediately follow the expected marker, and to avoid errors if energy lines are missing. Now, if either the initial or final SCF energy is missing but the job terminated normally, the status is still reported as 'done'. [1] [2]

Testing Enhancements:

  • Added targeted tests in orca_neb_test.py to verify that Orca NEB jobs are properly recognized as 'done' when the underlying Orca log terminates normally, and that the adapter/ESS identity logic is correct.
  • Added and extended tests in trsh_test.py to cover Orca NEB log edge cases, including incomplete SCF blocks and missing energy lines, ensuring the parser never raises errors in these cases and always returns 'done' for normal terminations. [1] [2]

calvinp0 added 2 commits July 27, 2026 16:03
…ocks

determine_ess_status() mined the Orca SCF block for an initial/final energy
pair to run its divergence heuristic. Two ways that crashed on a normally
terminated run:

1. The scan for the first SCF iteration energy assumed the line immediately
   following the incremental-Fock marker holds one. Orca may print a SOSCF
   header and a separator in between, and the separator holds a single token,
   so `forward_lines[j + 1].split()[1]` raised IndexError. The loop was also
   unbounded and could only terminate by raising.

2. `scf_energy_last_iteration` was assigned only inside the 'TOTAL SCF ENERGY'
   branch but read whenever an initial energy was found, so a log with a
   parseable iteration line and no 'TOTAL SCF ENERGY' header raised
   UnboundLocalError.

Neither exception is caught by any caller (determine_job_status() catches only
IOError), so either one aborts the whole ARC run.

Scan forward with a bounded loop that skips lines too short to hold an energy,
initialize both energies to None, and require both before forming the ratio;
a normally terminated run with nothing to compare is simply 'done'.

Verified against every Orca fixture under arc/testing/ that contains the
incremental-Fock marker: results are unchanged on all of them, including the
SCF blow-up detection in orca_scf_blow_up_error.log. Only the NEB log changes
behavior, from IndexError to 'done'.

Both SCF edge cases are pinned by fixtures derived from real Orca NEB
output (arc/testing/neb/neb_res.out truncated to leave the SCF block
incomplete) rather than hand-written logs: neb_scf_no_iteration_line.out
covers the scan, neb_scf_no_total_energy.out covers the both-energies guard.
determine_ess_status() dispatches on an exact software name ('gaussian',
'qchem', 'orca', 'molpro', 'terachem'). A TS-search adapter that wraps an ESS
reports its own adapter name, so OrcaNEBAdapter passed 'orca_neb', matched no
branch, and fell through to the terminal `return '', list(), '', ''`. A
normally terminated NEB run was therefore reported with an empty status rather
than 'done', and its errors (SCF divergence, MDCI, memory) were never
classified at all.

Add an `ess_software` property on JobAdapter that defaults to the adapter's own
name -- correct for adapters that ARE an ESS -- and have the ESS status call
sites use it, so an adapter wrapping an ESS can declare which log parser
applies. OrcaNEBAdapter overrides it to 'orca'; its output file is already
Orca's input.log.

Note that Orca NEB now takes part in Orca's ESS error handling like any other
Orca job. In particular a 'Syntax' keyword raises JobError, which
Scheduler.end_job turns into a re-run; NEB inputs carry version-sensitive
simple-input keywords, so that path is more reachable here than for a plain
Orca job.
@calvinp0
calvinp0 requested review from alongd, Copilot and kfir4444 July 27, 2026 13:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the Module: trsh Troubleshooting label Jul 27, 2026
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.43%. Comparing base (9787770) to head (1c57ec7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #928   +/-   ##
=======================================
  Coverage   63.43%   63.43%           
=======================================
  Files         114      114           
  Lines       38325    38336   +11     
  Branches    10030    10031    +1     
=======================================
+ Hits        24312    24320    +8     
- Misses      11096    11099    +3     
  Partials     2917     2917           
Flag Coverage Δ
functionaltests 63.43% <ø> (+<0.01%) ⬆️
unittests 63.43% <ø> (+<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.

@calvinp0
calvinp0 force-pushed the fix_orca_ess_status branch 2 times, most recently from 1c57ec7 to ed0277c Compare July 28, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module: trsh Troubleshooting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants