eOn 3.2.0
Long-timescale dynamics: aKMC, NEB, parallel replica
☾
Toggle main menu visibility
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
#include <string_view>
17
18
namespace
eonc
{
19
class
NudgedElasticBand
;
// forward declaration
20
}
21
22
namespace
eonc::neb
{
23
27
class
OCINEBController
{
28
public
:
29
struct
Config
{
30
bool
use_mmf
;
31
double
trigger_force
;
32
double
trigger_factor
;
33
long
max_steps
;
34
long
ci_stability_count
;
35
double
angle_tol
;
36
double
force_tolerance
;
37
bool
restore_unhelpful
;
38
};
39
40
static
Config
fromParams
(
const
Parameters
¶ms);
41
explicit
OCINEBController
(
const
Config
&cfg);
42
43
void
initBaseline
(
double
baseline_force);
44
45
bool
shouldTrigger
(
double
convForce,
bool
ci_active,
long
climbingImage,
46
long
numImages,
int
ciStabilityCounter)
const
;
47
48
struct
MMFResult
{
49
double
newForce
;
50
bool
convergedAfterMMF
;
51
bool
shouldResetOptimizer
;
52
};
53
54
MMFResult
run
(
eonc::NudgedElasticBand
&
neb
,
double
convForce);
55
57
static
double
forceMeasure
(
const
AtomMatrix
&freeForces, std::string_view metric);
58
59
// Help is the walked image's raw force, not band convergenceForce().
60
// After a downhill dimer step maxEnergyImage can hop; the band CI
61
// force is then a neighbor and is the wrong score for restore.
62
// Status -1 left the band tangent. A lower walked force on that
63
// abort is not help; run() keeps the image and applies the linear
64
// penalty. Status -2 is positive curvature.
65
static
bool
walkHelped
(
double
walkedForce,
double
convForce,
int
mmfStatus) {
66
return
walkedForce < convForce && mmfStatus != -1 && mmfStatus != -2;
67
}
68
69
// Positive curvature (status -2) is a well, not a saddle. A band
70
// force under tolerance after that walk is not convergence; run()
71
// restores the climbing image first.
72
static
bool
convergedClimb
(
double
bandForce,
double
forceTolerance,
73
int
mmfStatus) {
74
return
bandForce < forceTolerance && mmfStatus != -2;
75
}
76
77
void
resetStability
() {
ciStabilityCounter_
= 0; }
78
void
updateStability
(
long
climbingImage);
79
int
stabilityCount
()
const
{
return
ciStabilityCounter_
; }
80
double
threshold
()
const
{
return
current_threshold_
; }
81
82
private
:
83
Config
cfg_
;
84
double
current_threshold_
{-1.0};
85
double
baseline_force_
{-1.0};
86
long
previousClimbingImage_
{-1};
87
int
ciStabilityCounter_
{0};
88
int
mmf_iterations_used_
{0};
89
90
// Warm-start: cache converged eigenvector for next dimer call
91
bool
has_cached_mode_
{
false
};
92
AtomMatrix
cached_mode_
;
93
94
int
runDimer
(
eonc::NudgedElasticBand
&
neb
,
double
&alignment);
95
void
updateThresholdSuccess
(
double
convForce,
double
newForce);
96
void
updateThresholdBackoff
(
double
alignment);
97
};
98
99
}
// namespace eonc::neb
Eigen.h
AtomMatrix
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
Definition
Eigen.h:37
Parameters.h
eonc::NudgedElasticBand
Definition
NudgedElasticBand.h:38
eonc::Parameters
Definition
Parameters.h:35
eonc::neb::OCINEBController::baseline_force_
double baseline_force_
Definition
NEBOcinebController.h:85
eonc::neb::OCINEBController::walkHelped
static bool walkHelped(double walkedForce, double convForce, int mmfStatus)
Definition
NEBOcinebController.h:65
eonc::neb::OCINEBController::shouldTrigger
bool shouldTrigger(double convForce, bool ci_active, long climbingImage, long numImages, int ciStabilityCounter) const
Definition
NEBOcinebController.cpp:61
eonc::neb::OCINEBController::fromParams
static Config fromParams(const Parameters ¶ms)
Definition
NEBOcinebController.cpp:26
eonc::neb::OCINEBController::OCINEBController
OCINEBController(const Config &cfg)
Definition
NEBOcinebController.cpp:41
eonc::neb::OCINEBController::resetStability
void resetStability()
Definition
NEBOcinebController.h:77
eonc::neb::OCINEBController::has_cached_mode_
bool has_cached_mode_
Definition
NEBOcinebController.h:91
eonc::neb::OCINEBController::updateThresholdSuccess
void updateThresholdSuccess(double convForce, double newForce)
Definition
NEBOcinebController.cpp:273
eonc::neb::OCINEBController::updateStability
void updateStability(long climbingImage)
Definition
NEBOcinebController.cpp:75
eonc::neb::OCINEBController::mmf_iterations_used_
int mmf_iterations_used_
Definition
NEBOcinebController.h:88
eonc::neb::OCINEBController::previousClimbingImage_
long previousClimbingImage_
Definition
NEBOcinebController.h:86
eonc::neb::OCINEBController::cached_mode_
AtomMatrix cached_mode_
Definition
NEBOcinebController.h:92
eonc::neb::OCINEBController::run
MMFResult run(eonc::NudgedElasticBand &neb, double convForce)
Definition
NEBOcinebController.cpp:85
eonc::neb::OCINEBController::ciStabilityCounter_
int ciStabilityCounter_
Definition
NEBOcinebController.h:87
eonc::neb::OCINEBController::threshold
double threshold() const
Definition
NEBOcinebController.h:80
eonc::neb::OCINEBController::runDimer
int runDimer(eonc::NudgedElasticBand &neb, double &alignment)
Definition
NEBOcinebController.cpp:185
eonc::neb::OCINEBController::initBaseline
void initBaseline(double baseline_force)
Definition
NEBOcinebController.cpp:55
eonc::neb::OCINEBController::current_threshold_
double current_threshold_
Definition
NEBOcinebController.h:84
eonc::neb::OCINEBController::stabilityCount
int stabilityCount() const
Definition
NEBOcinebController.h:79
eonc::neb::OCINEBController::forceMeasure
static double forceMeasure(const AtomMatrix &freeForces, std::string_view metric)
Measure free-atom forces with the band's configured convergence metric.
Definition
NEBOcinebController.cpp:44
eonc::neb::OCINEBController::updateThresholdBackoff
void updateThresholdBackoff(double alignment)
Definition
NEBOcinebController.cpp:281
eonc::neb::OCINEBController::convergedClimb
static bool convergedClimb(double bandForce, double forceTolerance, int mmfStatus)
Definition
NEBOcinebController.h:72
eonc::neb::OCINEBController::cfg_
Config cfg_
Definition
NEBOcinebController.h:83
eonc::neb
Definition
NEBForceProjection.cpp:18
eonc
RAII resource manager for the ARTn C library with global synchronization.
Definition
ARTnSaddleSearch.cpp:23
eonc::neb::OCINEBController::Config
Definition
NEBOcinebController.h:29
eonc::neb::OCINEBController::Config::angle_tol
double angle_tol
Definition
NEBOcinebController.h:35
eonc::neb::OCINEBController::Config::restore_unhelpful
bool restore_unhelpful
Definition
NEBOcinebController.h:37
eonc::neb::OCINEBController::Config::force_tolerance
double force_tolerance
Definition
NEBOcinebController.h:36
eonc::neb::OCINEBController::Config::max_steps
long max_steps
Definition
NEBOcinebController.h:33
eonc::neb::OCINEBController::Config::trigger_force
double trigger_force
Definition
NEBOcinebController.h:31
eonc::neb::OCINEBController::Config::ci_stability_count
long ci_stability_count
Definition
NEBOcinebController.h:34
eonc::neb::OCINEBController::Config::use_mmf
bool use_mmf
Definition
NEBOcinebController.h:30
eonc::neb::OCINEBController::Config::trigger_factor
double trigger_factor
Definition
NEBOcinebController.h:32
eonc::neb::OCINEBController::MMFResult
Definition
NEBOcinebController.h:48
eonc::neb::OCINEBController::MMFResult::shouldResetOptimizer
bool shouldResetOptimizer
Definition
NEBOcinebController.h:51
eonc::neb::OCINEBController::MMFResult::newForce
double newForce
Definition
NEBOcinebController.h:49
eonc::neb::OCINEBController::MMFResult::convergedAfterMMF
bool convergedAfterMMF
Definition
NEBOcinebController.h:50
include
eon
NEBOcinebController.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf