GPRidge v1.0.0
GPR-accelerated saddle point searches on potential energy surfaces
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
TrustGuard.cpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) gpridge developers
3
// See LICENSE for details.
4
5
#include "
TrustGuard.h
"
6
7
#include <stdexcept>
8
9
namespace
gpr
{
10
namespace
neb
{
11
12
int
rejectUntrustedStep
(
NEBPath
& path,
13
const
std::vector<Eigen::VectorXd>& accepted_positions,
14
const
gpr::TrustRadius
& trust,
double
trust_threshold)
15
{
16
if
(
static_cast<
int
>
(accepted_positions.size()) != path.
numImages
()) {
17
throw
std::invalid_argument(
18
"rejectUntrustedStep requires one accepted position per image"
);
19
}
20
21
int
offending = -1;
22
for
(
int
i = 1; i < path.
numImages
() - 1; ++i) {
23
const
double
d = trust.
distanceToTraining
(path.
image
(i).
positions
);
24
if
(d > trust_threshold) {
25
offending = i;
26
break
;
27
}
28
}
29
30
if
(offending > 0) {
31
for
(
int
i = 1; i < path.
numImages
() - 1; ++i) {
32
path.
image
(i).
positions
= accepted_positions[i];
33
}
34
}
35
return
offending;
36
}
37
38
}
// namespace neb
39
}
// namespace gpr
TrustGuard.h
gpr::TrustRadius
Trust radius enforcement for GP surrogate models.
Definition
TrustRadius.h:36
gpr::TrustRadius::distanceToTraining
double distanceToTraining(const Eigen::VectorXd &x_new) const
Minimum Euclidean distance from x_new to any training point.
Definition
TrustRadius.cpp:33
gpr::neb::NEBPath
NEB path: chain of images between two endpoints.
Definition
NEBPath.h:57
gpr::neb::NEBPath::numImages
int numImages() const
Definition
NEBPath.h:338
gpr::neb::NEBPath::image
Image & image(int i)
Access image i.
Definition
NEBPath.h:329
gpr::neb
The nudged elastic band: path, GP-NEB driver, configuration and result, acquisition,...
Definition
ChainRealign.h:29
gpr::neb::rejectUntrustedStep
int rejectUntrustedStep(NEBPath &path, const std::vector< Eigen::VectorXd > &accepted_positions, const gpr::TrustRadius &trust, double trust_threshold)
Reject a simultaneous inner-loop NEB step outside the GP trust set.
Definition
TrustGuard.cpp:12
gpr
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition
Macros.h:16
gpr::neb::Image::positions
Eigen::VectorXd positions
Definition
NEBPath.h:40
gpr
neb
TrustGuard.cpp
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf