eOn client
Long-timescale dynamics: aKMC, NEB, parallel replica
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
MinModeSaddleSearch.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 "
EigenmodeStrategy.h
"
16
#include "
Matter.h
"
17
#include "
Optimizer.h
"
18
#include "
SaddleSearchMethod.h
"
19
20
#include <readcon-core.hpp>
21
#include <string>
22
#include <vector>
23
24
namespace
eonc
{
25
26
class
MinModeSaddleSearch
:
public
SaddleSearchMethod
{
27
28
public
:
29
enum
Status
:
int
{
30
// DO NOT CHANGE THE ORDER OF THIS LIST
31
STATUS_GOOD
,
// 0
32
STATUS_INIT
,
// 1
33
STATUS_BAD_NO_CONVEX
,
// 2
34
STATUS_BAD_HIGH_ENERGY
,
// 3
35
STATUS_BAD_MAX_CONCAVE_ITERATIONS
,
// 4
36
STATUS_BAD_MAX_ITERATIONS
,
// 5
37
STATUS_BAD_NOT_CONNECTED
,
// 6
38
STATUS_BAD_PREFACTOR
,
// 7
39
STATUS_BAD_HIGH_BARRIER
,
// 8
40
STATUS_BAD_MINIMA
,
// 9
41
STATUS_FAILED_PREFACTOR
,
// 10
42
STATUS_POTENTIAL_FAILED
,
// 11
43
STATUS_NONNEGATIVE_ABORT
,
// 12
44
STATUS_NONLOCAL_ABORT
,
// 13
45
STATUS_NEGATIVE_BARRIER
,
// 14
46
STATUS_BAD_MD_TRAJECTORY_TOO_SHORT
,
// 15
47
STATUS_BAD_NO_NEGATIVE_MODE_AT_SADDLE
,
// 16
48
STATUS_BAD_NO_BARRIER
,
// 17
49
STATUS_ZEROMODE_ABORT
,
// 18
50
STATUS_OPTIMIZER_ERROR
,
// 19
51
STATUS_DIMER_LOST_MODE
,
// 20
52
STATUS_DIMER_RESTORED_BEST
// 21
53
};
54
56
static
constexpr
std::string_view
statusMessage
(
int
status
) {
57
constexpr
std::string_view msgs[] = {
58
"Success"
,
// 0
59
"Initialized"
,
// 1
60
"Initial displacement unable to reach convex region"
,
// 2
61
"Barrier too high"
,
// 3
62
"Too many iterations in concave region"
,
// 4
63
"Too many iterations"
,
// 5
64
"Saddle is not connected to initial state"
,
// 6
65
"Prefactors not within window"
,
// 7
66
"Energy barrier not within window"
,
// 8
67
"Minimizations from saddle did not converge"
,
// 9
68
"Hessian calculation failed"
,
// 10
69
"Potential evaluation failed"
,
// 11
70
"Nonnegative initial mode, aborting"
,
// 12
71
"Nonlocal abort"
,
// 13
72
"Negative barrier detected"
,
// 14
73
"No reaction found during MD trajectory"
,
// 15
74
"Converged to stationary point with zero negative modes"
,
// 16
75
"No forward barrier found along minimized band"
,
// 17
76
"Zero mode abort"
,
// 18
77
"Optimizer error"
,
// 19
78
"Dimer lost mode"
,
// 20
79
"Dimer restored best"
,
// 21
80
};
81
if
(
status
>= 0 &&
82
status
<
static_cast<
int
>
(
sizeof
(msgs) /
sizeof
(msgs[0])))
83
return
msgs[
status
];
84
return
"Unknown status"
;
85
}
86
90
[[nodiscard]]
static
constexpr
int
91
finalizeClimbStatus
(
int
climbStatus,
bool
objectiveConverged)
noexcept
{
92
if
(climbStatus ==
STATUS_GOOD
&& !objectiveConverged) {
93
return
STATUS_BAD_MAX_ITERATIONS
;
94
}
95
return
climbStatus;
96
}
97
98
MinModeSaddleSearch
(std::shared_ptr<Matter> matterPassed,
99
AtomMatrix
modePassed,
double
reactantEnergyPassed,
100
const
Parameters
¶metersPassed,
101
std::shared_ptr<Potential> potPassed);
102
~MinModeSaddleSearch
() =
default
;
103
// climb ConFrames are move-only; do not copy the search object.
104
MinModeSaddleSearch
(
const
MinModeSaddleSearch
&) =
delete
;
105
MinModeSaddleSearch
&
operator=
(
const
MinModeSaddleSearch
&) =
delete
;
106
MinModeSaddleSearch
(
MinModeSaddleSearch
&&) noexcept = default;
107
MinModeSaddleSearch
&operator=(
MinModeSaddleSearch
&&) noexcept = default;
108
AtomMatrix
getEigenvector
();
// lowest eigenmode
109
double
getEigenvalue
();
// estimate for the lowest eigenvalue
110
std::string_view
describeStatus
(
int
status
)
const override
{
111
return
statusMessage
(
status
);
112
}
113
int
getStatus
()
const override
{
return
status
; }
114
int
getIterationCount
()
const override
{
return
iteration
; }
115
int
getForceCalls
()
const override
{
return
forcecalls
; }
116
117
int
run
()
override
;
118
int
run
(
long
max_iterations_override);
121
int
runRetainFrames
(
long
max_iterations_override = -1);
122
123
int
forcecalls
{0};
124
int
iteration
{0};
125
int
status
{0};
126
127
[[nodiscard]]
const
std::vector<readcon::ConFrame> &
climbFrames
()
const
{
128
return
climb_frames_
;
129
}
130
void
clearClimbFrames
() {
climb_frames_
.clear(); }
131
[[nodiscard]] std::vector<readcon::ConFrame>
takeClimbFrames
() {
132
return
std::move(
climb_frames_
);
133
}
134
135
private
:
136
std::vector<readcon::ConFrame>
climb_frames_
;
137
bool
retain_climb_frames_
{
false
};
138
AtomMatrix
mode
;
139
AtomMatrix
initialTangent_
;
140
std::shared_ptr<Matter>
matter
;
141
std::shared_ptr<EigenmodeStrategy>
142
minModeMethod
;
// shared with the objective func
143
double
reactantEnergy
;
144
eonc::log::Scoped
log
;
145
};
146
147
}
// namespace eonc
148
149
using
eonc::MinModeSaddleSearch
;
Eigen.h
AtomMatrix
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
Definition
Eigen.h:37
EigenmodeStrategy.h
Matter.h
Optimizer.h
The optimizer class is used to serve as an abstract class for all optimizers, as well as to call an o...
SaddleSearchMethod.h
eonc::MinModeSaddleSearch
Definition
MinModeSaddleSearch.h:26
eonc::MinModeSaddleSearch::mode
AtomMatrix mode
Definition
MinModeSaddleSearch.h:138
eonc::MinModeSaddleSearch::statusMessage
static constexpr std::string_view statusMessage(int status)
Human-readable message for a status code.
Definition
MinModeSaddleSearch.h:56
eonc::MinModeSaddleSearch::clearClimbFrames
void clearClimbFrames()
Definition
MinModeSaddleSearch.h:130
eonc::MinModeSaddleSearch::status
int status
Definition
MinModeSaddleSearch.h:125
eonc::MinModeSaddleSearch::runRetainFrames
int runRetainFrames(long max_iterations_override=-1)
Like run(), but also retain climb ConFrames in memory (same stamps as write_movies climb CON).
Definition
MinModeSaddleSearch.cpp:200
eonc::MinModeSaddleSearch::run
int run() override
Definition
MinModeSaddleSearch.cpp:196
eonc::MinModeSaddleSearch::getEigenvector
AtomMatrix getEigenvector()
Definition
MinModeSaddleSearch.cpp:481
eonc::MinModeSaddleSearch::forcecalls
int forcecalls
Definition
MinModeSaddleSearch.h:123
eonc::MinModeSaddleSearch::Status
Status
Definition
MinModeSaddleSearch.h:29
eonc::MinModeSaddleSearch::STATUS_BAD_MAX_CONCAVE_ITERATIONS
@ STATUS_BAD_MAX_CONCAVE_ITERATIONS
Definition
MinModeSaddleSearch.h:35
eonc::MinModeSaddleSearch::STATUS_GOOD
@ STATUS_GOOD
Definition
MinModeSaddleSearch.h:31
eonc::MinModeSaddleSearch::STATUS_INIT
@ STATUS_INIT
Definition
MinModeSaddleSearch.h:32
eonc::MinModeSaddleSearch::STATUS_BAD_HIGH_ENERGY
@ STATUS_BAD_HIGH_ENERGY
Definition
MinModeSaddleSearch.h:34
eonc::MinModeSaddleSearch::STATUS_POTENTIAL_FAILED
@ STATUS_POTENTIAL_FAILED
Definition
MinModeSaddleSearch.h:42
eonc::MinModeSaddleSearch::STATUS_BAD_MAX_ITERATIONS
@ STATUS_BAD_MAX_ITERATIONS
Definition
MinModeSaddleSearch.h:36
eonc::MinModeSaddleSearch::STATUS_OPTIMIZER_ERROR
@ STATUS_OPTIMIZER_ERROR
Definition
MinModeSaddleSearch.h:50
eonc::MinModeSaddleSearch::STATUS_ZEROMODE_ABORT
@ STATUS_ZEROMODE_ABORT
Definition
MinModeSaddleSearch.h:49
eonc::MinModeSaddleSearch::STATUS_BAD_NO_BARRIER
@ STATUS_BAD_NO_BARRIER
Definition
MinModeSaddleSearch.h:48
eonc::MinModeSaddleSearch::STATUS_NEGATIVE_BARRIER
@ STATUS_NEGATIVE_BARRIER
Definition
MinModeSaddleSearch.h:45
eonc::MinModeSaddleSearch::STATUS_BAD_MD_TRAJECTORY_TOO_SHORT
@ STATUS_BAD_MD_TRAJECTORY_TOO_SHORT
Definition
MinModeSaddleSearch.h:46
eonc::MinModeSaddleSearch::STATUS_BAD_MINIMA
@ STATUS_BAD_MINIMA
Definition
MinModeSaddleSearch.h:40
eonc::MinModeSaddleSearch::STATUS_NONLOCAL_ABORT
@ STATUS_NONLOCAL_ABORT
Definition
MinModeSaddleSearch.h:44
eonc::MinModeSaddleSearch::STATUS_DIMER_LOST_MODE
@ STATUS_DIMER_LOST_MODE
Definition
MinModeSaddleSearch.h:51
eonc::MinModeSaddleSearch::STATUS_NONNEGATIVE_ABORT
@ STATUS_NONNEGATIVE_ABORT
Definition
MinModeSaddleSearch.h:43
eonc::MinModeSaddleSearch::STATUS_BAD_NO_NEGATIVE_MODE_AT_SADDLE
@ STATUS_BAD_NO_NEGATIVE_MODE_AT_SADDLE
Definition
MinModeSaddleSearch.h:47
eonc::MinModeSaddleSearch::STATUS_FAILED_PREFACTOR
@ STATUS_FAILED_PREFACTOR
Definition
MinModeSaddleSearch.h:41
eonc::MinModeSaddleSearch::STATUS_DIMER_RESTORED_BEST
@ STATUS_DIMER_RESTORED_BEST
Definition
MinModeSaddleSearch.h:52
eonc::MinModeSaddleSearch::STATUS_BAD_NOT_CONNECTED
@ STATUS_BAD_NOT_CONNECTED
Definition
MinModeSaddleSearch.h:37
eonc::MinModeSaddleSearch::STATUS_BAD_HIGH_BARRIER
@ STATUS_BAD_HIGH_BARRIER
Definition
MinModeSaddleSearch.h:39
eonc::MinModeSaddleSearch::STATUS_BAD_PREFACTOR
@ STATUS_BAD_PREFACTOR
Definition
MinModeSaddleSearch.h:38
eonc::MinModeSaddleSearch::STATUS_BAD_NO_CONVEX
@ STATUS_BAD_NO_CONVEX
Definition
MinModeSaddleSearch.h:33
eonc::MinModeSaddleSearch::operator=
MinModeSaddleSearch & operator=(const MinModeSaddleSearch &)=delete
eonc::MinModeSaddleSearch::getEigenvalue
double getEigenvalue()
Definition
MinModeSaddleSearch.cpp:477
eonc::MinModeSaddleSearch::climb_frames_
std::vector< readcon::ConFrame > climb_frames_
Definition
MinModeSaddleSearch.h:136
eonc::MinModeSaddleSearch::retain_climb_frames_
bool retain_climb_frames_
Definition
MinModeSaddleSearch.h:137
eonc::MinModeSaddleSearch::getStatus
int getStatus() const override
Definition
MinModeSaddleSearch.h:113
eonc::MinModeSaddleSearch::describeStatus
std::string_view describeStatus(int status) const override
Definition
MinModeSaddleSearch.h:110
eonc::MinModeSaddleSearch::MinModeSaddleSearch
MinModeSaddleSearch(std::shared_ptr< Matter > matterPassed, AtomMatrix modePassed, double reactantEnergyPassed, const Parameters ¶metersPassed, std::shared_ptr< Potential > potPassed)
Definition
MinModeSaddleSearch.cpp:171
eonc::MinModeSaddleSearch::log
eonc::log::Scoped log
Definition
MinModeSaddleSearch.h:144
eonc::MinModeSaddleSearch::takeClimbFrames
std::vector< readcon::ConFrame > takeClimbFrames()
Definition
MinModeSaddleSearch.h:131
eonc::MinModeSaddleSearch::initialTangent_
AtomMatrix initialTangent_
Definition
MinModeSaddleSearch.h:139
eonc::MinModeSaddleSearch::iteration
int iteration
Definition
MinModeSaddleSearch.h:124
eonc::MinModeSaddleSearch::climbFrames
const std::vector< readcon::ConFrame > & climbFrames() const
Definition
MinModeSaddleSearch.h:127
eonc::MinModeSaddleSearch::MinModeSaddleSearch
MinModeSaddleSearch(const MinModeSaddleSearch &)=delete
eonc::MinModeSaddleSearch::reactantEnergy
double reactantEnergy
Definition
MinModeSaddleSearch.h:143
eonc::MinModeSaddleSearch::matter
std::shared_ptr< Matter > matter
Definition
MinModeSaddleSearch.h:140
eonc::MinModeSaddleSearch::getIterationCount
int getIterationCount() const override
Definition
MinModeSaddleSearch.h:114
eonc::MinModeSaddleSearch::finalizeClimbStatus
static constexpr int finalizeClimbStatus(int climbStatus, bool objectiveConverged) noexcept
Issue #20 policy: never leave climb as STATUS_GOOD when the climb objective is still unconverged (unf...
Definition
MinModeSaddleSearch.h:91
eonc::MinModeSaddleSearch::minModeMethod
std::shared_ptr< EigenmodeStrategy > minModeMethod
Definition
MinModeSaddleSearch.h:142
eonc::MinModeSaddleSearch::~MinModeSaddleSearch
~MinModeSaddleSearch()=default
eonc::MinModeSaddleSearch::getForceCalls
int getForceCalls() const override
Definition
MinModeSaddleSearch.h:115
eonc::MinModeSaddleSearch::MinModeSaddleSearch
MinModeSaddleSearch(MinModeSaddleSearch &&) noexcept=default
eonc::Parameters
Definition
Parameters.h:28
eonc::SaddleSearchMethod::SaddleSearchMethod
SaddleSearchMethod(std::shared_ptr< Potential > potPassed, const Parameters ¶msPassed)
Definition
SaddleSearchMethod.h:27
eonc
RAII resource manager for the ARTn C library with global synchronization.
Definition
ARTnSaddleSearch.cpp:19
eonc::log::Scoped
RAII helper for class-scoped logging.
Definition
EonLogger.h:171
include
eon
MinModeSaddleSearch.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf