Loading...
Searching...
No Matches
NEBOraclePotential.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) gpridge developers
3// See LICENSE for details.
4
22
23#ifndef GPR_NEB_NEBORACLE_POTENTIAL_H_
24#define GPR_NEB_NEBORACLE_POTENTIAL_H_
25
26#include <Eigen/Dense>
27
28#include "GPNEB.h"
30
31namespace gpr {
32namespace neb {
33
38{
40 [oracle = std::move(oracle)](
41 long N, const double* R, const int* /*atomicNrs*/, double* F,
42 double* U, double* variance, const double* /*box*/) mutable {
43 Eigen::VectorXd positions(3 * N);
44 for (long i = 0; i < 3 * N; ++i)
45 positions(i) = R[i];
46
47 auto [energy, gradient] = oracle(positions);
48
49 if (U) *U = energy;
50 // Force = -gradient. Dimer reads from F.
51 for (long i = 0; i < 3 * N; ++i)
52 F[i] = -gradient(i);
53 // The dimer's variance arm is left unfilled (the NEB oracle
54 // is the true PES, no surrogate variance to report).
55 if (variance) *variance = 0.0;
56 };
57 return pot::PotentialWrapper(std::move(fn));
58}
59
60} // namespace neb
61} // namespace gpr
62
63#endif // GPR_NEB_NEBORACLE_POTENTIAL_H_
GP-accelerated NEB: AIE and OIE variants.
Type-erased wrapper around any potential that provides a force() interface.
std::function< void( long N, const double *R, const int *atomicNrs, double *F, double *U, double *energy_noise_rms, const double *box)> ForceFn
The nudged elastic band: path, GP-NEB driver, configuration and result, acquisition,...
std::function< std::pair< double, Eigen::VectorXd >( const Eigen::VectorXd &positions)> NEBOracle
Oracle function: positions -> (energy, gradient).
Definition GPNEB.h:82
pot::PotentialWrapper makePotentialWrapperFromOracle(NEBOracle oracle)
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition Macros.h:16