Loading...
Searching...
No Matches
SaddlePolish.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) gpridge developers
3// See LICENSE for details.
4#pragma once
5
6#include <Eigen/Core>
7#include <limits>
8#include <string>
9#include <vector>
10
11#include "GPNEB.h"
12#include "Session.h"
13
14namespace gpr {
15namespace neb {
16
17namespace detail {
18
24[[nodiscard]] Eigen::MatrixXd saddlePolishBasis(
25 const Eigen::VectorXd& positions,
26 const gpr::AtomsConfiguration& configuration);
28[[nodiscard]] double saddlePolishForceMagnitude(
29 const Eigen::VectorXd& positions, const Eigen::VectorXd& gradient,
30 const gpr::AtomsConfiguration& configuration);
31
32} // namespace detail
33
36 Eigen::VectorXd positions;
38 double energy = 0.0;
39 Eigen::VectorXd gradient;
40 int steps = 0;
41 int oracle_calls = 0;
42 double initial_force_inf = 0.0;
43 double final_force_inf = 0.0;
49 bool converged = false;
50};
51
68 bool evaluated = false;
69 std::string reason;
70 bool certified = false;
71 double surrogate_lambda1 = 0.0;
72 double surrogate_lambda2 = 0.0;
73 double oracle_curvature1 = 0.0;
74 double oracle_curvature2 = 0.0;
77 double residual1 = 0.0;
78 double residual2 = 0.0;
81 -std::numeric_limits<double>::infinity();
82 int rounds = 0;
83 bool verified = false;
84 int oracle_calls = 0;
86 Eigen::Index local_spectrum_samples = 0;
87 Eigen::VectorXd mode1;
88 Eigen::VectorXd mode2;
89 Eigen::VectorXd displaced_positions;
93 double polish_force_target = std::numeric_limits<double>::infinity();
94
97 [[nodiscard]] double escapeEnergyCeiling(
98 double refused_energy) const noexcept;
99};
100
106 const NEBOracle& oracle, ActiveLearningSession& session,
107 const Eigen::VectorXd& x_ci, double e_ci, const Eigen::VectorXd& g_ci,
108 double hessian_fd_step, double max_move, double force_tol,
109 const NEBBatchOracle* batch_oracle = nullptr, Eigen::Index batch_chunk = 0);
110
121 bool evaluated = false;
122 bool holds = false;
123 int worst_segment = -1;
124 double excess = 0.0;
125 double raw_excess = 0.0;
126 Eigen::VectorXd worst_position;
128 std::numeric_limits<double>::quiet_NaN();
129 int measurements = 0;
131 false;
134 Eigen::VectorXd measured_position;
137 std::vector<double> segment_excess;
138 std::vector<double> segment_raw_excess;
139 std::vector<double> segment_variance;
140 std::vector<Eigen::VectorXd> segment_position;
141};
142
148 ActiveLearningSession& session, const NEBPath& path, double force_tol);
149
164 ActiveLearningSession& session, const NEBPath& path, double force_tol,
165 NEBOracle& oracle, int max_measurements, int* oracle_calls);
166
178 const NEBOracle& oracle, ActiveLearningSession& session,
179 const Eigen::VectorXd& x0, double e0, const Eigen::VectorXd& g0,
180 double force_tol, int max_steps, double max_move, double hessian_fd_step);
181
182} // namespace neb
183} // namespace gpr
GP-accelerated NEB: AIE and OIE variants.
ActiveLearningSession: shared GP + training data across GP-NEB and GP-Dimer phases.
NEB path: chain of images between two endpoints.
Definition NEBPath.h:57
The nudged elastic band: path, GP-NEB driver, configuration and result, acquisition,...
std::function< std::vector< std::pair< double, Eigen::VectorXd > >( const std::vector< Eigen::VectorXd > &positions)> NEBBatchOracle
Definition GPNEB.h:89
SaddlePolishResult polishSaddleOnSurrogate(const NEBOracle &oracle, ActiveLearningSession &session, const Eigen::VectorXd &x0, double e0, const Eigen::VectorXd &g0, double force_tol, int max_steps, double max_move, double hessian_fd_step)
std::function< std::pair< double, Eigen::VectorXd >( const Eigen::VectorXd &positions)> NEBOracle
Oracle function: positions -> (energy, gradient).
Definition GPNEB.h:82
BandMidpointCertificate certifyBandMidpoints(ActiveLearningSession &session, const NEBPath &path, double force_tol)
ClimbingImageIndexCertificate certifyClimbingImageIndex(const NEBOracle &oracle, ActiveLearningSession &session, const Eigen::VectorXd &x_ci, double e_ci, const Eigen::VectorXd &g_ci, double hessian_fd_step, double max_move, double force_tol, const NEBBatchOracle *batch_oracle, Eigen::Index batch_chunk)
BandMidpointCertificate certifyBandMidpointsMeasured(ActiveLearningSession &session, const NEBPath &path, double force_tol, NEBOracle &oracle, int max_measurements, int *oracle_calls)
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition Macros.h:16
double worst_variance
posterior variance there
double raw_excess
the same segment's chord midpoint, unrelaxed
int measurements
oracle rows bought by the measured variant
std::vector< double > segment_raw_excess
std::vector< Eigen::VectorXd > segment_position
std::vector< double > segment_variance
int worst_segment
segment with the highest energy upper bound
std::vector< double > segment_excess
Eigen::VectorXd worst_position
the relaxed midpoint of worst_segment
double excess
mean E_mid - E_ci for that segment (eV)
double escapeEnergyCeiling(double refused_energy) const noexcept
Eigen::Index local_spectrum_samples
Samples owned by this process in the reported spectrum calculation.
bool certified
both required curvature signs are resolved
bool evaluated
the surrogate Hessian was available
bool verified
the complete non-rigid subspace was evaluated
double positive_complement_lower_bound
The second curvature less its resolution when it is resolved positive.
int rounds
Hessian-vector products taken.
std::string reason
why evaluation or sign resolution failed
Outcome of a saddle polish (see polishSaddleOnSurrogate).
bool converged
final_max_atom_force <= force_tol
Eigen::VectorXd gradient
true gradient at positions
double energy
true energy at positions
int oracle_calls
true-PES evaluations spent
int steps
accepted Newton steps