gpridge.ase_active_gp¶
ASE calculator backed by the C++ learning engine.
This is the surrogate as a potential: an ASE Calculator that answers
from the Gaussian process where the posterior is resolved and calls the
inner calculator where it is not. Because it is a calculator, it drops
into anything ASE already drives – BFGS, ase.mep.NEB, the dimer –
without those knowing a surrogate is present.
It differs from GPRCalculator in where the
policy lives. GPRCalculator reimplements the learn-on-the-fly loop in
Python against an absolute variance threshold. This one delegates to
libgpr_engine.so through the same C ABI eOn loads, so ASE and eOn run
one policy: a two-sided gate in multiples of the model’s own likelihood
noise rather than an absolute number, 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 so the surface is
constant between epoch boundaries.
Usage mirrors any wrapping calculator:
from ase.optimize import BFGS
atoms.calc = ActiveGPCalculator(inner_calc=EMT())
BFGS(atoms).run(fmax=0.01)
print(atoms.calc.oracle_calls, "true evaluations")
Classes¶
Learning surrogate around an inner ASE calculator. |
Module Contents¶
- class gpridge.ase_active_gp.ActiveGPCalculator(inner_calc, library=None, sigma_lo_factor=None, sigma_hi_factor=None, certify_below_force=None, refit_training_revisions=None, **kwargs)¶
Bases:
_CALC_BASELearning surrogate around an inner ASE calculator.
- Parameters:
inner_calc (
ase.calculators.calculator.Calculator) – The expensive calculator to stand in for. It is called only where the posterior is unresolved, and its result is returned verbatim when it is called.library (
str, optional) – Path tolibgpr_engine.so; defaults toGPR_ENGINE_LIBRARYand then to the loader search path.certify_below_force (
float, optional) – Set this to the driver’s own force convergence criterion, or a little above it. An ASE optimizer stops when the forces it is handed fall belowfmax, and those forces come from the model; the certificate is what turns that into a ground-truth call before the driver is allowed to stop. Left unset, an optimizer can and does converge to a minimum of the surrogate that is not a minimum ofinner_calc.sigma_lo_factor (optional) – Gate and cadence, forwarded to the engine unchanged.
sigma_hi_factor (optional) – Gate and cadence, forwarded to the engine unchanged.
refit_training_revisions (optional) – Gate and cadence, forwarded to the engine unchanged.
- implemented_properties = ['energy', 'forces']¶
Properties calculator can handle (energy, forces, …)
- name = 'ActiveGPCalculator'¶
- inner_calc¶
- property oracle_calls¶
True evaluations spent. The number the surrogate exists to reduce, so it is reported rather than inferred.
- property model_state¶
Surface epoch; changes only when the posterior moved.
- calculate(atoms=None, properties=None, system_changes=None)¶
Evaluate
atomsthrough the engine and store the result.resultsholdsenergy(eV),forces(eV/Angstrom) andgp_variance, the predictive variance reported by the engine for the answer. The engine calls the inner calculator where the posterior is unresolved.
- close()¶
Release the engine handle. Safe to call more than once.