gpridge.engine¶
Python side of the rgpot learning-engine C ABI.
The surrogate’s learn-on-the-fly policy lives in C++ behind
libgpr_engine.so: a two-sided variance gate in multiples of the
model’s own likelihood noise, a convergence certificate that forces a
ground-truth call before a driver may claim convergence, and a split
between acquiring a row and incorporating it. Reaching that through the
same C ABI eOn loads means ASE and eOn run one policy rather than two
implementations that drift apart.
The host supplies the oracle as a callback, so the engine never owns a loop: anything that can hold a potential can hold this.
Attributes¶
Classes¶
The learning surrogate, reached through its C ABI. |
Module Contents¶
- gpridge.engine.ACQUIRE_VARIANCE = 1¶
- gpridge.engine.ACQUIRE_CERTIFY = 2¶
- gpridge.engine.ACQUIRE_BATCH = 3¶
- gpridge.engine.ACQUIRE_REJECT = 4¶
- class gpridge.engine.ActiveGPEngine(oracle, library=None, sigma_lo_factor=None, sigma_hi_factor=None, certify_below_force=None, refit_training_revisions=None)¶
The learning surrogate, reached through its C ABI.
- Parameters:
oracle (
callable) –oracle(positions, atomic_numbers, box) -> (energy, forces)withpositionsandforcesshaped(N, 3). Raising is reported to the engine as a recoverable failure, which leaves the row unlearned rather than corrupting the model.library (
str, optional) – Path tolibgpr_engine.so. Defaults toGPR_ENGINE_LIBRARY, then the copy a wheel installs inside the package, then the loader’s search path.sigma_lo_factor (
float, optional) – The two-sided gate, in multiples of the model’s own likelihood noise. Below the low factor the model answers; above the high one the geometry is not learned from.sigma_hi_factor (
float, optional) – The two-sided gate, in multiples of the model’s own likelihood noise. Below the low factor the model answers; above the high one the geometry is not learned from.certify_below_force (
float, optional) – A predicted force magnitude under this (eV/Angstrom) forces a ground-truth call, so a driver that is about to declare convergence is checked against the oracle rather than trusted. Drivers stop on a force criterion, so leaving this unset lets a driver converge on an unbacked answer.refit_training_revisions (
int, optional) – Refit cadence in training-set appends.
Notes
Passing none of the four leaves the engine on its own defaults.
- model_updates = 0¶
- acquisitions = 0¶
- property model_state¶
Surface epoch. Changes only when an incorporation moved the posterior, so host quasi-Newton history keys on it.
- incorporate()¶
Fit acquired observations and advance the model’s surface epoch.
Calls with no pending observations leave the epoch unchanged.
- force(positions, atomic_numbers, box=None, *, incorporate=True)¶
Energy, forces and predictive variance at one geometry.
The engine answers from the posterior where it is resolved and calls the oracle where it is not; the caller cannot tell which happened except through
acquisitionsand the variance.The call ends an incorporation boundary by default. Pass
incorporate=Falsefor evaluations sharing one fixed posterior, then callincorporate()at the host’s update boundary.
- close()¶
Destroy the native engine handle. Safe to call more than once.