Loading...
Searching...
No Matches
gpr::neb::OCINEBController Class Reference

#include <gpr/neb/OCINEBController.h>

Public Member Functions

 OCINEBController (OCINEBConfig cfg)
void initBaseline (double baseline_force)
bool baselineSet () const
void recordMmfHandoffForce (double handoff_force, bool handoff_data_ready=false)
bool shouldPrepareMmfHandoff (bool trap_detected=false, bool band_information_exhausted=false, bool current_chain_certificate=false) const
bool shouldTrigger (double convForce, bool ci_active, long climbingImage, long numImages, bool ci_posterior_confident, bool trap_detected=false, std::size_t ntrain_now=0, bool ci_is_energy_maximum=false, bool band_information_exhausted=false, bool oie_acquisition_quiet=false, bool rejected_seed_replay=false, bool current_chain_certificate=false, bool current_saddle_stencil_certificate=false, bool rejected_seed_position_matches=false, bool stagnation_handoff=false) const
void recordMmfPosteriorUpdate ()
void noteMmfRejectSurrogateSnapshot (detail::MmfSurrogateFingerprint surrogate)
 Enter AwaitingFirstTrainingGrowth with the model lease MMF consumed.
void noteMmfRejectActionSnapshot (detail::MmfPosteriorActionFingerprint action)
 Enter the information wait with the posterior action MMF would consume.
void noteMmfSurrogateChange (detail::MmfSurrogateFingerprint surrogate)
void noteMmfActionChange (detail::MmfPosteriorActionFingerprint action)
void noteMmfMinModeProbeConsumed ()
 Record that the rejected action consumed a true-potential mode probe.
detail::MmfPosteriorActionFingerprint previewMmfAction (ActiveLearningSession &session, const NEBPath &path, int ci_image_idx, const GPNEBConfig &neb_config) const
void releaseRecoveryOwnerForCertifiedHandover (const Eigen::VectorXd &owner_position, long owner_image)
void releaseExhaustedRecoveryForCertifiedHandover ()
void openInformationGateAtNoiseFloor (const Eigen::VectorXd &ci_position, detail::MmfSurrogateFingerprint surrogate_now, long climbingImage=-1)
bool rejectedMmfSeedPositionMatches (const Eigen::VectorXd &ci_position, const gpr::AtomsConfiguration *atoms_config=nullptr, long climbingImage=-1) const
bool rejectedMmfSeedReplay (const Eigen::VectorXd &ci_position, detail::MmfSurrogateFingerprint surrogate, long climbingImage=-1, const gpr::AtomsConfiguration *atoms_config=nullptr) const
bool rejectedMmfSeedReplay (const Eigen::VectorXd &ci_position, const detail::MmfPosteriorActionFingerprint &action, long climbingImage=-1, const gpr::AtomsConfiguration *atoms_config=nullptr) const
void noteMmfRejectCiPosition (const Eigen::VectorXd &ci_position, long climbingImage=-1)
void recordUncertifiedMmfHookReject (double convForce, const Eigen::VectorXd &ci_position, detail::MmfSurrogateFingerprint surrogate, long climbingImage=-1)
void recordUncertifiedMmfHookReject (double convForce, const Eigen::VectorXd &ci_position, detail::MmfPosteriorActionFingerprint action, long climbingImage=-1)
bool wantsCurrentCiOracle (double convForce, bool ci_active, long climbingImage, long numImages, int outerIter, bool ci_posterior_confident, bool trap_detected=false, std::size_t ntrain_now=0, bool ci_is_energy_maximum=false)
void updateStability (long climbingImage)
void updateStabilityForOuter (long climbingImage, int outerIter)
 Idempotent stability update keyed by GP-NEB outer iteration.
MMFRunResult run (NEBPath &path, int ci_image_idx, NEBOracle &oracle, const GPNEBConfig &neb_config, ActiveLearningSession &session, bool trap_detected=false)
double threshold () const
 Current adaptive trigger threshold (eOn ~current_threshold_~).
OCINEBDiagnostics diagnostics () const
 Snapshot of trigger-gate state for verbose run diagnostics.

Detailed Description

Definition at line 991 of file OCINEBController.h.

Constructor & Destructor Documentation

◆ OCINEBController()

gpr::neb::OCINEBController::OCINEBController ( OCINEBConfig cfg)
explicit

Definition at line 2022 of file OCINEBController.cpp.

2022: cfg_(std::move(cfg)) { }

Member Function Documentation

◆ baselineSet()

bool gpr::neb::OCINEBController::baselineSet ( ) const
inline

Definition at line 999 of file OCINEBController.h.

1000 {
1001 return baseline_force_ > 0.0;
1002 }

◆ diagnostics()

OCINEBDiagnostics gpr::neb::OCINEBController::diagnostics ( ) const
inlinenodiscard

Snapshot of trigger-gate state for verbose run diagnostics.

Definition at line 1194 of file OCINEBController.h.

1195 {
1196 return {current_threshold_,
1197 baseline_force_,
1198 soft_quiet_blocked_after_reject_,
1199 pure_reject_lock_,
1200 trap_backoff_active_,
1201 trap_surface_updated_,
1202 uncertified_hook_reject_active_,
1203 oie_quiet_handoff_stalled_,
1204 force_improving_recovery_active_,
1205 trusted_recovery_active_,
1206 exhausted_recovery_reject_active_,
1207 trusted_retry_reject_force_,
1208 mmf_info_gate_,
1209 mmf_surrogate_at_last_reject_,
1210 mmf_reject_climbing_image_,
1211 recovery_owner_image_};
1212 }

◆ initBaseline()

void gpr::neb::OCINEBController::initBaseline ( double baseline_force)

Seed the adaptive threshold from the first residual whose resulting adaptive bar remains above force_tolerance. Smaller bars cannot lease MMF before NEB convergence.

Definition at line 2161 of file OCINEBController.cpp.

2162{
2163 baseline_force_ = baseline_force;
2164 // Adaptive seed only: trigger_factor * baseline. No tol-multiple cap.
2165 current_threshold_ = baseline_force_ * cfg_.trigger_factor;
2166}

◆ noteMmfActionChange()

void gpr::neb::OCINEBController::noteMmfActionChange ( detail::MmfPosteriorActionFingerprint action)

Advance when the live GP posterior changes the first MMF decision, mode, or resolved trial geometry at the rejected seed.

Definition at line 2497 of file OCINEBController.cpp.

2499{
2500 const bool changed_since_reject =
2501 detail::mmfPosteriorActionChanged(action, mmf_action_at_last_reject_);
2502 if (changed_since_reject) {
2503 min_mode_probe_spent_ = false;
2504 }
2505 const bool was_waiting = mmf_info_gate_ != detail::MmfInformationGate::Open;
2506 if (was_waiting && changed_since_reject) {
2507 mmf_info_gate_ = detail::MmfInformationGate::Open;
2508 }
2509 if (mmf_info_gate_ == detail::MmfInformationGate::Open) {
2510 uncertified_hook_reject_active_ = false;
2511 }
2512 if (was_waiting && changed_since_reject &&
2513 mmf_info_gate_ == detail::MmfInformationGate::Open) {
2514 trap_surface_updated_ = true;
2515 for (auto& [_, state]: ci_adaptive_state_) {
2516 if (state.trap_backoff_active) {
2517 state.trap_surface_updated = true;
2518 }
2519 }
2520 }
2521}

◆ noteMmfMinModeProbeConsumed()

void gpr::neb::OCINEBController::noteMmfMinModeProbeConsumed ( )
inline

Record that the rejected action consumed a true-potential mode probe.

Definition at line 1056 of file OCINEBController.h.

1057 {
1058 min_mode_probe_spent_ = true;
1059 pending_min_mode_probe_lease_ = false;
1060 trap_surface_updated_ = false;
1061 uncertified_hook_reject_active_ = false;
1062 }

◆ noteMmfRejectActionSnapshot()

void gpr::neb::OCINEBController::noteMmfRejectActionSnapshot ( detail::MmfPosteriorActionFingerprint action)

Enter the information wait with the posterior action MMF would consume.

Definition at line 2469 of file OCINEBController.cpp.

2471{
2472 using Gate = detail::MmfInformationGate;
2473 mmf_info_gate_ = action.action.valid ? Gate::AwaitingActionChange
2474 : Gate::AwaitingFirstTrainingGrowth;
2475 mmf_surrogate_at_last_reject_ = action.surrogate;
2476 mmf_action_at_last_reject_ = std::move(action);
2477}

◆ noteMmfRejectCiPosition()

void gpr::neb::OCINEBController::noteMmfRejectCiPosition ( const Eigen::VectorXd & ci_position,
long climbingImage = -1 )
inline

Record the seed geometry of a rejected burst (see ~openInformationGateAtNoiseFloor~).

Definition at line 1138 of file OCINEBController.h.

1140 {
1141 mmf_reject_ci_position_ = ci_position;
1142 mmf_reject_climbing_image_ = climbingImage;
1143 }

◆ noteMmfRejectSurrogateSnapshot()

void gpr::neb::OCINEBController::noteMmfRejectSurrogateSnapshot ( detail::MmfSurrogateFingerprint surrogate)

Enter AwaitingFirstTrainingGrowth with the model lease MMF consumed.

Definition at line 2461 of file OCINEBController.cpp.

2463{
2464 detail::MmfPosteriorActionFingerprint action;
2465 action.surrogate = surrogate;
2466 noteMmfRejectActionSnapshot(std::move(action));
2467}
void noteMmfRejectActionSnapshot(detail::MmfPosteriorActionFingerprint action)
Enter the information wait with the posterior action MMF would consume.
Half surrogate(GaussianProcessRegression &gp, const Eigen::VectorXd &x, Kind kind, const Options &options)

◆ noteMmfSurrogateChange()

void gpr::neb::OCINEBController::noteMmfSurrogateChange ( detail::MmfSurrogateFingerprint surrogate)

Advance the information gate when the model lease MMF would consume changes.

Definition at line 2479 of file OCINEBController.cpp.

2481{
2482 const bool changed_since_reject =
2483 detail::mmfSurrogateChanged(surrogate, mmf_surrogate_at_last_reject_);
2484 const bool was_waiting = mmf_info_gate_ != detail::MmfInformationGate::Open;
2485 if (was_waiting && changed_since_reject) {
2486 mmf_info_gate_ = detail::MmfInformationGate::Open;
2487 uncertified_hook_reject_active_ = false;
2488 trap_surface_updated_ = true;
2489 for (auto& [_, state]: ci_adaptive_state_) {
2490 if (state.trap_backoff_active) {
2491 state.trap_surface_updated = true;
2492 }
2493 }
2494 }
2495}

◆ openInformationGateAtNoiseFloor()

void gpr::neb::OCINEBController::openInformationGateAtNoiseFloor ( const Eigen::VectorXd & ci_position,
detail::MmfSurrogateFingerprint surrogate_now,
long climbingImage = -1 )
inline

The chain posterior is everywhere at or below the likelihood noise floor: the OIE has no admissible information left to supply, so waiting for training growth is vacuous and the burst's own fresh oracle rows are the only remaining information source. Opens the gate – unless the climbing image still sits bitwise at the position of the last REJECTED burst AND the surrogate is unchanged since that reject: the fresh dimer is a deterministic function of its seed geometry and the surrogate it consumes, so re-firing there replays the identical rejected trajectory every outer.

Definition at line 1090 of file OCINEBController.h.

1093 {
1094 if (uncertified_hook_reject_active_) return;
1095 if (detail::shouldSuppressMmfRecoveryRetry(
1096 force_improving_recovery_active_, trusted_recovery_active_,
1097 mmf_info_gate_)) {
1098 return;
1099 }
1100 // A fresh dimer replays the rejected trajectory only when its seed
1101 // geometry AND the surrogate it consumes are both unchanged. Once
1102 // the surrogate has grown since the reject (the burst's own oracle
1103 // rows or recovery-growth evidence), re-firing acts on new
1104 // information; vetoing on position alone pins a converged-quiet CI
1105 // on the rejected seed forever while its true force sits above
1106 // tolerance.
1107 if (rejectedMmfSeedReplay(ci_position, surrogate_now, climbingImage)) {
1108 return;
1109 }
1110 mmf_info_gate_ = detail::MmfInformationGate::Open;
1111 // Rejected-action evidence remains the baseline for replay checks.
1112 // Do NOT clear pure_reject_lock_ here: noise-floor open is not a
1113 // Helped certificate. Only Helped (updateThresholdSuccess) or a
1114 // climbing-image marker change should re-arm MMF after a pure
1115 // restore-reject.
1116 }
bool rejectedMmfSeedReplay(const Eigen::VectorXd &ci_position, detail::MmfSurrogateFingerprint surrogate, long climbingImage=-1, const gpr::AtomsConfiguration *atoms_config=nullptr) const

◆ previewMmfAction()

detail::MmfPosteriorActionFingerprint gpr::neb::OCINEBController::previewMmfAction ( ActiveLearningSession & session,
const NEBPath & path,
int ci_image_idx,
const GPNEBConfig & neb_config ) const
nodiscard

Preview the first action selected by the same seed, model lease, and dimer configuration used by ~run~. The preview never invokes the accurate potential.

Definition at line 2523 of file OCINEBController.cpp.

2526{
2527 detail::MmfPosteriorActionFingerprint result;
2528 const int owner =
2529 session.mmfModelOwner(ci_image_idx, neb_config.dimer_use_global_gp);
2530 result.surrogate = session.surrogateFingerprint(owner);
2531 if (!neb_config.gp_setup) return result;
2532
2533 const std::optional<Eigen::VectorXd> initial_mode =
2534 initialModeForPath(path, ci_image_idx);
2535 if (!initial_mode) return result;
2536 Eigen::VectorXd seed = path.image(ci_image_idx).positions;
2537 const double seed_displacement = detail::resolveMmfSeedDisplacement(
2538 cfg_.perturb_along_tangent, force_improving_recovery_active_,
2539 trusted_recovery_active_);
2540 if (seed_displacement != 0.0) {
2541 seed += seed_displacement * *initial_mode;
2542 }
2543
2544 Eigen::VectorXd seed_gradient;
2545 const int observation_index =
2546 detail::findPositionIndex(session.training_obs, seed);
2547 if (observation_index >= 0 &&
2548 observation_index < session.training_obs.G.rows() &&
2549 session.training_obs.G.cols() == seed.size() &&
2550 session.training_obs.G.row(observation_index).allFinite()) {
2551 seed_gradient =
2552 session.training_obs.G.row(observation_index).transpose();
2553 } else if (detail::positionsCoincide(seed,
2554 path.image(ci_image_idx).positions) &&
2555 path.image(ci_image_idx).gradient.size() == seed.size() &&
2556 path.image(ci_image_idx).gradient.allFinite()) {
2557 seed_gradient = path.image(ci_image_idx).gradient;
2558 } else {
2559 ActiveLearningSession::ModelLease model =
2560 owner >= 0 ? session.acquireImageModel(owner)
2561 : session.acquireGlobalModel();
2562 gpr::Observation predicted;
2563 predicted.R = flatToCoord1xD(seed);
2564 model.gp().calculatePotentialDispatched(predicted);
2565 if (predicted.G.rows() != 1 || predicted.G.cols() != seed.size() ||
2566 !predicted.G.allFinite()) {
2567 result.surrogate = session.surrogateFingerprint(owner);
2568 return result;
2569 }
2570 seed_gradient = predicted.G.row(0).transpose();
2571 }
2572
2573 return detail::probeMmfPosteriorAction(
2574 session, ci_image_idx, neb_config.dimer_use_global_gp, seed,
2575 seed_gradient, *initial_mode, neb_config, cfg_);
2576}

◆ recordMmfHandoffForce()

void gpr::neb::OCINEBController::recordMmfHandoffForce ( double handoff_force,
bool handoff_data_ready = false )

Definition at line 2168 of file OCINEBController.cpp.

2170{
2171 if (!std::isfinite(handoff_force) || handoff_force <= 0.0) {
2172 oie_quiet_handoff_stalled_ = false;
2173 return;
2174 }
2175 if (handoff_data_ready) {
2176 oie_quiet_handoff_stalled_ =
2177 std::isfinite(best_oie_quiet_handoff_force_) &&
2178 handoff_force >= best_oie_quiet_handoff_force_;
2179 if (!std::isfinite(best_oie_quiet_handoff_force_) ||
2180 handoff_force < best_oie_quiet_handoff_force_) {
2181 best_oie_quiet_handoff_force_ = handoff_force;
2182 }
2183 } else {
2184 oie_quiet_handoff_stalled_ = false;
2185 best_oie_quiet_handoff_force_ =
2186 std::numeric_limits<double>::quiet_NaN();
2187 }
2188 retireTrustedRetryIfProgressed(handoff_force);
2189 if (baselineSet()) {
2190 // eOn adaptive: baseline is fixed at first seed until a burst updates
2191 // the threshold via success/backoff. Do not chase every lower residual.
2192 return;
2193 }
2194 // Seed only from a handoff-ready geometry: either the whole band is quiet
2195 // or the current saddle stencil is exactly measured. The adaptive force
2196 // bar still governs the MMF lease.
2197 if (!handoff_data_ready) {
2198 return;
2199 }
2200 // Seed only when the resulting adaptive threshold remains above the
2201 // convergence force. A smaller bar cannot lease MMF before NEB convergence.
2202 if (!std::isfinite(cfg_.trigger_factor) || cfg_.trigger_factor <= 0.0) {
2203 return;
2204 }
2205 const double force_tolerance = forceTolerance();
2206 if (std::isfinite(force_tolerance) && force_tolerance > 0.0) {
2207 const double minimum_seed_force = force_tolerance / cfg_.trigger_factor;
2208 if (handoff_force <= minimum_seed_force) {
2209 return;
2210 }
2211 }
2212 initBaseline(handoff_force);
2213}
void initBaseline(double baseline_force)

◆ recordMmfPosteriorUpdate()

void gpr::neb::OCINEBController::recordMmfPosteriorUpdate ( )

Record that retained MMF observations have refactorized the GP posterior used by the trap decision.

Definition at line 2456 of file OCINEBController.cpp.

2457{
2458 trap_surface_updated_ = true;
2459}

◆ recordUncertifiedMmfHookReject() [1/2]

void gpr::neb::OCINEBController::recordUncertifiedMmfHookReject ( double convForce,
const Eigen::VectorXd & ci_position,
detail::MmfPosteriorActionFingerprint action,
long climbingImage = -1 )

Definition at line 2630 of file OCINEBController.cpp.

2633{
2634 if (baselineSet()) {
2635 updateThresholdBackoff(convForce);
2636 } else {
2637 trap_backoff_active_ = true;
2638 trap_surface_updated_ = false;
2639 soft_quiet_blocked_after_reject_ = true;
2640 }
2641 force_improving_recovery_active_ = false;
2642 trusted_recovery_active_ = false;
2643 recovery_owner_image_ = -1;
2644 noteMmfRejectActionSnapshot(std::move(action));
2645 noteMmfRejectCiPosition(ci_position, climbingImage);
2646 uncertified_hook_reject_active_ = true;
2647 // Hook-rejected Helped restores the CI (side saddle / below-endpoint): a
2648 // pure restore. Without pure-lock Baker 08 re-fired the same Helped→hook
2649 // reject loop.
2650 if (detail::isMmfAdaptiveThresholdSeeded(current_threshold_) &&
2651 std::isfinite(convForce) && convForce > 0.0) {
2652 pure_reject_lock_ = true;
2653 pure_reject_force_ = convForce;
2654 }
2655}
void noteMmfRejectCiPosition(const Eigen::VectorXd &ci_position, long climbingImage=-1)

◆ recordUncertifiedMmfHookReject() [2/2]

void gpr::neb::OCINEBController::recordUncertifiedMmfHookReject ( double convForce,
const Eigen::VectorXd & ci_position,
detail::MmfSurrogateFingerprint surrogate,
long climbingImage = -1 )

Treat a force-converged MMF burst that failed GP-NEB's on-path certificate as a rejected lease for adaptive-trigger purposes.

Definition at line 2620 of file OCINEBController.cpp.

2623{
2624 detail::MmfPosteriorActionFingerprint action;
2625 action.surrogate = surrogate;
2626 recordUncertifiedMmfHookReject(convForce, ci_position, std::move(action),
2627 climbingImage);
2628}
void recordUncertifiedMmfHookReject(double convForce, const Eigen::VectorXd &ci_position, detail::MmfSurrogateFingerprint surrogate, long climbingImage=-1)

◆ rejectedMmfSeedPositionMatches()

bool gpr::neb::OCINEBController::rejectedMmfSeedPositionMatches ( const Eigen::VectorXd & ci_position,
const gpr::AtomsConfiguration * atoms_config = nullptr,
long climbingImage = -1 ) const
nodiscard

Definition at line 2052 of file OCINEBController.cpp.

2055{
2056 if (mmf_reject_ci_position_.size() == 0 ||
2057 mmf_reject_ci_position_.size() != ci_position.size()) {
2058 return false;
2059 }
2060 if ((mmf_reject_ci_position_.array() == ci_position.array()).all()) {
2061 return true;
2062 }
2063 const bool same_reject_marker = climbingImage < 0 ||
2064 mmf_reject_climbing_image_ < 0 ||
2065 climbingImage == mmf_reject_climbing_image_;
2066 if (!same_reject_marker) {
2067 return false;
2068 }
2069 if (atoms_config == nullptr || !(cfg_.max_burst_displacement > 0.0)) {
2070 return false;
2071 }
2072 // Still inside the burst trust ball of the same rejected seed marker:
2073 // EMD metric, same scale as observation commit / recovery trust.
2074 return detail::shouldRetainMmfObservation(
2075 ci_position, mmf_reject_ci_position_, *atoms_config,
2076 cfg_.max_burst_displacement);
2077}

◆ rejectedMmfSeedReplay() [1/2]

bool gpr::neb::OCINEBController::rejectedMmfSeedReplay ( const Eigen::VectorXd & ci_position,
const detail::MmfPosteriorActionFingerprint & action,
long climbingImage = -1,
const gpr::AtomsConfiguration * atoms_config = nullptr ) const
nodiscard

Definition at line 2092 of file OCINEBController.cpp.

2096{
2097 if (!rejectedMmfSeedPositionMatches(ci_position, atoms_config,
2098 climbingImage)) {
2099 return false;
2100 }
2101 return !detail::mmfPosteriorActionChanged(action,
2102 mmf_action_at_last_reject_);
2103}
bool rejectedMmfSeedPositionMatches(const Eigen::VectorXd &ci_position, const gpr::AtomsConfiguration *atoms_config=nullptr, long climbingImage=-1) const

◆ rejectedMmfSeedReplay() [2/2]

bool gpr::neb::OCINEBController::rejectedMmfSeedReplay ( const Eigen::VectorXd & ci_position,
detail::MmfSurrogateFingerprint surrogate,
long climbingImage = -1,
const gpr::AtomsConfiguration * atoms_config = nullptr ) const
nodiscard

A deterministic replay requires both the rejected seed geometry and the surrogate information consumed by MMF to be unchanged.

Definition at line 2079 of file OCINEBController.cpp.

2083{
2084 if (!rejectedMmfSeedPositionMatches(ci_position, atoms_config,
2085 climbingImage)) {
2086 return false;
2087 }
2088 return !detail::mmfSurrogateChanged(surrogate,
2089 mmf_surrogate_at_last_reject_);
2090}

◆ releaseExhaustedRecoveryForCertifiedHandover()

void gpr::neb::OCINEBController::releaseExhaustedRecoveryForCertifiedHandover ( )

Retire an exhausted rejected-saddle lease after a different candidate carries the complete true-PES handover certificate.

Definition at line 2601 of file OCINEBController.cpp.

2602{
2603 if (!exhausted_recovery_reject_active_) return;
2604 exhausted_recovery_reject_active_ = false;
2605 soft_quiet_blocked_after_reject_ = false;
2606 pure_reject_lock_ = false;
2607 pure_reject_force_ = std::numeric_limits<double>::quiet_NaN();
2608 trap_backoff_active_ = false;
2609 trap_surface_updated_ = false;
2610 uncertified_hook_reject_active_ = false;
2611 oie_quiet_handoff_stalled_ = false;
2612 best_oie_quiet_handoff_force_ = std::numeric_limits<double>::quiet_NaN();
2613 mmf_info_gate_ = detail::MmfInformationGate::Open;
2614 mmf_surrogate_at_last_reject_ = {};
2615 mmf_action_at_last_reject_ = {};
2616 mmf_reject_ci_position_.resize(0);
2617 mmf_reject_climbing_image_ = -1;
2618}

◆ releaseRecoveryOwnerForCertifiedHandover()

void gpr::neb::OCINEBController::releaseRecoveryOwnerForCertifiedHandover ( const Eigen::VectorXd & owner_position,
long owner_image )

Retire a stale recovery owner after another saddle candidate carries posterior confidence and an exact true-PES handover stencil.

Definition at line 2578 of file OCINEBController.cpp.

2580{
2581 if (!detail::activeMmfRecoveryOwnsClimbingImage(
2582 force_improving_recovery_active_, trusted_recovery_active_)) {
2583 return;
2584 }
2585 if (force_improving_recovery_active_) {
2586 pure_reject_lock_ = false;
2587 pure_reject_force_ = std::numeric_limits<double>::quiet_NaN();
2588 }
2589 force_improving_recovery_active_ = false;
2590 trusted_recovery_active_ = false;
2591 recovery_owner_image_ = -1;
2592 trusted_retry_reject_force_ = std::numeric_limits<double>::quiet_NaN();
2593 trap_surface_updated_ = false;
2594 mmf_info_gate_ = detail::MmfInformationGate::Open;
2595 mmf_surrogate_at_last_reject_ = {};
2596 mmf_action_at_last_reject_ = {};
2597 exhausted_recovery_reject_active_ = true;
2598 noteMmfRejectCiPosition(owner_position, owner_image);
2599}

◆ run()

MMFRunResult gpr::neb::OCINEBController::run ( NEBPath & path,
int ci_image_idx,
NEBOracle & oracle,
const GPNEBConfig & neb_config,
ActiveLearningSession & session,
bool trap_detected = false )

Run one MMF burst on the CI image: kick along the seed mode, instantiate AtomicDimer, execute up to max_steps, harvest result + status + alignment. Writes the dimer-translated coord into ~path.image(ci_image_idx)~ on Helped; restores pre-kick coord on PositiveCurvature. ~trap_detected~ routes a trapped-CI burst to a FRESH local surrogate (the standalone gprd path) instead of leasing the over-smoothed session GP: at a GP fixed-point trap the leased global theta would just re-trap the dimer, so a sharp local fit on fresh oracle rows is required.

Definition at line 3152 of file OCINEBController.cpp.

3157{
3158 MMFRunResult result;
3159 pending_min_mode_probe_lease_ = false;
3160 const Eigen::Index ntrain_now = session.training_obs.R.rows();
3161 if (mmf_wait_for_true_sample_ && ntrain_now > mmf_wait_ntrain_) {
3162 mmf_wait_for_true_sample_ = false;
3163 }
3164 if (!rejectedMmfSeedPositionMatches(path.image(ci_image_idx).positions,
3165 &session.atoms_config,
3166 static_cast<long>(ci_image_idx))) {
3167 min_mode_probe_spent_ = false;
3168 }
3169 trap_surface_updated_ = false;
3170 std::vector<StagedDimerObservation> staged_dimer_observations;
3171
3172 // Save pre-MMF position so PositiveCurvature can restore it.
3173 Eigen::VectorXd savedPositions = path.image(ci_image_idx).positions;
3174 // Seed CI energy (absolute PES). The band placed the climbing image near
3175 // the true saddle, which sits strictly above both endpoints. A burst that
3176 // force-converges along a poorly-aligned min-mode can translate the CI down
3177 // a negative-curvature SHOULDER whose energy dips below this seed (and
3178 // below a band endpoint), which the GPNEB true-PES saddle-energy
3179 // certificate then correctly rejects -- the run grinds to the iteration
3180 // cap. Used below to refuse committing such a downhill, un-angle-certified
3181 // Helped geometry.
3182 const bool savedCiEnergyValid =
3183 path.image(ci_image_idx).evaluated &&
3184 std::isfinite(path.image(ci_image_idx).energy);
3185 const double savedCiEnergy = path.image(ci_image_idx).energy;
3186
3187 // Optional operator-specified burst-displacement guard. The default is
3188 // certificate-driven: saddle energy, force, curvature, and adjacent-path
3189 // checks decide whether a Helped handback is admissible. Recovery phases
3190 // derive their trust ball from adjacent path spacing when no operator cap
3191 // is configured.
3192 const double burst_disp_cap = cfg_.max_burst_displacement;
3193
3194 const auto local_spacing_to = [&](int image_idx) -> double {
3195 if (image_idx < 0 || image_idx >= path.numImages()) {
3196 return std::numeric_limits<double>::infinity();
3197 }
3198 const Eigen::VectorXd& neighbor_positions =
3199 path.image(image_idx).positions;
3200 if (neighbor_positions.size() != savedPositions.size() ||
3201 neighbor_positions.size() == 0) {
3202 return std::numeric_limits<double>::infinity();
3203 }
3204 return emdDistance(savedPositions, neighbor_positions,
3205 session.atoms_config);
3206 };
3207 const double recovery_disp_cap =
3208 detail::effectiveMmfRecoveryDisplacementCap(
3209 burst_disp_cap, local_spacing_to(ci_image_idx - 1),
3210 local_spacing_to(ci_image_idx + 1));
3211
3212 path.computeNEBForces();
3213 const double pre_neb_force = path.nebForce(ci_image_idx).norm();
3214 const double pre_force = path.saddleForce(ci_image_idx);
3215 result.previousForce = pre_force;
3216
3217 // ---- Build initial mode (configured -> cached -> path tangent) ----
3218 const std::optional<Eigen::VectorXd> initial_mode =
3219 initialModeForPath(path, ci_image_idx);
3220 if (!initial_mode) {
3221 result.status = MMFStatus::Skipped;
3222 result.newForce = pre_force;
3223 result.alignment = 0.0;
3224 return result;
3225 }
3226 const Eigen::VectorXd initialMode = *initial_mode;
3227
3228 if (!neb_config.rgsaddle_library.empty())
3229 optim::setBofillRgsaddleLibrary(neb_config.rgsaddle_library.c_str());
3230 if (cfg_.rg_minmode_dimer) {
3231 RgsaddleClient dest;
3232 if (dest.load()) {
3233 const Eigen::Index dof = savedPositions.size();
3234 const int64_t n_atoms = dof / 3;
3235 RgMinMode minmode;
3236 if (n_atoms >= 1 && dof == 3 * n_atoms &&
3237 minmode.bind(dest, n_atoms, savedPositions.data(),
3238 initialMode.data(), cfg_.force_tolerance,
3240 std::max(1, cfg_.dimer_max_rot_iter), 1e-3)) {
3241 GprRgsaddleUser surface_user;
3242 surface_user.gp = &session.gp;
3243 gpr_rgsaddle_report_t rg_report{};
3244 const long rg_cap = cfg_.max_steps > 0 ? cfg_.max_steps : 16;
3245 bool rg_ok = false;
3246 for (long s = 0; s < rg_cap; ++s) {
3247 if (!minmode.step(&gprRgsaddleSurface, &surface_user,
3248 rg_report)) {
3249 break;
3250 }
3251 rg_ok = true;
3252 if (rg_report.max_force <= cfg_.force_tolerance) {
3253 break;
3254 }
3255 }
3256 Eigen::VectorXd rg_pos(dof);
3257 if (rg_ok && minmode.position(rg_pos.data()) &&
3258 rg_pos.allFinite() && rg_report.curvature < 0.0) {
3259 path.image(ci_image_idx).positions = rg_pos;
3260 result.status = MMFStatus::Helped;
3261 result.newForce = rg_report.max_force;
3262 result.final_mode_curvature = rg_report.curvature;
3263 result.alignment = std::abs(initialMode.dot(
3264 path.tangentAt(ci_image_idx).normalized()));
3265 result.oracle_calls = static_cast<int>(rg_report.rotations);
3266 result.shouldResetOptimizer = true;
3267 return result;
3268 }
3269 }
3270 }
3271 }
3272
3273 // ---- Kick CI position along the mode ----
3274 Eigen::VectorXd ci_pos = savedPositions;
3275 const double seed_displacement = detail::resolveMmfSeedDisplacement(
3276 cfg_.perturb_along_tangent, force_improving_recovery_active_,
3277 trusted_recovery_active_);
3278 if (seed_displacement != 0.0) {
3279 ci_pos += seed_displacement * initialMode;
3280 }
3281
3282 // ---- Construct dimer ----
3283 //
3284 // We pass ~middle_point~ with R only (no E/G). The dimer's
3285 // ~evaluateAccurateEnergyAndForceAtMidPoint~ then takes the
3286 // ~middle_point_init.E.size() == 0~ branch, which (i) calls the
3287 // oracle once at this position, (ii) sets ~E_zero_level~ to that
3288 // energy, (iii) cuts off ~all_obs.E~ relative to ~E_zero_level~
3289 // *without* clobbering ~all_obs~, and (iv) appends the kicked
3290 // middle point as a fresh row. The alternative (pre-seed E here
3291 // and let the dimer take the else-branch) blows away
3292 // ~init_observations~ in the dimer's first step, which would
3293 // erase every NEB training point from the shared GP's view.
3294 gpr::Observation middle_point;
3295 middle_point.R = flatToCoord1xD(ci_pos);
3296
3297 // Pick the GP the dimer will run against. Prefer the CI image's
3298 // *per-image* GP -- the dimer's burst lives entirely in the CI
3299 // image's neighbourhood, so its trajectory + harvested rows are
3300 // legitimate data for image ~ci_image_idx~'s local surrogate but
3301 // would re-anchor a global theta to the clustered burst region.
3302 // The MMF gate in gpNEB ensures the CI image has enough direct
3303 // active-learning samples before this hook fires, so the
3304 // per-image attach is the common path. Fall back to the global GP
3305 // only if the per-image surrogate is missing.
3306 // The global band GP inherits the full distributed dataset and runs on the
3307 // distributed (ScaLAPACK) backend; the per-image GP is ~5x slower
3308 // (per-image Eigen-Cholesky maintenance + unstable theta on the clustered
3309 // burst rows). The burst's scopedParameterRestore reinstalls the entry
3310 // theta afterward, so the only stated reason for the per-image route
3311 // (re-anchoring the global theta on burst rows) is already protected. Route
3312 // to the global GP by default; per-image stays an explicit opt-in.
3313 const int dimer_model_owner =
3314 session.mmfModelOwner(ci_image_idx, neb_config.dimer_use_global_gp);
3315 const bool per_image_ready = dimer_model_owner >= 0;
3316
3317 atmd::AtomicDimer dimer;
3318 if (neb_config.training_policy != nullptr)
3319 dimer.setTrainingPolicy(neb_config.training_policy);
3320 dimer.setWallClockLimit(neb_config.wall_clock_limit);
3322 // The band index certificate decides the saddle claim.
3323 dimer.setForceStopCertificateStep(0.0);
3324 const bool has_gp = static_cast<bool>(neb_config.gp_setup);
3325 // The burst leases the SESSION GP by default: it is warm on the band's
3326 // accumulated rows around the CI, so the dimer runs on the surrogate and
3327 // pays the oracle only for validation. Bootstrapping a fresh local
3328 // surrogate re-learns the neighbourhood from new oracle rows on EVERY
3329 // burst (~28 calls each; Baker 01 spent 449 of its 642 calls inside 16
3330 // bursts, 70 percent of the budget, versus the ~35-call budget of a
3331 // whole standalone GP-dimer search). Escalate to the fresh fit on
3332 // EVIDENCE, not prediction: (a) trap_detected marks the session GP as
3333 // over-confident-but-inaccurate at the CI, and (b) a rejected burst with
3334 // the same seed and unchanged surrogate information means the leased
3335 // curvature already sent the dimer down a wrong or unproductive mode --
3336 // that retry pays the fresh bootstrap. Boards with lease-always
3337 // lost the systems whose rescue WAS the sharp from-scratch curvature
3338 // (eboard3: 23/25 flipped to failure) while fresh-always burned 70
3339 // percent of the call budget; the failure-triggered escalation takes
3340 // each regime where the evidence points.
3341 detail::MmfPosteriorActionFingerprint dimer_action;
3342 dimer_action.surrogate = session.surrogateFingerprint(dimer_model_owner);
3343 if (rejectedMmfSeedPositionMatches(savedPositions, &session.atoms_config,
3344 static_cast<long>(ci_image_idx))) {
3345 dimer_action =
3346 previewMmfAction(session, path, ci_image_idx, neb_config);
3347 }
3348 const bool reject_latched_here = rejectedMmfSeedReplay(
3349 savedPositions, dimer_action, static_cast<long>(ci_image_idx),
3350 &session.atoms_config);
3351 const bool lease_session_gp =
3352 has_gp && !trap_detected && !reject_latched_here;
3353 Eigen::VectorXd curvature_seed = initialMode;
3354 // A dimer whose oracle failed past its consecutive-failure bound (or at
3355 // its start) ends the climbing-image refinement, not the band: the
3356 // burst is reported failed, the climbing image keeps its measured
3357 // state, and convergence rests on the band's own certificates.
3358 try {
3359 if (neb_config.secant_hessian.seed_curvature) {
3360 const auto* secant = session.imageSecantHessian(ci_image_idx);
3361 const optim::SecantSeed seed =
3362 secant != nullptr
3363 ? optim::secantSeedDirection(*secant, initialMode)
3364 : optim::SecantSeed{};
3365 if (seed.status == optim::SecantSeedStatus::Seeded)
3366 curvature_seed = seed.direction;
3367 else
3368 std::cout << "[secant-seed] climbing-image burst keeps its "
3369 "mode: "
3370 << optim::secantSeedStatusName(seed.status) << "\n";
3371 }
3372 if (lease_session_gp) {
3373 runBurstUnderSessionModelLease(ci_image_idx, oracle, neb_config,
3374 session, curvature_seed,
3375 middle_point, dimer, per_image_ready,
3376 result, staged_dimer_observations);
3377 } else {
3378 runBurstOnTruePotential(oracle, neb_config, session, trap_detected,
3379 curvature_seed, middle_point, dimer,
3380 pre_neb_force, has_gp, result,
3381 staged_dimer_observations);
3382 }
3383 } catch (const OracleSessionRestartRequested&) {
3384 throw;
3385 } catch (const std::runtime_error& error) {
3386 std::cout << "[ocineb] climbing-image dimer stopped by oracle "
3387 "failures: "
3388 << error.what() << "; refinement failed, band kept"
3389 << std::endl;
3390 result.oracle_calls += static_cast<int>(dimer.getTotalForceCalls());
3391 result.status = MMFStatus::Skipped;
3392 result.convergedAfterMMF = false;
3393 result.refinement_failed = true;
3394 path.image(ci_image_idx).positions = savedPositions;
3395 path.computeNEBForces();
3396 return result;
3397 }
3398
3399 // ---- Recovery configuration from the dimer trajectory history --
3400 // OCI-NEB (Goswami et al.): a burst that converged to the saddle
3401 // writes that converged configuration back and caches its mode.
3402 // A burst that did NOT converge -- the alignment criterion aborted
3403 // it, or it exhausted the N_mmf step budget -- advances the
3404 // climbing image to the configuration with the most negative
3405 // curvature found anywhere along the dimer trajectory, recovered
3406 // from the per-phase history. A trajectory that never found a
3407 // negative-curvature mode never approached a saddle: restore.
3408 Eigen::VectorXd dimer_final_pos = dimer.getFinalCoordOfMidPoint();
3409 gpr::Coord final_orient_coord = dimer.getFinalOrientation();
3410 const Eigen::VectorXd finalMode =
3411 final_orient_coord.cols() > 0
3412 ? coordToFlat(final_orient_coord).normalized()
3413 : Eigen::VectorXd();
3414 Eigen::VectorXd currentTangent = path.tangentAt(ci_image_idx).normalized();
3415 result.alignment =
3416 (finalMode.size() == currentTangent.size() && finalMode.size() > 0)
3417 ? std::abs(finalMode.dot(currentTangent))
3418 : 0.0;
3419
3420 const gpr::FieldMatrixd e_zero = dimer.getEnergyZeroLevel();
3421 const double e0 = (e_zero.size() > 0) ? e_zero(0, 0) : 0.0;
3422
3423 // Scan the dimer trajectory for the most-negative-curvature phase.
3424 const std::vector<atmd::AtomicDimer::DimerPhaseRecord>& history =
3425 dimer.getPhaseHistory();
3426 int best_phase = -1;
3427 double best_curv = std::numeric_limits<double>::infinity();
3428 for (int h = 0; h < static_cast<int>(history.size()); ++h) {
3429 if (std::isfinite(history[h].curvature) &&
3430 history[h].curvature < best_curv) {
3431 best_curv = history[h].curvature;
3432 best_phase = h;
3433 }
3434 }
3435 const bool found_saddle_mode = (best_phase >= 0 && best_curv < 0.0);
3436 const bool hit_step_budget =
3437 cfg_.max_steps > 0 &&
3438 dimer.getIterations() >= static_cast<gpr::Index_t>(cfg_.max_steps);
3439
3440 const double helped_emd_disp =
3441 (dimer.getConverged() &&
3442 dimer_final_pos.size() == savedPositions.size())
3443 ? emdDistance(dimer_final_pos, savedPositions, session.atoms_config)
3444 : std::numeric_limits<double>::infinity();
3445 const bool dimerAngleCertified =
3446 found_saddle_mode && dimer.isMinModeAngleCertified();
3447 const bool helpedPathCertified = detail::forceOnlyHelpedPathCertified(
3448 dimerAngleCertified, result.alignment, cfg_.alignment_cos_tol);
3449 // The EMD displacement cap is an anti-run-away heuristic for modes that
3450 // drag the CI off the path. Angle-certified saddles may exceed the local
3451 // displacement guard; force-only Helped remains localized.
3452 const bool helped_ran_away =
3453 detail::shouldRejectUncertifiedHelpedDisplacement(
3454 dimer.getConverged(), dimerAngleCertified, helped_emd_disp,
3455 burst_disp_cap);
3456
3457 const double dimerFinalEnergy = dimer.getFinalEnergy() + e0;
3458 result.final_rotation_omega = dimer.getFinalRotationAngle();
3459 // NEB force at the dimer endpoint (chain objective), same metric as
3460 // force-improving recovery. Used to override the energy-basin guard.
3461 const double helped_neb_force = [&]() -> double {
3462 if (!(dimer.getConverged() &&
3463 dimer_final_pos.size() == savedPositions.size() &&
3464 dimer_final_pos.size() > 0)) {
3465 return std::numeric_limits<double>::infinity();
3466 }
3467 const Eigen::VectorXd g_final = dimer.getFinalGradientAtMidPoint();
3468 detail::ScopedImageState restore(path, ci_image_idx);
3469 path.image(ci_image_idx).positions = dimer_final_pos;
3470 path.image(ci_image_idx).energy = dimerFinalEnergy;
3471 path.image(ci_image_idx).gradient = g_final;
3472 path.image(ci_image_idx).evaluated = true;
3473 path.computeNEBForces();
3474 return path.nebForce(ci_image_idx).norm();
3475 }();
3476 const bool helped_force_improves = std::isfinite(helped_neb_force) &&
3477 std::isfinite(pre_neb_force) &&
3478 helped_neb_force < pre_neb_force;
3479 // Basin guard. The dimer force-converged but lacks a path-local saddle
3480 // certificate, or it translated the climbing image to a geometry whose
3481 // absolute energy fell below the seed CI energy without force progress.
3482 // Both are wrong-direction descents off poorly-aligned modes onto
3483 // negative-curvature shoulders. Restore the band-placed CI so the burst
3484 // can re-trigger with a fresh mode. Strict energy inequality (no
3485 // tolerance) keeps a flat saddle that converges at the seed energy
3486 // acceptable.
3487 //
3488 // Endpoint floor for force-only Helped: even force-improving handbacks are
3489 // refused when the dimer energy sits below either path endpoint.
3490 // Seed-relative descent may still force-improve on ridges above both
3491 // endpoints.
3492 const bool helped_descended_below_seed = savedCiEnergyValid &&
3493 std::isfinite(dimerFinalEnergy) &&
3494 dimerFinalEnergy < savedCiEnergy;
3495 const bool helped_below_endpoints =
3496 detail::shouldRejectForceOnlyHelpedBelowEndpoints(
3497 dimer.getConverged(), dimerAngleCertified, dimerFinalEnergy,
3498 path.image(0).energy, path.image(path.numImages() - 1).energy);
3499 // Apply the caller's optional energy limit with the same oracle-noise
3500 // allowance as the main search.
3501 const double ceiling_slack =
3502 (neb_config.oracle_energy_noise_rms &&
3503 std::isfinite(*neb_config.oracle_energy_noise_rms) &&
3504 *neb_config.oracle_energy_noise_rms > 0.0)
3505 ? *neb_config.oracle_energy_noise_rms
3506 : 0.0;
3507 const bool helped_above_ceiling =
3508 std::isfinite(session.path_energy_ceiling) &&
3509 std::isfinite(dimerFinalEnergy) &&
3510 dimerFinalEnergy > session.path_energy_ceiling + ceiling_slack;
3511 const bool helped_wrong_mode =
3512 !helpedPathCertified || helped_above_ceiling ||
3513 (!dimerAngleCertified &&
3514 (helped_below_endpoints ||
3515 (helped_descended_below_seed && !helped_force_improves)));
3516 const bool search_recovery_portfolio =
3517 detail::shouldSearchMmfRecoveryPortfolio(
3518 dimer.getConverged(), helped_ran_away, helpedPathCertified,
3519 found_saddle_mode);
3520 // The recovery portfolio retains measured evidence from uncertified path
3521 // modes; the basin and displacement guards reject invalid handbacks.
3522
3523 // A true midpoint force under the final tolerance is the result, the
3524 // way Sella returns the geometry of the evaluation that crossed fmax.
3525 // Path-angle evidence is not another force call. A runaway or a point
3526 // above the energy ceiling is not that candidate.
3527 const double dimer_true_force = dimer.getFinalForceNormForConvergence();
3528 const bool dimer_force_under_tolerance =
3529 dimer.getConverged() && std::isfinite(dimer_true_force) &&
3530 dimer_true_force < forceTolerance();
3531 if (dimer.getConverged() && !helped_ran_away && !helped_above_ceiling &&
3532 (dimer_force_under_tolerance || !helped_wrong_mode)) {
3533 // Helped: the dimer reached the saddle-force criterion and certified
3534 // the saddle on its min-mode angle or path-local mode power. Write the
3535 // converged configuration back and cache the mode.
3536 cached_mode_ = finalMode;
3537 has_cached_mode_ = true;
3538 const Eigen::VectorXd g_final = dimer.getFinalGradientAtMidPoint();
3539 path.image(ci_image_idx).positions = dimer_final_pos;
3540 path.image(ci_image_idx).energy = dimerFinalEnergy;
3541 path.image(ci_image_idx).gradient = g_final;
3542 path.image(ci_image_idx).evaluated = true;
3543 result.newForce = saddleForceMagnitude(g_final);
3544 result.status = MMFStatus::Helped;
3545 // Angle/curvature saddle certificate. The dimer converged to a
3546 // negative-curvature mode whose axis is rotation-aligned with the true
3547 // lowest-curvature eigenvector (omega within the dimer's own rotation
3548 // tolerance). found_saddle_mode is the burst-history negative-curvature
3549 // check; isMinModeAngleCertified() couples it with the converged
3550 // omega + curvature. This lets a flat / late saddle whose force lingers
3551 // in (conv_tol, 2 conv_tol) be accepted on the geometry of the saddle,
3552 // not on a force gate the band recompute never clears.
3553 result.min_mode_angle_certified = dimerAngleCertified;
3554 result.final_mode_curvature = dimer.getLatestModeCurvature();
3555 helpedModeCurvatureSlot() = result.final_mode_curvature;
3556 if (isRank0()) {
3557 std::cout << "[ocineb] burst @ outer hook: Helped, dimer "
3558 << "converged to saddle (force " << pre_force << " -> "
3559 << result.newForce
3560 << ", omega=" << result.final_rotation_omega
3561 << ", curv=" << result.final_mode_curvature
3562 << ", angle_certified="
3563 << (result.min_mode_angle_certified ? 1 : 0) << ")"
3564 << std::endl;
3565 }
3566 } else if (dimer.getConverged() && !helped_ran_away && helped_wrong_mode &&
3567 !search_recovery_portfolio) {
3568 // Force-converged on a poorly-aligned min-mode: side saddle below an
3569 // endpoint, or seed-relative descent without force progress. Reject
3570 // and restore the band-placed CI; do not certify convergence or
3571 // collapse thr via Helped success.
3572 path.image(ci_image_idx).positions = savedPositions;
3573 path.image(ci_image_idx).evaluated = true;
3574 has_cached_mode_ = false;
3575 result.status = MMFStatus::Skipped;
3576 result.newForce = pre_force;
3577 result.min_mode_angle_certified = false;
3578 result.rejected_helped_handback = true;
3579 if (!helpedPathCertified) {
3580 result.reject_kind = MMFRejectKind::UncertifiedPath;
3581 } else if (helped_below_endpoints) {
3582 result.reject_kind = MMFRejectKind::ForceOnlyBelowEndpoint;
3583 } else {
3584 result.reject_kind = MMFRejectKind::SeedEnergyDescent;
3585 }
3586 if (isRank0()) {
3587 if (!helpedPathCertified) {
3588 std::cout << "[ocineb] burst @ outer hook: Helped rejected "
3589 << "(force-only lacks path certificate: alignment="
3590 << result.alignment
3591 << ", tol=" << cfg_.alignment_cos_tol
3592 << ", omega=" << result.final_rotation_omega
3593 << "), restored CI position" << std::endl;
3594 } else if (helped_below_endpoints) {
3595 std::cout << "[ocineb] burst @ outer hook: Helped rejected "
3596 << "("
3597 << detail::forceOnlyHelpedBelowEndpointDiagnostic(
3598 dimerFinalEnergy, path.image(0).energy,
3599 path.image(path.numImages() - 1).energy)
3600 << ", omega=" << result.final_rotation_omega
3601 << "), restored CI position" << std::endl;
3602 } else {
3603 std::cout
3604 << "[ocineb] burst @ outer hook: Helped rejected "
3605 << "(unaligned min-mode descended below seed CI energy: "
3606 << dimerFinalEnergy << " < " << savedCiEnergy
3607 << ", omega=" << result.final_rotation_omega
3608 << "), restored CI position" << std::endl;
3609 }
3610 }
3611 } else if (dimer.getConverged() && helped_ran_away) {
3612 // The dimer reported convergence but translated the CI past the
3613 // EMD displacement bound: it followed a spurious downhill mode
3614 // of the per-image GP off the reaction path. A run-away climbs
3615 // along the NEB tangent, so the alignment check stays satisfied
3616 // -- only the EMD bound catches it. Reject and restore.
3617 path.image(ci_image_idx).positions = savedPositions;
3618 path.image(ci_image_idx).evaluated = true;
3619 has_cached_mode_ = false;
3620 result.status = MMFStatus::Skipped;
3621 result.newForce = pre_force;
3622 result.rejected_helped_handback = true;
3623 result.reject_kind = MMFRejectKind::Displacement;
3624 if (isRank0()) {
3625 std::cout << "[ocineb] burst @ outer hook: Helped rejected "
3626 << "(EMD displacement " << helped_emd_disp << " > cap "
3627 << burst_disp_cap
3628 << ", angle_certified=" << (dimerAngleCertified ? 1 : 0)
3629 << ", omega=" << result.final_rotation_omega
3630 << "), restored CI position" << std::endl;
3631 }
3632 } else if (!found_saddle_mode) {
3633 // PositiveCurvature: no negative-curvature mode anywhere along
3634 // the trajectory -- the CI never approached a saddle. The scan has
3635 // no phase that can support another local recovery retry.
3636 path.image(ci_image_idx).positions = savedPositions;
3637 path.image(ci_image_idx).evaluated = true;
3638 has_cached_mode_ = false;
3639 result.status = MMFStatus::PositiveCurvature;
3640 result.newForce = pre_force;
3641 result.recovery_selection_exhausted =
3642 detail::isMmfRecoveryPortfolioExhausted(
3643 /*found_saddle_mode=*/false, /*selected_phase=*/-1,
3644 /*accepted_candidates=*/0);
3645 result.reject_kind = MMFRejectKind::RecoveryPortfolioExhausted;
3646 if (isRank0()) {
3647 std::cout << "[ocineb] burst @ outer hook: PositiveCurvature "
3648 << "(no negative mode along trajectory, min curv = "
3649 << best_curv << "), restored CI position" << std::endl;
3650 }
3651 } else {
3652 // Alignment failure, path-uncertified force convergence, or
3653 // step-budget exhaustion recovers through the negative-curvature
3654 // phase with the strongest accepted true-PES evidence. A recovery
3655 // handback advances the chain without declaring terminal convergence.
3656 std::vector<detail::MmfRecoveryCandidate> recovery_candidates;
3657 recovery_candidates.reserve(history.size());
3658 // Cache true-oracle (E, G) per accepted phase for handback commit.
3659 std::vector<Eigen::VectorXd> true_phase_grad(history.size());
3660 std::vector<double> true_phase_energy(
3661 static_cast<std::size_t>(history.size()),
3662 std::numeric_limits<double>::quiet_NaN());
3663 int reused_oracle_phases = 0;
3664 int oracle_phase_queries = 0;
3665 const double reactant_E = path.image(0).energy;
3666 const double product_E = path.image(path.numImages() - 1).energy;
3667 for (int h = 0; h < static_cast<int>(history.size()); ++h) {
3668 const auto& phase = history[h];
3669 if (!std::isfinite(phase.curvature) || !(phase.curvature < 0.0)) {
3670 continue;
3671 }
3672 const Eigen::VectorXd phase_pos = coordToFlat(phase.position);
3673 if (phase_pos.size() != savedPositions.size() ||
3674 phase_pos.size() == 0) {
3675 continue;
3676 }
3677 const double phase_disp =
3678 emdDistance(phase_pos, savedPositions, session.atoms_config);
3679 // True-PES evaluation: proposal from dimer trajectory, certificate
3680 // from the oracle. Replaces dimer-internal phase energy/gradient
3681 // for recovery scoring and optional handback.
3682 const detail::MmfRecoveryPhaseEvidence recorded_evidence =
3683 detail::recordedMmfRecoveryPhaseEvidence(phase, e0,
3684 phase_pos.size());
3685 double true_E = recorded_evidence.energy;
3686 Eigen::VectorXd true_G = recorded_evidence.gradient;
3687 bool true_pes_evidence_certified =
3688 recorded_evidence.oracle_certified;
3689 if (recorded_evidence.oracle_certified) {
3690 ++reused_oracle_phases;
3691 } else {
3692 try {
3693 const auto true_eval =
3694 detail::evaluateOieOraclePosition(phase_pos, oracle);
3695 true_E = true_eval.first;
3696 true_G = true_eval.second;
3697 true_pes_evidence_certified = true;
3698 ++result.oracle_calls;
3699 ++oracle_phase_queries;
3700 } catch (const OracleSessionRestartRequested&) {
3701 throw;
3702 } catch (...) {
3703 // Preserve the phase as an uncertified fallback when the
3704 // recovery oracle cannot provide its true-PES evidence.
3705 true_E = phase.energy + e0;
3706 true_G = coordToFlat(phase.gradient);
3707 }
3708 }
3709 if (!std::isfinite(true_E) || true_G.size() != phase_pos.size()) {
3710 true_E = phase.energy + e0;
3711 true_G = coordToFlat(phase.gradient);
3712 true_pes_evidence_certified = false;
3713 }
3714 true_phase_energy[static_cast<std::size_t>(h)] = true_E;
3715 true_phase_grad[static_cast<std::size_t>(h)] = true_G;
3716 const double phase_neb_force = [&]() {
3717 detail::ScopedImageState restore(path, ci_image_idx);
3718 path.image(ci_image_idx).positions = phase_pos;
3719 path.image(ci_image_idx).energy = true_E;
3720 path.image(ci_image_idx).gradient = true_G;
3721 path.image(ci_image_idx).evaluated = true;
3722 path.computeNEBForces();
3723 return path.nebForce(ci_image_idx).norm();
3724 }();
3725 const double phase_raw_force =
3726 true_G.size() > 0 ? saddleForceMagnitude(true_G)
3727 : std::numeric_limits<double>::infinity();
3728 // Best residual at the phase (min of NEB and raw). Baseline is
3729 // max(pre_neb, pre_raw); a phase that improves either metric can
3730 // beat that bar. NEB-only scoring rejected Baker 05 recoveries
3731 // when raw improved but NEB did not (or the reverse).
3732 double phase_recovery_force =
3733 std::numeric_limits<double>::infinity();
3734 if (std::isfinite(phase_neb_force) && phase_neb_force > 0.0) {
3735 phase_recovery_force = phase_neb_force;
3736 }
3737 if (std::isfinite(phase_raw_force) && phase_raw_force > 0.0) {
3738 phase_recovery_force =
3739 std::isfinite(phase_recovery_force)
3740 ? std::min(phase_recovery_force, phase_raw_force)
3741 : phase_raw_force;
3742 }
3743 const bool phase_saddle_certified =
3744 true_pes_evidence_certified &&
3745 detail::isTruePesRecoverySaddleCertified(
3746 true_E, phase_raw_force, forceTolerance(), reactant_E,
3747 product_E);
3748 const bool phase_path_mode_certified =
3749 detail::forceOnlyHelpedPathCertified(
3750 /*helped_angle_certified=*/false, phase.reference_alignment,
3751 cfg_.alignment_cos_tol);
3752 recovery_candidates.push_back(
3753 {/*phase=*/h,
3754 /*curvature=*/phase.curvature,
3755 /*recovery_force=*/phase_recovery_force,
3756 /*displacement=*/phase_disp,
3757 /*saddle_energy=*/true_E,
3758 /*saddle_certified=*/phase_saddle_certified,
3759 /*path_mode_certified=*/phase_path_mode_certified,
3760 /*measured_descent_certified=*/
3761 phase.measured_descent_certified});
3762 }
3763 const double recovery_baseline =
3764 detail::mmfRecoveryForceBaseline(pre_neb_force, pre_force);
3765 const double recovery_reference_energy =
3766 savedCiEnergyValid ? savedCiEnergy
3767 : std::numeric_limits<double>::quiet_NaN();
3768 detail::MmfRecoverySelectionStats recovery_selection_stats;
3769 int recovery_phase = detail::chooseMmfRecoveryPhase(
3770 recovery_candidates, recovery_baseline, recovery_disp_cap,
3771 current_threshold_, cfg_.keep_force_improving_burst,
3772 recovery_reference_energy, reactant_E, product_E,
3773 &recovery_selection_stats,
3774 /*allow_directional_out_of_trust_recovery=*/true);
3775 if (detail::shouldAcquireMmfMinModeProbe(
3776 /*found_saddle_mode=*/true, recovery_phase,
3777 recovery_selection_stats.accepted_candidates,
3778 recovery_selection_stats.negative_curvature_candidates,
3779 recovery_selection_stats.force_improving_candidates,
3780 recovery_selection_stats.out_of_trust_candidates)) {
3781 const Eigen::VectorXd& probe_mode =
3782 (finalMode.size() == savedPositions.size() &&
3783 finalMode.allFinite())
3784 ? finalMode
3785 : initialMode;
3786 const double probe_step = detail::mmfMinModeProbeStep(
3787 recovery_disp_cap, seed_displacement,
3788 cfg_.max_burst_displacement);
3789 const Eigen::VectorXd probe_pos = detail::minModeProbePosition(
3790 savedPositions, probe_mode, probe_step);
3791 if (probe_pos.size() == savedPositions.size() &&
3792 !detail::hasPosition(session.training_obs, probe_pos)) {
3793 try {
3794 const auto true_eval =
3795 detail::evaluateOieOraclePosition(probe_pos, oracle);
3796 const double probe_E = true_eval.first;
3797 const Eigen::VectorXd& probe_G = true_eval.second;
3798 ++result.oracle_calls;
3799 if (std::isfinite(probe_E) &&
3800 probe_G.size() == probe_pos.size() &&
3801 probe_G.allFinite()) {
3802 session.appendCurrentChainObservation(
3803 ci_image_idx, probe_pos, probe_E, probe_G);
3804 result.mode_probe_acquired = true;
3805 const double probe_disp = emdDistance(
3806 probe_pos, savedPositions, session.atoms_config);
3807 const double probe_neb_force = [&]() {
3808 detail::ScopedImageState restore(path,
3809 ci_image_idx);
3810 path.image(ci_image_idx).positions = probe_pos;
3811 path.image(ci_image_idx).energy = probe_E;
3812 path.image(ci_image_idx).gradient = probe_G;
3813 path.image(ci_image_idx).evaluated = true;
3814 path.computeNEBForces();
3815 return path.nebForce(ci_image_idx).norm();
3816 }();
3817 const double probe_raw =
3818 probe_G.size() > 0
3819 ? saddleForceMagnitude(probe_G)
3820 : std::numeric_limits<double>::infinity();
3821 double probe_recovery_force =
3822 std::numeric_limits<double>::infinity();
3823 if (std::isfinite(probe_neb_force) &&
3824 probe_neb_force > 0.0) {
3825 probe_recovery_force = probe_neb_force;
3826 }
3827 if (std::isfinite(probe_raw) && probe_raw > 0.0) {
3828 probe_recovery_force =
3829 std::isfinite(probe_recovery_force)
3830 ? std::min(probe_recovery_force, probe_raw)
3831 : probe_raw;
3832 }
3833 const bool probe_saddle_certified =
3834 detail::isTruePesRecoverySaddleCertified(
3835 probe_E, probe_raw, forceTolerance(),
3836 reactant_E, product_E);
3837 const bool accept_probe =
3838 detail::shouldAcceptMmfRecovery(
3839 recovery_baseline, probe_recovery_force,
3840 probe_disp, recovery_disp_cap,
3841 current_threshold_,
3842 cfg_.keep_force_improving_burst,
3843 recovery_reference_energy, probe_E, reactant_E,
3844 product_E, probe_saddle_certified,
3845 /*candidate_path_mode_certified=*/false,
3846 /*candidate_measured_descent_certified=*/
3847 true);
3848 if (isRank0()) {
3849 std::cout << "[ocineb] burst @ outer hook: "
3850 "min-mode true-PES probe "
3851 << "step=" << probe_step
3852 << " disp=" << probe_disp
3853 << " force=" << probe_recovery_force
3854 << " accepted=" << (accept_probe ? 1 : 0)
3855 << std::endl;
3856 }
3857 if (accept_probe) {
3858 path.image(ci_image_idx).positions = probe_pos;
3859 path.image(ci_image_idx).energy = probe_E;
3860 path.image(ci_image_idx).gradient = probe_G;
3861 path.image(ci_image_idx).evaluated = true;
3862 path.computeNEBForces();
3863 result.newForce = probe_raw;
3864 result.trusted_recovery_advanced = true;
3865 result.force_improving_recovery_advanced =
3866 probe_recovery_force < recovery_baseline;
3867 result.recovery_saddle_certified =
3868 probe_saddle_certified;
3869 result.requires_outer_path_refresh = true;
3870 result.recovery_selection_exhausted = false;
3871 result.reject_kind = MMFRejectKind::None;
3872 }
3873 }
3874 } catch (const OracleSessionRestartRequested&) {
3875 throw;
3876 } catch (...) {
3877 }
3878 }
3879 }
3880 has_cached_mode_ = false;
3881 result.status =
3882 hit_step_budget ? MMFStatus::MaxIterations : MMFStatus::Skipped;
3883 if (recovery_phase < 0 && result.trusted_recovery_advanced &&
3884 result.mode_probe_acquired) {
3885 if (isRank0()) {
3886 std::cout << "[ocineb] burst @ outer hook: min-mode probe "
3887 "advanced CI (force "
3888 << pre_force << " -> " << result.newForce << ")\n";
3889 }
3890 } else if (recovery_phase < 0) {
3891 if (recovery_selection_stats.out_of_trust_candidates > 0 &&
3892 recovery_selection_stats.accepted_candidates == 0) {
3893 // Mode walk left the trust ball. Hold MMF until EI (or
3894 // another true oracle) adds a row. A GP recovery trial
3895 // that only moves the climbing image does not count.
3896 mmf_wait_for_true_sample_ = true;
3897 mmf_wait_ntrain_ = session.training_obs.R.rows();
3898 }
3899 result.recovery_selection_exhausted =
3900 detail::isMmfRecoveryPortfolioExhausted(
3901 /*found_saddle_mode=*/true, recovery_phase,
3902 recovery_selection_stats.accepted_candidates);
3903 if (result.recovery_selection_exhausted) {
3904 result.reject_kind = MMFRejectKind::RecoveryPortfolioExhausted;
3905 }
3906 path.image(ci_image_idx).positions = savedPositions;
3907 path.image(ci_image_idx).evaluated = true;
3908 result.newForce = pre_force;
3909 if (isRank0()) {
3910 std::cout
3911 << "[ocineb] burst @ outer hook: recovery rejected "
3912 << "(min curv = " << best_curv << ", candidates="
3913 << recovery_selection_stats.negative_curvature_candidates
3914 << ", invalid="
3915 << recovery_selection_stats.invalid_candidates
3916 << ", force_improving="
3917 << recovery_selection_stats.force_improving_candidates
3918 << ", out_of_trust="
3919 << recovery_selection_stats.out_of_trust_candidates
3920 << ", directional_out_of_trust="
3921 << recovery_selection_stats
3922 .directional_out_of_trust_candidates
3923 << ", threshold_rejected="
3924 << recovery_selection_stats.threshold_rejected_candidates
3925 << ", no_trust_threshold="
3926 << recovery_selection_stats
3927 .no_trust_threshold_rejected_candidates
3928 << ", certified_lower_energy="
3929 << recovery_selection_stats
3930 .certified_lower_energy_candidates
3931 << ", uncertified_lower_energy="
3932 << recovery_selection_stats
3933 .uncertified_lower_energy_candidates
3934 << ", uncertified_energy_descent="
3935 << recovery_selection_stats
3936 .uncertified_energy_descent_candidates
3937 << ", accepted="
3938 << recovery_selection_stats.accepted_candidates
3939 << ", oracle_phase_queries=" << oracle_phase_queries
3940 << ", reused_oracle_phases=" << reused_oracle_phases
3941 << "), restored "
3942 << "CI position" << std::endl;
3943 }
3944 } else {
3945 const atmd::AtomicDimer::DimerPhaseRecord& best =
3946 history[recovery_phase];
3947 const Eigen::VectorXd best_pos = coordToFlat(best.position);
3948 // Prefer true-oracle gradient when available for the selected
3949 // phase.
3950 Eigen::VectorXd best_grad =
3951 (recovery_phase >= 0 &&
3952 recovery_phase < static_cast<int>(true_phase_grad.size()) &&
3953 true_phase_grad[static_cast<std::size_t>(recovery_phase)]
3954 .size() == best_pos.size())
3955 ? true_phase_grad[static_cast<std::size_t>(recovery_phase)]
3956 : coordToFlat(best.gradient);
3957 const double best_true_E =
3958 (recovery_phase >= 0 &&
3959 recovery_phase < static_cast<int>(true_phase_energy.size()) &&
3960 std::isfinite(true_phase_energy[static_cast<std::size_t>(
3961 recovery_phase)]))
3962 ? true_phase_energy[static_cast<std::size_t>(
3963 recovery_phase)]
3964 : best.energy + e0;
3965 const auto selected_candidate = std::find_if(
3966 recovery_candidates.begin(), recovery_candidates.end(),
3967 [recovery_phase](const detail::MmfRecoveryCandidate& c) {
3968 return c.phase == recovery_phase;
3969 });
3970 const double recovery_neb_force =
3971 selected_candidate != recovery_candidates.end()
3972 ? selected_candidate->recovery_force
3973 : std::numeric_limits<double>::infinity();
3974 const double recovery_saddle_energy =
3975 selected_candidate != recovery_candidates.end()
3976 ? selected_candidate->saddle_energy
3977 : std::numeric_limits<double>::infinity();
3978 const double recovery_displacement =
3979 selected_candidate != recovery_candidates.end()
3980 ? selected_candidate->displacement
3981 : std::numeric_limits<double>::infinity();
3982 const double best_force =
3983 (best_grad.size() > 0)
3984 ? saddleForceMagnitude(best_grad)
3985 : std::numeric_limits<double>::infinity();
3986 const bool reject_uncertified_handback =
3987 !(selected_candidate != recovery_candidates.end() &&
3988 selected_candidate->path_mode_certified &&
3989 selected_candidate->measured_descent_certified) &&
3990 detail::shouldRejectUncertifiedMmfRecoveryHandback(
3991 best_force, recovery_displacement, recovery_disp_cap,
3992 forceTolerance());
3993 if (reject_uncertified_handback) {
3994 path.image(ci_image_idx).positions = savedPositions;
3995 path.image(ci_image_idx).evaluated = true;
3996 result.newForce = pre_force;
3997 if (isRank0()) {
3998 std::cout << "[ocineb] burst @ outer hook: recovery "
3999 << "rejected (EMD displacement "
4000 << recovery_displacement << " > cap "
4001 << recovery_disp_cap << ", raw force "
4002 << best_force << " within convergence band), "
4003 << "restored CI position" << std::endl;
4004 }
4005 } else {
4006 path.image(ci_image_idx).positions = best_pos;
4007 path.image(ci_image_idx).energy = best_true_E;
4008 path.image(ci_image_idx).gradient = best_grad;
4009 path.image(ci_image_idx).evaluated = true;
4010 result.newForce = best_force;
4011 result.trusted_recovery_advanced = true;
4012 // Curvature + force saddle certificate for a burst that
4013 // exhausted its phase/step budget without the dimer declaring
4014 // full convergence (the common 08/20 path: the dimer finds a
4015 // clear negative-curvature mode and drives the chain NEB force
4016 // down, but a flat / late saddle keeps the raw force in the
4017 // (conv_tol, 2 conv_tol) band so getConverged() never fires).
4018 // Recovery must not set min_mode_angle_certified from
4019 // curvature + force alone (no rotation omega): that
4020 // pseudo-angle let Baker 17 accept a high false ridge while
4021 // Helped angle-primary exit fired. Force + negative curvature
4022 // (final_mode_curvature) is the recovery acceptance path;
4023 // true omega cert remains Helped-only
4024 // (isMinModeAngleCertified).
4025 result.min_mode_angle_certified = false;
4026 result.final_mode_curvature = best.curvature;
4027 const bool recovery_saddle_certified =
4028 selected_candidate != recovery_candidates.end() &&
4029 selected_candidate->saddle_certified;
4030 result.recovery_saddle_certified = recovery_saddle_certified;
4031 result.requires_outer_path_refresh = !recovery_saddle_certified;
4032 result.certified_lower_saddle_advanced =
4033 recovery_saddle_certified &&
4034 detail::isLowerValidSaddleEnergy(recovery_reference_energy,
4035 recovery_saddle_energy,
4036 reactant_E, product_E);
4037 if (isRank0()) {
4038 std::cout
4039 << "[ocineb] burst @ outer hook: "
4040 << detail::trustedRecoveryAdvanceDiagnostic(
4042 recovery_phase, history.size(), best.curvature,
4043 recovery_baseline, recovery_neb_force, pre_force,
4044 best_force, recovery_reference_energy,
4045 recovery_saddle_energy, reactant_E, product_E,
4046 recovery_saddle_certified)
4047 << std::endl;
4048 }
4049 }
4050 }
4051 }
4052
4053 const auto training_revision_before = session.trainingRevision();
4054 // Accurate dimer rows remain useful even when their geometry is rejected.
4055 // Helped commits its trajectory, trusted recovery certifies the accepted
4056 // chain row, and restore-reject commits only rows inside the local-spacing
4057 // trust ball.
4058 const bool harvest_helped_trajectory = result.status == MMFStatus::Helped;
4059 if (harvest_helped_trajectory) {
4060 for (std::size_t si = 0; si < staged_dimer_observations.size(); ++si) {
4061 const StagedDimerObservation& staged =
4062 staged_dimer_observations[si];
4063 const bool is_final =
4064 staged.positions.size() == dimer_final_pos.size() &&
4065 (staged.positions.array() == dimer_final_pos.array()).all();
4066 if (!is_final && !detail::shouldCommitMmfObservation(
4067 staged.positions, savedPositions,
4068 session.atoms_config, burst_disp_cap)) {
4069 continue;
4070 }
4071 session.appendObservation(ci_image_idx, staged.positions,
4072 staged.energy, staged.gradient,
4075 }
4076 } else if (detail::shouldHarvestAcceptedRecoveryObservation(
4077 result.trusted_recovery_advanced)) {
4078 const auto& accepted = path.image(ci_image_idx);
4079 detail::appendAcceptedMmfRecoveryObservation(session, ci_image_idx,
4080 accepted);
4081 } else {
4082 for (const StagedDimerObservation& staged: staged_dimer_observations) {
4083 if (!detail::shouldHarvestRejectedMmfObservation(
4084 harvest_helped_trajectory, result.trusted_recovery_advanced,
4085 staged.positions, savedPositions, session.atoms_config,
4086 recovery_disp_cap)) {
4087 continue;
4088 }
4089 session.appendObservation(ci_image_idx, staged.positions,
4090 staged.energy, staged.gradient,
4093 }
4094 }
4095 if (session.trainingRevision() != training_revision_before) {
4096 (void)session.refitGPIfTrainingChanged(/*reinit_seeds=*/false);
4098 }
4099
4100 if (isRank0()) {
4101 std::cout << "[ocineb] burst: status="
4102 << static_cast<int>(result.status) << " force " << pre_force
4103 << " -> " << result.newForce
4104 << " alignment=" << result.alignment
4105 << " threshold=" << current_threshold_
4106 << " oracle+=" << result.oracle_calls << std::endl;
4107 }
4108
4109 // ---- Adaptive threshold update ----
4110 path.computeNEBForces();
4111 const double post_neb_force = path.nebForce(ci_image_idx).norm();
4112 const double threshold_pre_force =
4113 detail::mmfThresholdForce(pre_neb_force, pre_force);
4114 const double threshold_post_force =
4115 detail::mmfThresholdForce(post_neb_force, result.newForce);
4116 // Only a true Helped (dimer force-converged and accepted) clears the
4117 // soft-quiet reject block. Partial force progress tightens the adaptive
4118 // bar while keeping the rejected-position and training-growth guards.
4119 const bool force_improved = std::isfinite(threshold_post_force) &&
4120 std::isfinite(threshold_pre_force) &&
4121 threshold_post_force < threshold_pre_force &&
4122 result.status != MMFStatus::PositiveCurvature;
4123 const bool adaptive_threshold_seeded =
4124 detail::isMmfAdaptiveThresholdSeeded(current_threshold_);
4125 recordBurstOutcome(path, ci_image_idx, neb_config, session, savedPositions,
4126 adaptive_threshold_seeded, force_improved,
4127 threshold_pre_force, threshold_post_force, result);
4128
4129 mmf_attempted_ = detail::mmfAttemptConsumedAfterRecovery(
4130 mmf_attempted_, result.trusted_recovery_advanced,
4131 result.requires_outer_path_refresh);
4132
4133 // ---- Final convergence + reset-optimizer decision ----
4134 // Second-order evidence is required: a low force holds at ANY stationary
4135 // point (shoulders, minima), so force alone must not accept the burst.
4136 // Angle-certified or path-certified Helped is a saddle. Recovery uses
4137 // force certification plus negative curvature; unpath-certified Helped is
4138 // restored before it can terminate.
4139 const bool force_certified = detail::mmfForceCertifiedForConvergence(
4140 result.newForce, threshold_post_force, forceTolerance());
4141 const bool helped_angle_certified =
4142 result.status == MMFStatus::Helped && result.min_mode_angle_certified;
4143 const bool helped_path_certified =
4144 result.status == MMFStatus::Helped &&
4145 detail::forceOnlyHelpedPathCertified(
4146 helped_angle_certified, result.alignment, cfg_.alignment_cos_tol);
4147 // Classical no-GP OCINEB measurements on this exact oracle refute
4148 // the earlier locality gate here: the far-walked certified saddles
4149 // it blocked (Baker 19 at 0.456 vs classical 0.4506, Baker 16 at
4150 // 0.281 vs classical 0.280, Baker 17 at 1.3025 vs classical 1.3026)
4151 // were the CLASSICAL answers; the band's own hump was the artifact.
4152 // A certified true-force saddle above both endpoints terminates
4153 // (the pass-candidate check in the hook guards the one genuine
4154 // failure ever observed, a below-endpoint side saddle on 08).
4155 result.convergedAfterMMF =
4156 (dimer_force_under_tolerance && result.status == MMFStatus::Helped) ||
4157 detail::mmfBurstConvergedAfterAcceptance(
4158 result.status, force_certified, helped_angle_certified,
4159 result.final_mode_curvature, helped_path_certified);
4160 result.shouldResetOptimizer =
4161 !path.image(ci_image_idx).positions.isApprox(savedPositions);
4162
4163 // The dimer model lease restores the entry theta and refactorizes
4164 // the attached global or per-image model over the harvested rows.
4165 // The session's active-owner marker matches the singleton factor
4166 // consumed by prediction dispatch.
4167
4168 return result;
4169}
void setWallClockLimit(std::shared_ptr< const gpr::WallClockLimit > limit)
Share an enclosing deadline (used by OCI-NEB and deterministic tests).
Eigen::VectorXd getFinalCoordOfMidPoint() const
Return final coordinates of the middle point.
bool isMinModeAngleCertified() const noexcept
True iff the converged min-mode is angle-certified: a converged phase recorded a finite rotation omeg...
void setForceStopCertificateStep(double step) noexcept
Eigen::VectorXd getFinalGradientAtMidPoint() const
Return the final gradient dE/dR at the middle point.
const gpr::Coord & getFinalOrientation() const
Return final orientation of the dimer.
void setTrainingPolicy(const gpr::policy::TrainingPolicy *policy)
Not owned. The pointer must outlive execute(). Null is the engine.
gpr::FieldMatrixd getEnergyZeroLevel() const
Internal E_zero_level used by the dimer's cutOffEnergy bookkeeping. The energies returned by ~getEner...
gpr::Index_t getTotalForceCalls() const
Return the total number of force calls.
double getFinalForceNormForConvergence() const
Return final force in the configured convergence norm.
double getFinalEnergy() const
Return final energy.
DimerRelaxationTerminationReason getRelaxationTerminationReason() const noexcept
void setProjectRigidModesForConvergence(bool enabled) noexcept
double getFinalRotationAngle() const noexcept
Min-mode rotational angle omega (radians) at the converged midpoint, or NaN if no converged phase rec...
bool getConverged() const
Return true when the final force convergence criterion is met.
const std::vector< DimerPhaseRecord > & getPhaseHistory() const noexcept
Return the per-phase dimer trajectory history.
gpr::Index_t getIterations() const
Return the total number of cycles.
double getLatestModeCurvature() const noexcept
Latest min-mode curvature from a dimer rotation. The force-stop stencil records the returned curvatur...
detail::MmfPosteriorActionFingerprint previewMmfAction(ActiveLearningSession &session, const NEBPath &path, int ci_image_idx, const GPNEBConfig &neb_config) const
static constexpr Kind kOciBurstKind
Definition RgMinMode.h:23
rgsaddle_status_t gprRgsaddleSurface(void *user, rgsaddle_surface_request_t *req)
@ Helped
Mode converged, alignment in tol.
@ MaxIterations
Hit dimer iter cap; usable but no signal.
@ Skipped
Invalid input or mode drifted outside tol.
@ PositiveCurvature
CI was a minimum; restore position.
double saddleForceMagnitude(const Eigen::VectorXd &gradient)
Definition NEBPath.cpp:25
SecantSeed secantSeedDirection(const SecantHessian &secant, const Eigen::VectorXd &current_direction)
const char * secantSeedStatusName(SecantSeedStatus status) noexcept
void setBofillRgsaddleLibrary(const char *path)
FieldMatrixd Coord
Definition Macros.h:35
uint32_t Index_t
Definition Macros.h:17
Eigen::Matrix< double, EigenDynamic, EigenDynamic, FieldMatrixStorage > FieldMatrixd
Definition Macros.h:25
rgsaddle_report_t gpr_rgsaddle_report_t
double energy
energy relative to E_zero_level
double curvature
dimer curvature estimate this phase
gpr::Coord position
midpoint coordinates (1 x D)
gpr::Coord gradient
midpoint gradient (1 x D)

◆ shouldPrepareMmfHandoff()

bool gpr::neb::OCINEBController::shouldPrepareMmfHandoff ( bool trap_detected = false,
bool band_information_exhausted = false,
bool current_chain_certificate = false ) const
nodiscard

Whether MMF has enough scheduler evidence to interrupt GP band work. GP fallback requires a measured trap or certified likelihood-floor exhaustion until its first MMF lease has been consumed.

Definition at line 2226 of file OCINEBController.cpp.

2229{
2230 const bool trap_retry_ready =
2231 trap_detected && (!trap_backoff_active_ || trap_surface_updated_);
2232 const bool certified_band_information_exhausted =
2233 band_information_exhausted && current_chain_certificate;
2234 return cfg_.handoff_policy != MmfHandoffPolicy::GpBandFallback ||
2235 mmf_attempted_ || trap_retry_ready ||
2236 certified_band_information_exhausted;
2237}

◆ shouldTrigger()

bool gpr::neb::OCINEBController::shouldTrigger ( double convForce,
bool ci_active,
long climbingImage,
long numImages,
bool ci_posterior_confident,
bool trap_detected = false,
std::size_t ntrain_now = 0,
bool ci_is_energy_maximum = false,
bool band_information_exhausted = false,
bool oie_acquisition_quiet = false,
bool rejected_seed_replay = false,
bool current_chain_certificate = false,
bool current_saddle_stencil_certificate = false,
bool rejected_seed_position_matches = false,
bool stagnation_handoff = false ) const

True iff the trigger conditions are met for the current NEB state. ~trap_detected~ marks a GP fixed-point trap: the inner GP relaxation has converged but the true oracle force at the climbing image is still above conv_tol. In that state the relative threshold never fires (conv_force cannot fall further on the surrogate), so the trap is its own trigger path. ~stagnation_handoff~ leases the dimer after the band walk has stopped above the force tolerance. It does not lower the bar for a walk that is still descending.

Definition at line 2239 of file OCINEBController.cpp.

2246{
2247 // The band walk has stopped. Lease the dimer when the residual is
2248 // still above the force tolerance. The adaptive bar is for a walk
2249 // that is still descending; it does not apply to this handoff.
2250 if (stagnation_handoff) {
2251 return detail::shouldTriggerMmf(
2252 cfg_, convForce, ci_active, climbingImage, numImages,
2253 /*ci_posterior_confident=*/true, /*current_threshold=*/0.0,
2254 /*trap_detected=*/false, /*trap_backoff_active=*/false,
2255 /*trap_surface_updated=*/false, mmf_info_gate_,
2256 /*ci_is_energy_maximum=*/true,
2257 /*band_information_exhausted=*/false,
2258 /*oie_acquisition_quiet=*/false, /*oie_acquisition_stalled=*/false,
2259 /*certified_recovery_stalled_handoff=*/false,
2260 /*certified_handoff=*/true);
2261 }
2262 if (detail::shouldHoldMmfForExpectedImprovement(
2263 mmf_wait_for_true_sample_, static_cast<Eigen::Index>(ntrain_now),
2264 mmf_wait_ntrain_)) {
2265 return false;
2266 }
2267 if (detail::shouldSuppressMmfRecoveryRetry(force_improving_recovery_active_,
2268 trusted_recovery_active_,
2269 mmf_info_gate_)) {
2270 return false;
2271 }
2272 const bool certified_band_information_exhausted =
2273 band_information_exhausted && current_chain_certificate;
2274 const bool reject_gate_applies_to_ci =
2275 mmf_reject_climbing_image_ < 0 ||
2276 climbingImage == mmf_reject_climbing_image_;
2277 const bool exhausted_recovery_reject_applies =
2278 detail::exhaustedRecoveryRejectAppliesToCi(
2279 exhausted_recovery_reject_active_, mmf_reject_climbing_image_,
2280 climbingImage);
2281 const bool improved_under_backoff =
2282 std::isfinite(current_threshold_) && current_threshold_ > 0.0 &&
2283 std::isfinite(convForce) && convForce <= current_threshold_;
2284 // Residual strictly below pure-reject handoff force. The tracked force
2285 // ratchets with live residuals so geometric progress can reopen the gate
2286 // without pinning re-entry to an initial handoff scale.
2287 const bool improved_since_pure_reject =
2288 pure_reject_lock_ && std::isfinite(pure_reject_force_) &&
2289 pure_reject_force_ > 0.0 && std::isfinite(convForce) &&
2290 convForce < pure_reject_force_;
2291 const bool pure_reject_residual_progress =
2292 detail::shouldLeaseAfterPureRejectProgress(pure_reject_lock_,
2293 improved_under_backoff,
2294 improved_since_pure_reject);
2295 const bool exhausted_quiet_stall_lease =
2296 detail::shouldLeaseAfterExhaustedQuietStall(
2297 pure_reject_lock_, exhausted_recovery_reject_applies,
2298 oie_quiet_handoff_stalled_, oie_acquisition_quiet,
2299 current_chain_certificate, current_saddle_stencil_certificate,
2300 ci_posterior_confident, ci_is_energy_maximum);
2301 // Rejected-seed replay blocks re-fire of the identical geometry. Under-thr
2302 // residual alone is not enough to re-lease the same seed: Baker 02 burned
2303 // ~30 Helped path-cert rejects at F_CI~0.135 on one geometry. Progress
2304 // below pure_reject_force, or a trap, is the only reopen without a move.
2305 const bool rejected_seed_geometry_replay =
2306 rejected_seed_replay || rejected_seed_position_matches;
2307 if (detail::shouldSkipMmfAfterSpentMinModeProbe(
2308 min_mode_probe_spent_, rejected_seed_replay,
2309 rejected_seed_position_matches)) {
2310 return false;
2311 }
2312 if (detail::shouldBlockRejectedSeedReplay(
2313 rejected_seed_geometry_replay, trap_detected,
2314 improved_since_pure_reject, exhausted_quiet_stall_lease)) {
2315 return false;
2316 }
2317 const bool trusted_retry_progress_pending =
2318 trusted_recovery_active_ &&
2319 std::isfinite(trusted_retry_reject_force_) &&
2320 trusted_retry_reject_force_ > 0.0;
2321 const bool force_recovery_stalled_handoff =
2322 detail::isForceImprovingRecoveryStalledHandoff(
2323 force_improving_recovery_active_, ci_posterior_confident,
2324 current_chain_certificate, oie_acquisition_quiet,
2325 oie_quiet_handoff_stalled_);
2326 const bool trusted_recovery_stalled_signal =
2327 detail::isTrustedRecoveryStalledHandoff(
2328 trusted_recovery_active_, ci_posterior_confident,
2329 current_chain_certificate, ci_is_energy_maximum,
2330 oie_acquisition_quiet, oie_quiet_handoff_stalled_);
2331 const bool trusted_recovery_stalled_handoff =
2332 detail::shouldUseTrustedRecoveryStalledHandoff(
2333 trusted_retry_progress_pending, trusted_recovery_stalled_signal);
2334 const bool recovery_stalled_handoff =
2335 force_recovery_stalled_handoff || trusted_recovery_stalled_handoff;
2336 const bool trusted_recovery_progress_handoff =
2337 detail::isTrustedRecoveryProgressHandoff(
2338 trusted_recovery_active_, trusted_retry_reject_force_, convForce,
2339 current_threshold_, ci_posterior_confident, ci_is_energy_maximum,
2340 rejected_seed_replay, current_chain_certificate,
2341 oie_quiet_handoff_stalled_, oie_acquisition_quiet);
2342 const bool refreshed_exhausted_recovery_handoff =
2343 detail::isRefreshedExhaustedRecoveryHandoff(
2344 exhausted_recovery_reject_applies, current_chain_certificate,
2345 current_saddle_stencil_certificate, rejected_seed_replay,
2346 rejected_seed_replay || rejected_seed_position_matches,
2347 ci_posterior_confident, ci_is_energy_maximum);
2348 const bool stale_rejected_seed_handoff =
2349 !exhausted_recovery_reject_applies && !trusted_retry_progress_pending &&
2350 soft_quiet_blocked_after_reject_ && !rejected_seed_replay &&
2351 current_chain_certificate && ci_posterior_confident &&
2352 ci_is_energy_maximum && oie_acquisition_quiet &&
2353 oie_quiet_handoff_stalled_;
2354 // A first exact CI row seeds the adaptive scale but does not void it.
2355 // Certificate-based bar bypass resolves a stalled or recovery handoff;
2356 // ordinary first contact continues reducing the force residual.
2357 const bool certificate_bar_bypass_state =
2358 oie_quiet_handoff_stalled_ || pure_reject_lock_ ||
2359 soft_quiet_blocked_after_reject_ || force_improving_recovery_active_ ||
2360 trusted_recovery_active_;
2361 const bool current_chain_certified_handoff =
2362 certificate_bar_bypass_state &&
2363 detail::isCurrentChainCertifiedHandoff(
2364 trusted_retry_progress_pending, current_chain_certificate,
2365 rejected_seed_replay, ci_posterior_confident, ci_is_energy_maximum,
2366 oie_acquisition_quiet, exhausted_recovery_reject_applies);
2367 const bool current_chain_under_threshold_handoff =
2368 !trusted_retry_progress_pending && current_chain_certificate &&
2369 !rejected_seed_replay && oie_acquisition_quiet &&
2370 std::isfinite(convForce) && convForce > 0.0 &&
2371 std::isfinite(current_threshold_) && current_threshold_ > 0.0 &&
2372 convForce <= current_threshold_;
2373 // An unattempted exact true-PES saddle stencil gives MMF every local row
2374 // it consumes. Bayes confidence and the energy-maximum certificate bind
2375 // that stencil to the active saddle, so the band-scale force bar does not
2376 // withhold the local second-order refinement.
2377 const bool exact_saddle_stencil_handoff =
2378 !mmf_attempted_ && current_saddle_stencil_certificate &&
2379 current_chain_certificate && !rejected_seed_replay &&
2380 ci_posterior_confident && ci_is_energy_maximum;
2381 const bool certified_handoff =
2382 stale_rejected_seed_handoff || current_chain_certified_handoff ||
2383 current_chain_under_threshold_handoff || exact_saddle_stencil_handoff ||
2384 refreshed_exhausted_recovery_handoff || recovery_stalled_handoff ||
2385 trusted_recovery_progress_handoff;
2386 bool soft_quiet = oie_acquisition_quiet;
2387 if (soft_quiet && soft_quiet_blocked_after_reject_ &&
2388 reject_gate_applies_to_ci) {
2389 soft_quiet = improved_under_backoff || recovery_stalled_handoff ||
2390 certified_handoff;
2391 }
2392 const bool soft_quiet_stalled = soft_quiet && oie_quiet_handoff_stalled_;
2393 const bool trap_retry_ready =
2394 trap_detected && (!trap_backoff_active_ || trap_surface_updated_);
2395 // An exact local stencil proves that MMF has current data, but it does not
2396 // prove that the GP band has settled onto the connecting path. GP-assisted
2397 // modes retain the first lease while TPE can still improve the band. A
2398 // measured trap or likelihood-floor exhaustion transfers ownership
2399 // without a system-specific force threshold. Repeated stored CI forces do
2400 // not certify a fixed band while TPE can still move other images.
2401 if (!shouldPrepareMmfHandoff(trap_detected, band_information_exhausted,
2402 current_chain_certificate)) {
2403 return false;
2404 }
2405 // Pure restore-reject lock is global until residual progress,
2406 // recovery-stall handoff, quiet-stall after exhausted recovery, or
2407 // certified noise-floor exhaustion. Soft-quiet and rejected-seed state
2408 // remain CI-scoped below.
2409 // Recovery-stall still leases: force-improving recovery locks at the post
2410 // force, so quiet-stall is the intended re-entry when OIE stops dropping.
2411 if (pure_reject_lock_ && !pure_reject_residual_progress &&
2412 !certified_band_information_exhausted && !recovery_stalled_handoff &&
2413 !certified_handoff && !exhausted_quiet_stall_lease &&
2414 !trap_retry_ready) {
2415 return false;
2416 }
2417 // After a non-Helped burst, soft quiet and confidence reopen under the
2418 // adaptive threshold, after pure-reject residual progress, or via a
2419 // certified/exhausted handoff.
2420 if (soft_quiet_blocked_after_reject_ && reject_gate_applies_to_ci &&
2421 !improved_under_backoff && !trap_detected &&
2422 !certified_band_information_exhausted && !recovery_stalled_handoff &&
2423 !certified_handoff && !exhausted_quiet_stall_lease &&
2424 !pure_reject_residual_progress) {
2425 return false;
2426 }
2427 // Pure-lock residual progress voids the adaptive thr when the CI is also
2428 // the Bayes peak (confidence required). thr often ratchets below the live
2429 // CI residual after recovery backoff (Baker 05: F~1.17, thr~0.77 after
2430 // pure-lock at 1.55). Exhausted quiet-stall is a certified handoff: voids
2431 // the bar so MMF can fire while residual sits above thr (Baker 03).
2432 const double trigger_threshold =
2433 (!baselineSet() && ci_posterior_confident) ? 0.0 : current_threshold_;
2434 const bool pure_reject_residual_handoff =
2435 pure_reject_residual_progress && ci_posterior_confident;
2436 // Stall leases and pure-reject progress still wait out a closed
2437 // information gate. Certified handoff does not: it is the argument
2438 // shouldTriggerMmf decides before that gate.
2439 const bool lease_after_information_gate =
2440 recovery_stalled_handoff || exhausted_quiet_stall_lease ||
2441 pure_reject_residual_handoff || pending_min_mode_probe_lease_;
2442 const bool certified_handoff_beats_gate =
2443 stale_rejected_seed_handoff || current_chain_certified_handoff ||
2444 current_chain_under_threshold_handoff || exact_saddle_stencil_handoff ||
2445 refreshed_exhausted_recovery_handoff ||
2446 trusted_recovery_progress_handoff;
2447 return detail::shouldTriggerMmf(
2448 cfg_, convForce, ci_active, climbingImage, numImages,
2449 ci_posterior_confident, trigger_threshold, trap_detected,
2450 trap_backoff_active_, trap_surface_updated_, mmf_info_gate_,
2451 ci_is_energy_maximum, certified_band_information_exhausted, soft_quiet,
2452 soft_quiet_stalled, lease_after_information_gate,
2453 certified_handoff_beats_gate);
2454}
bool shouldPrepareMmfHandoff(bool trap_detected=false, bool band_information_exhausted=false, bool current_chain_certificate=false) const

◆ threshold()

double gpr::neb::OCINEBController::threshold ( ) const
inline

Current adaptive trigger threshold (eOn ~current_threshold_~).

Definition at line 1188 of file OCINEBController.h.

1189 {
1190 return current_threshold_;
1191 }

◆ updateStability()

void gpr::neb::OCINEBController::updateStability ( long climbingImage)

Track the current climbing image: on a CI-index change, persist the outgoing image's adaptive trigger state and restore the incoming one (also invalidating the cached mode). The handover gate is the GP posterior confidence, so there is no stability counter to keep.

Definition at line 2698 of file OCINEBController.cpp.

2699{
2700 if (climbingImage == previousClimbingImage_) return;
2701 if (previousClimbingImage_ < 0) {
2702 previousClimbingImage_ = climbingImage;
2703 saveAdaptiveState(climbingImage);
2704 return;
2705 }
2706 // The climbing image moved: persist the outgoing image's adaptive
2707 // trigger state and restore the incoming one.
2708 saveAdaptiveState(previousClimbingImage_);
2709 previousClimbingImage_ = climbingImage;
2710 loadAdaptiveState(climbingImage);
2711 // FI pure-lock post residual is image-local; pure-restore stays global.
2712 const detail::PureLockHopState hop = detail::pureLockStateAfterCiHop(
2713 {pure_reject_lock_, pure_reject_force_,
2714 force_improving_recovery_active_, trusted_recovery_active_});
2715 pure_reject_lock_ = hop.pure_reject_lock;
2716 pure_reject_force_ = hop.pure_reject_force;
2717 force_improving_recovery_active_ = hop.force_improving_recovery_active;
2718 trusted_recovery_active_ = hop.trusted_recovery_active;
2719 if (!detail::activeMmfRecoveryOwnsClimbingImage(
2720 force_improving_recovery_active_, trusted_recovery_active_)) {
2721 recovery_owner_image_ = -1;
2722 }
2723}

◆ updateStabilityForOuter()

void gpr::neb::OCINEBController::updateStabilityForOuter ( long climbingImage,
int outerIter )

Idempotent stability update keyed by GP-NEB outer iteration.

Definition at line 2725 of file OCINEBController.cpp.

2727{
2728 if (outerIter == lastStabilityOuter_ &&
2729 climbingImage == lastStabilityClimbingImage_) {
2730 return;
2731 }
2732 updateStability(climbingImage);
2733 lastStabilityOuter_ = outerIter;
2734 lastStabilityClimbingImage_ = climbingImage;
2735}
void updateStability(long climbingImage)

◆ wantsCurrentCiOracle()

bool gpr::neb::OCINEBController::wantsCurrentCiOracle ( double convForce,
bool ci_active,
long climbingImage,
long numImages,
int outerIter,
bool ci_posterior_confident,
bool trap_detected = false,
std::size_t ntrain_now = 0,
bool ci_is_energy_maximum = false )

True iff the GP-NEB picker should spend its current oracle on the climbing image so the MMF hook can run with a true CI force.

Definition at line 2657 of file OCINEBController.cpp.

2661{
2662 if (!cfg_.use_mmf || !ci_active) return false;
2663 updateStabilityForOuter(climbingImage, outerIter);
2664 const bool valid_climbing_image =
2665 climbingImage > 0 && climbingImage <= numImages;
2666 const bool active_recovery_needs_oracle =
2667 detail::activeMmfRecoveryOwnsClimbingImage(
2668 force_improving_recovery_active_, trusted_recovery_active_);
2669 const bool exhausted_recovery_needs_oracle =
2670 detail::shouldRequestCurrentCiOracleForExhaustedRecovery(
2671 exhausted_recovery_reject_active_, mmf_reject_climbing_image_,
2672 climbingImage);
2673 if (valid_climbing_image &&
2674 (active_recovery_needs_oracle || exhausted_recovery_needs_oracle)) {
2675 return true;
2676 }
2677 const bool trap_retry_needs_oracle =
2678 detail::shouldUseSurfaceUpdatedTrapRetryForCurrentCiOracle(
2679 trap_surface_updated_, trusted_recovery_active_,
2680 trusted_retry_reject_force_, convForce, current_threshold_);
2681 const bool effective_trap = trap_detected || trap_retry_needs_oracle;
2682 if (!shouldPrepareMmfHandoff(effective_trap)) return false;
2683 // An unseeded confident saddle requests the exact local data needed to
2684 // decide whether the dimer can consume this geometry. The request builds
2685 // a certificate; it does not itself lease an MMF burst.
2686 if (!baselineSet()) {
2687 const double force_tolerance = forceTolerance();
2688 return climbingImage > 0 && climbingImage <= numImages &&
2689 ci_posterior_confident && ci_is_energy_maximum &&
2690 std::isfinite(convForce) && std::isfinite(force_tolerance) &&
2691 force_tolerance > 0.0 && convForce > force_tolerance;
2692 }
2693 return shouldTrigger(convForce, ci_active, climbingImage, numImages,
2694 ci_posterior_confident, effective_trap, ntrain_now,
2695 ci_is_energy_maximum);
2696}
void updateStabilityForOuter(long climbingImage, int outerIter)
Idempotent stability update keyed by GP-NEB outer iteration.
bool shouldTrigger(double convForce, bool ci_active, long climbingImage, long numImages, bool ci_posterior_confident, bool trap_detected=false, std::size_t ntrain_now=0, bool ci_is_energy_maximum=false, bool band_information_exhausted=false, bool oie_acquisition_quiet=false, bool rejected_seed_replay=false, bool current_chain_certificate=false, bool current_saddle_stencil_certificate=false, bool rejected_seed_position_matches=false, bool stagnation_handoff=false) const

The documentation for this class was generated from the following files: