@@ -1731,6 +1731,75 @@ def _post_sp_actions_composite(
17311731 else :
17321732 self ._finalize_composite (label )
17331733
1734+ def _mrcc_degenerate_short_circuit (self , label : str , job ) -> bool :
1735+ """If a composite δ-term high-leg sub-job errored with the
1736+ ``MRCCDegenerateSystem`` keyword, substitute the sister low-leg's
1737+ recorded path and advance the composite. Returns ``True`` when the
1738+ short-circuit was applied so the caller can skip ``troubleshoot_ess``.
1739+
1740+ Why this exists: for systems too small to accommodate the requested
1741+ CC excitation rank (atomic H, H2 at CCSDT(Q), etc.) MRCC's xmrcc
1742+ bails — there's no determinant space to iterate. The two legs of
1743+ the δ term are mathematically degenerate (all CC ranks reduce to
1744+ HF), so δ = 0 is the correct physical answer. The trsh ladder
1745+ cannot fix this; it must be handled at the protocol level.
1746+
1747+ Conservative on safety:
1748+ * Only fires when keywords contain ``'MRCCDegenerateSystem'``.
1749+ * Only fires when the species has an active composite.
1750+ * Only fires for ``__high`` sub-labels with a recorded ``__low``
1751+ sister in ``output[label]['paths']['sp_composite']``. Low-leg
1752+ failures and high-leg failures without a completed sister fall
1753+ through so the caller's normal trsh path runs.
1754+ """
1755+ keywords = (job .job_status [1 ] or {}).get ('keywords' ) or []
1756+ if 'MRCCDegenerateSystem' not in keywords :
1757+ return False
1758+ protocol = self ._composite_for (label )
1759+ if protocol is None :
1760+ return False
1761+ # Identify which pending sub_label this errored job corresponds to.
1762+ pending = self ._sp_composite_pending .get (label , {})
1763+ failed_sub_label = next (
1764+ (sl for sl , lvl in pending .items () if lvl == job .level ),
1765+ None ,
1766+ )
1767+ if failed_sub_label is None or not failed_sub_label .endswith ('__high' ):
1768+ logger .warning (format_log_event (
1769+ label ,
1770+ "MRCCDegenerateSystem on a non-high sub-job — falling through to trsh" ,
1771+ {"sub_label" : failed_sub_label , "level" : str (job .level )},
1772+ ))
1773+ return False
1774+ sister_low = failed_sub_label [: - len ('__high' )] + '__low'
1775+ completed = self .output .get (label , {}).get ('paths' , {}).get ('sp_composite' , {}) or {}
1776+ sister_path = completed .get (sister_low )
1777+ if not sister_path :
1778+ logger .warning (format_log_event (
1779+ label ,
1780+ "MRCCDegenerateSystem high-leg failed but low-leg not yet recorded — deferring" ,
1781+ {"failed" : failed_sub_label , "sister" : sister_low },
1782+ ))
1783+ return False
1784+ logger .warning (format_log_event (
1785+ label ,
1786+ "MRCC degenerate-system fallback: substituting low-leg energy for high-leg" ,
1787+ {"failed" : failed_sub_label , "sister" : sister_low ,
1788+ "reason" : "Method exceeds determinant space; δ = 0 by symmetry." },
1789+ ))
1790+ # Substitute by re-using the low-leg's path. _record_composite_completion
1791+ # writes the path into output and clears the pending entry — same as a
1792+ # normal completion, but pointing both legs at the same file so they
1793+ # parse to the same energy and the δ evaluates to zero.
1794+ completed_paths = self .output [label ]['paths' ]['sp_composite' ]
1795+ completed_paths [failed_sub_label ] = sister_path
1796+ del pending [failed_sub_label ]
1797+ if pending :
1798+ self ._spawn_composite_pending (label )
1799+ else :
1800+ self ._finalize_composite (label )
1801+ return True
1802+
17341803 def _rehydrate_composite_state (self ) -> None :
17351804 """On scheduler init/restart, seed pending for every species with an active
17361805 composite, rebuild the SpeciesSection for species that already finalized,
@@ -3212,6 +3281,13 @@ def check_sp_job(self,
32123281 if self .species_dict [label ].number_of_atoms == 1 :
32133282 # save the geometry from the sp job for monoatomic species for which no opt/freq jobs will be spawned
32143283 self .output [label ]['paths' ]['geo' ] = job .local_path_to_output_file
3284+ elif self ._mrcc_degenerate_short_circuit (label = label , job = job ):
3285+ # MRCC bailed for a degenerate small-system δ-term high leg
3286+ # (atomic H, H2, etc., where the requested CC excitation rank
3287+ # exceeds the determinant space). The trsh ladder cannot help —
3288+ # cause is intrinsic. Helper substituted the low-leg energy and
3289+ # advanced the composite; nothing further to do here.
3290+ self .save_restart_dict ()
32153291 else :
32163292 self .troubleshoot_ess (label = label ,
32173293 job = job ,
0 commit comments