gpridge._calculator¶
ASE Calculator that wraps a GP surrogate around an inner calculator.
The GPR model learns the potential energy surface from inner calculator evaluations and provides surrogate predictions to reduce the number of expensive evaluations. This is transparent to ASE’s optimization infrastructure (dimer, NEB, BFGS, etc.).
Classes¶
ASE-compatible calculator with GPR surrogate acceleration. |
Module Contents¶
- class gpridge._calculator.GPRCalculator(inner_calc, variance_threshold=0.0001, max_training_points=100, gpr_params=None, retrain_interval=5, uncertainty_mode='map', use_psis_laplace=False, use_psis_deterministic=True, use_delta_method=False, rff_features=0, rff_force_tol_fraction=0.0, hyperparameter_mode='scg')¶
Bases:
_CALC_BASEASE-compatible calculator with GPR surrogate acceleration.
Wraps an inner calculator (e.g. EMT, VASP) and trains a Gaussian process model on observed energy/force evaluations. When the GP prediction variance is below a threshold, returns the GP prediction instead of calling the inner calculator.
This integrates transparently with ASE’s dimer method:
from ase.mep import DimerControl, MinModeAtoms, MinModeTranslate atoms.calc = GPRCalculator(inner_calc=EMT(), variance_threshold=1e-4) d_atoms = MinModeAtoms(atoms, DimerControl(...)) MinModeTranslate(d_atoms).run(fmax=0.01)
- Parameters:
inner_calc (
ase.calculators.calculator.Calculator) – The expensive calculator to accelerate.variance_threshold (
float) – Maximum acceptable GP variance. If the predicted variance exceeds this, the inner calculator is called instead.max_training_points (
int) – Maximum number of training points to keep in the GP model.gpr_params (
dict, optional) – Parameters for the GP model. Defaults todefault_gpr_parameters().retrain_interval (
int) – Retrain hyperparameters every N inner calculator calls.
- implemented_properties = ['energy', 'forces']¶
Properties calculator can handle (energy, forces, …)
- name = 'GPRCalculator'¶
- inner_calc¶
- variance_threshold = 0.0001¶
- max_training_points = 100¶
- retrain_interval = 5¶
- uncertainty_mode = 'map'¶
- use_psis_laplace = False¶
- use_psis_deterministic = True¶
- use_delta_method = False¶
- rff_force_tol_fraction¶
- hyperparameter_mode = 'scg'¶
- gpr_params¶
- classmethod from_rgpot(pot, **kwargs)¶
Build a GPRCalculator whose inner PES is an rgpot PotentialBase or rgpot-style callable.
potis passed togpridge.from_rgpot()/PotentialWrapper.from_rgpot. Evaluations use that wrapper instead of an ASE calculator.
- property total_inner_calls¶
Number of inner-calculator evaluations.
- property total_gpr_calls¶
Number of GP surrogate evaluations.
- calculate(atoms=None, properties=None, system_changes=None)¶
Compute energy and forces, using GP when confident.