gpridge._calculator =================== .. py:module:: gpridge._calculator .. autoapi-nested-parse:: 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 ------- .. autoapisummary:: gpridge._calculator.GPRCalculator Module Contents --------------- .. py:class:: 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: :py:obj:`_CALC_BASE` ASE-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) :param inner_calc: The expensive calculator to accelerate. :type inner_calc: :py:class:`ase.calculators.calculator.Calculator` :param variance_threshold: Maximum acceptable GP variance. If the predicted variance exceeds this, the inner calculator is called instead. :type variance_threshold: :py:class:`float` :param max_training_points: Maximum number of training points to keep in the GP model. :type max_training_points: :py:class:`int` :param gpr_params: Parameters for the GP model. Defaults to :func:`~gpridge.default_gpr_parameters`. :type gpr_params: :py:class:`dict`, *optional* :param retrain_interval: Retrain hyperparameters every N inner calculator calls. :type retrain_interval: :py:class:`int` .. py:attribute:: implemented_properties :value: ['energy', 'forces'] Properties calculator can handle (energy, forces, ...) .. py:attribute:: name :value: 'GPRCalculator' .. py:attribute:: inner_calc .. py:attribute:: variance_threshold :value: 0.0001 .. py:attribute:: max_training_points :value: 100 .. py:attribute:: retrain_interval :value: 5 .. py:attribute:: uncertainty_mode :value: 'map' .. py:attribute:: use_psis_laplace :value: False .. py:attribute:: use_psis_deterministic :value: True .. py:attribute:: use_delta_method :value: False .. py:attribute:: rff_force_tol_fraction .. py:attribute:: hyperparameter_mode :value: 'scg' .. py:attribute:: gpr_params .. py:method:: from_rgpot(pot, **kwargs) :classmethod: Build a GPRCalculator whose inner PES is an rgpot PotentialBase or rgpot-style callable. ``pot`` is passed to :func:`gpridge.from_rgpot` / ``PotentialWrapper.from_rgpot``. Evaluations use that wrapper instead of an ASE calculator. .. py:property:: total_inner_calls Number of inner-calculator evaluations. .. py:property:: total_gpr_calls Number of GP surrogate evaluations. .. py:method:: calculate(atoms=None, properties=None, system_changes=None) Compute energy and forces, using GP when confident. :param atoms: Atoms object to evaluate. :type atoms: :py:class:`ase.Atoms` :param properties: Properties to compute (ignored, always computes energy+forces). :type properties: :py:class:`list` of :py:class:`str` :param system_changes: What changed since last call (ignored). :type system_changes: :py:class:`list` of :py:class:`str`