Loading...
Searching...
No Matches
gpr_engine_curvature.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: MIT
2 * Copyright (c) gpridge developers
3 * See LICENSE for details.
4 *
5 * Optional libgpr_engine curvature-session exports alongside the
6 * pinned rgpot engine ABI.
7 */
8#pragma once
9
10#include "rgpot_engine_c_abi.h"
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#define RGPOT_ENGINE_ERR_OUTSIDE_SUPPORT 4
17
33#define RGPOT_ENGINE_GPR_RESIDUAL_PRIOR_MAGIC 0x47505251u /* "GPRQ" */
34#define RGPOT_ENGINE_GPR_RESIDUAL_PRIOR_VERSION 1u
35
45
55
56typedef struct {
57 unsigned magic;
58 unsigned version;
59 long n_atoms;
62 long n_coords;
67 /* GP model configuration (matches gpr_model_config_t fields) */
68 double sigma2;
72 double prior_mu;
73 double prior_nu;
74 double prior_s2;
77 double tol_func;
78 double tol_sol;
85
101#define RGPOT_ENGINE_GPR_HINT_MAGIC 0x47505248u /* "GPRH" */
102#define RGPOT_ENGINE_GPR_HINT_VERSION 1u
103
111
112typedef struct {
113 unsigned magic;
114 unsigned version;
115 int kind;
116 int phase;
119 long n_points;
121 long n_coords;
123
129typedef struct {
131 unsigned long long true_energy_calls;
132 unsigned long long true_gradient_calls;
133 unsigned long long true_hessian_calls;
134 unsigned long long gp_hessians;
135 unsigned long long gp_predictions;
136 unsigned long long fits;
137 unsigned long long observations;
140 unsigned long long fixed_appends;
142
150RGPOT_ENGINE_API int rgpot_engine_hessian_checked(
151 RgpotEnginePot *pot, long nAtoms, const double *positions,
152 size_t positions_len, const int *atomicNrs, double *hessian_out,
153 size_t hessian_len, const double *box);
154
165RGPOT_ENGINE_API int rgpot_engine_hessian_action_checked(
166 RgpotEnginePot *pot, long nAtoms, const double *positions,
167 size_t positions_len, const int *atomicNrs, const double *direction,
168 size_t direction_len, double *hv_out, size_t hv_len, const double *box,
169 unsigned long long *ops_out, double *scale_out);
170
178 RgpotEnginePot *pot, long nAtoms, const double *positions,
179 size_t positions_len, const int *atomicNrs, const double *box,
180 int *supported_out);
181
192RGPOT_ENGINE_API int rgpot_engine_predict_variance_checked(
193 RgpotEnginePot *pot, long nSystems, long nAtoms, const double *positions,
194 size_t positions_len, const int *atomicNrs, double *var_energy_out,
195 size_t var_energy_len, double *var_gradient_out, size_t var_gradient_len,
196 const double *boxes);
197
201RGPOT_ENGINE_API int rgpot_engine_gpr_stats(const RgpotEnginePot *pot,
202 RgpotEngineGprStats *stats_out);
203
204#ifdef __cplusplus
205}
206#endif
rgpot_engine_gpr_hint_kind
@ RGPOT_ENGINE_GPR_HINT_LEARN_POINTS
@ RGPOT_ENGINE_GPR_HINT_SET_PHASE
@ RGPOT_ENGINE_GPR_HINT_RECORD_TRUE_CALLS
@ RGPOT_ENGINE_GPR_HINT_SET_TRAINING
@ RGPOT_ENGINE_GPR_HINT_INCORPORATE
rgpot_engine_gpr_hill_policy
@ RGPOT_GPR_HILL_TRUE
@ RGPOT_GPR_HILL_GP
RGPOT_ENGINE_API int rgpot_engine_gpr_stats(const RgpotEnginePot *pot, RgpotEngineGprStats *stats_out)
RGPOT_ENGINE_API int rgpot_engine_hessian_checked(RgpotEnginePot *pot, long nAtoms, const double *positions, size_t positions_len, const int *atomicNrs, double *hessian_out, size_t hessian_len, const double *box)
RGPOT_ENGINE_API int rgpot_engine_predict_variance_checked(RgpotEnginePot *pot, long nSystems, long nAtoms, const double *positions, size_t positions_len, const int *atomicNrs, double *var_energy_out, size_t var_energy_len, double *var_gradient_out, size_t var_gradient_len, const double *boxes)
RGPOT_ENGINE_API int rgpot_engine_prediction_supported_checked(RgpotEnginePot *pot, long nAtoms, const double *positions, size_t positions_len, const int *atomicNrs, const double *box, int *supported_out)
rgpot_engine_gpr_phase
@ RGPOT_GPR_PHASE_ORBIT
@ RGPOT_GPR_PHASE_HILL
@ RGPOT_GPR_PHASE_SADDLE
@ RGPOT_GPR_PHASE_SURROGATE
RGPOT_ENGINE_API int rgpot_engine_hessian_action_checked(RgpotEnginePot *pot, long nAtoms, const double *positions, size_t positions_len, const int *atomicNrs, const double *direction, size_t direction_len, double *hv_out, size_t hv_len, const double *box, unsigned long long *ops_out, double *scale_out)
Potential wrappers and the batched oracle interface.
unsigned long long gp_predictions
unsigned long long true_gradient_calls
unsigned long long true_hessian_calls
unsigned long long fits
unsigned long long gp_hessians
unsigned long long true_energy_calls
unsigned long long observations
unsigned long long fixed_appends