Skip to content

Fix NMD crash on un-mappable reactions and OS memory over-allocation trsh#909

Open
alongd wants to merge 2 commits into
ReactionMechanismGenerator:mainfrom
alongd:linear_ts_bugfix
Open

Fix NMD crash on un-mappable reactions and OS memory over-allocation trsh#909
alongd wants to merge 2 commits into
ReactionMechanismGenerator:mainfrom
alongd:linear_ts_bugfix

Conversation

@alongd

@alongd alongd commented Jul 7, 2026

Copy link
Copy Markdown
Member

Two independent, self-contained bug fixes surfaced and validated during an end-to-end run (linear TS-adapter validation, wB97XD/def2-TZVP, Gaussian). Each was confirmed on real jobs during the run, and each ships with unit tests.

1. NMD check crashes on un-atom-mappable reactions

analyze_ts_normal_mode_displacement() raised a ReactionError (Cannot get bonds ...) when reaction.atom_map is None, aborting the entire ARC run. This happens for reactions ARC cannot atom-map — e.g. CH3 + CS <=> CCS (R_Addition_MultipleBond with a charged [C-]#[S+]).

Fix: guard the check to log a warning and return None when there is no atom map, so the scheduler skips NMD validation for that one reaction and continues.

  • arc/checks/nmd.py, test in arc/checks/nmd_test.py.
  • Well-scoped: NMD is skipped only when mapping is impossible; when a map exists the check still runs and correctly rejects wrong-mode TSs.

2. Conflating OS memory over-allocation with Gaussian needing more memory

A Gaussian galloc/malloc failed error means the node could not provide the requested memory (we asked for too much) — the opposite of Gaussian internally requesting more memory. Both were classified as Memory, so troubleshooting increased the request, making a node-capacity failure strictly worse.

Fix: classify the OS-level failure as MemoryOverallocation and troubleshoot it by halving the request down to a 4 GB floor, giving up with a clear "use a higher-memory node" message once at the minimum.

  • arc/job/trsh.py, tests in arc/job/trsh_test.py, fixture arc/testing/trsh/gaussian/galloc.out.
  • Tests cover both the status classification and the reduce-then-give-up path.

Validation

  • New unit tests pass (verified against repo-default server settings).
  • Both fixes were live-confirmed during a ~2-day zeus run: the NMD guard emitted the skip message and the run continued with 0 crashes; the memory-overallocation path was observed reducing real jobs' memory request on the cluster.

🤖 Generated with Claude Code

analyze_ts_normal_mode_displacement() raised a ReactionError when
reaction.atom_map is None (e.g. reactions ARC cannot atom-map, such as
CH3 + CS <=> CCS with a charged CS), aborting the whole run. Guard the
check to log a warning and return None when there is no atom map, so the
scheduler continues and simply skips NMD validation for that reaction.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.09%. Comparing base (8f7b9a0) to head (a686be6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #909      +/-   ##
==========================================
- Coverage   63.16%   63.09%   -0.07%     
==========================================
  Files         114      114              
  Lines       38177    38189      +12     
  Branches     9990     9992       +2     
==========================================
- Hits        24114    24095      -19     
- Misses      11181    11205      +24     
- Partials     2882     2889       +7     
Flag Coverage Δ
functionaltests 63.09% <ø> (-0.07%) ⬇️
unittests 63.09% <ø> (-0.07%) ⬇️

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
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR delivers two targeted robustness fixes in ARC: (1) preventing TS normal-mode-displacement (NMD) validation from aborting runs when a reaction cannot be atom-mapped, and (2) distinguishing OS/node memory overallocation failures from “Gaussian needs more memory”, enabling appropriate (decreasing) memory troubleshooting.

Changes:

  • Skip NMD validation (with a warning) when reaction.atom_map is unavailable, instead of raising and terminating the run.
  • Classify Gaussian galloc/malloc failed as MemoryOverallocation and troubleshoot by reducing requested memory down to a 4 GB floor.
  • Add/extend unit tests and a Gaussian output fixture to cover both behaviors.

Reviewed changes

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

Show a summary per file
File Description
arc/checks/nmd.py Adds an early guard to skip NMD analysis when no atom map is available.
arc/checks/nmd_test.py Adds a regression test ensuring unmappable reactions return None instead of crashing.
arc/job/trsh.py Introduces MemoryOverallocation classification and implements “reduce memory” troubleshooting for OS allocation failures.
arc/job/trsh_test.py Adds tests for status classification and the reduce-then-give-up troubleshooting path.
arc/testing/trsh/gaussian/galloc.out Adds a Gaussian fixture exhibiting galloc: could not allocate memory. for regression testing.

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

Comment thread arc/job/trsh.py
Comment on lines +983 to +991
if 'MemoryOverallocation' in job_status['keywords'] and server is not None:
reduced_memory = max(memory_gb / 2.0, 4)
if reduced_memory < memory_gb:
couldnt_trsh = False
memory = reduced_memory
logger.info(f'Troubleshooting {job_type} job in {software} for {label} using less memory: {memory} GB '
f'instead of {memory_gb} GB (the node could not allocate the requested amount)')
ess_trsh_methods.append('memory')
else:
Comment thread arc/job/trsh.py
Comment on lines +993 to +996
output_errors.append(
f'Error: Could not troubleshoot {job_type} for {label}! The node could not allocate even '
f'{memory_gb} GB, and ARC is already at its minimum memory request; use a higher-memory node. ')
logger.error(f'Could not troubleshoot {job_type} job in {software} for {label}. The node could not '
A Gaussian galloc/malloc failure means the node could not provide the
requested memory (we asked for too much) - the opposite of Gaussian
internally requesting more memory. Previously both were classified as
'Memory' and troubleshooting increased the request, making a node-capacity
failure worse. Classify the OS-level failure as 'MemoryOverallocation' and
troubleshoot it by halving the request down to a 4 GB floor, giving up with
a clear 'use a higher-memory node' message once at the minimum.

Adds the galloc.out fixture and tests for both the status classification
and the reduce-then-give-up troubleshooting path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alongd alongd force-pushed the linear_ts_bugfix branch from 3d12cf9 to a686be6 Compare July 9, 2026 07:39
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