Loading...
Searching...
No Matches
NEBOcinebController.h
Go to the documentation of this file.
1/*
2** This file is part of eOn.
3**
4** SPDX-License-Identifier: BSD-3-Clause
5**
6** Copyright (c) 2010--present, eOn Development Team
7** All rights reserved.
8**
9** Repo:
10** https://github.com/TheochemUI/eOn
11*/
12#pragma once
13
14#include "Eigen.h"
15#include "Parameters.h"
16
17namespace eonc {
18class NudgedElasticBand; // forward declaration
19}
20
21namespace eonc::neb {
22
27public:
38
39 static Config fromParams(const Parameters &params);
40 explicit OCINEBController(const Config &cfg);
41
42 void initBaseline(double baseline_force);
43
44 bool shouldTrigger(double convForce, bool ci_active, long climbingImage,
45 long numImages, int ciStabilityCounter) const;
46
52
53 MMFResult run(eonc::NudgedElasticBand &neb, double convForce);
54
55 // Help is the walked image's raw force, not band convergenceForce().
56 // After a downhill dimer step maxEnergyImage can hop; the band CI
57 // force is then a neighbor and is the wrong score for restore.
58 static bool walkHelped(double walkedForce, double convForce, int mmfStatus) {
59 return walkedForce < convForce && mmfStatus != -2;
60 }
61
62 // Positive curvature (status -2) is a well, not a saddle. A band
63 // force under tolerance after that walk is not convergence; run()
64 // restores the climbing image first.
65 static bool convergedClimb(double bandForce, double forceTolerance,
66 int mmfStatus) {
67 return bandForce < forceTolerance && mmfStatus != -2;
68 }
69
71 void updateStability(long climbingImage);
72 int stabilityCount() const { return ciStabilityCounter_; }
73 double threshold() const { return current_threshold_; }
74
75private:
77 double current_threshold_{-1.0};
78 double baseline_force_{-1.0};
82
83 // Warm-start: cache converged eigenvector for next dimer call
84 bool has_cached_mode_{false};
86
87 int runDimer(eonc::NudgedElasticBand &neb, double &alignment);
88 void updateThresholdSuccess(double convForce, double newForce);
89 void updateThresholdBackoff(double alignment);
90};
91
92} // namespace eonc::neb
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
Definition Eigen.h:37
static bool walkHelped(double walkedForce, double convForce, int mmfStatus)
bool shouldTrigger(double convForce, bool ci_active, long climbingImage, long numImages, int ciStabilityCounter) const
static Config fromParams(const Parameters &params)
void updateThresholdSuccess(double convForce, double newForce)
void updateStability(long climbingImage)
MMFResult run(eonc::NudgedElasticBand &neb, double convForce)
int runDimer(eonc::NudgedElasticBand &neb, double &alignment)
void initBaseline(double baseline_force)
void updateThresholdBackoff(double alignment)
static bool convergedClimb(double bandForce, double forceTolerance, int mmfStatus)
RAII resource manager for the ARTn C library with global synchronization.