gpridge

Python API for gpridge.

ASE / pyeonclient overlay entrypoints:

  • gpridge.gp.GaussianProcess – GP surrogate (ASE Calculator-shaped).

  • gpridge.session.GPNEBSession – step surface: interpolate / prepare / compute / apply (mirrors pyeonclient NEB composition).

  • gpridge.neb.GPNEB – list-of-images driver (facade over Session).

  • gpridge.dimer.GPDimer – single-saddle driver.

  • gpridge.ase_bridge / gpridge.pyeon_bridge – Atoms and optional Matter path-matrix + oracle wiring.

GPNEB and GPDimer accept ASE-style logfile= / trajectory= and attach(), stepping once per oracle call. Library errors derive from gpridge.GPRidgeError (gpridge.errors), and gpridge.__version__ is the library version.

Layered-chain configuration lives on the GP via gpridge.surrogate.Surrogate (immutable fluent builder).

Example:

from metatomic.torch.ase_calculator import MetatomicCalculator
from gpridge.gp import GaussianProcess
from gpridge.neb import GPNEB
from gpridge.dimer import GPDimer

petmad = MetatomicCalculator("model.pt")  # an exported model file
gp = GaussianProcess(
    uncertainty='laplace',
    psis=True,
    psis_deterministic=True,
    use_delta=True,
    rff_features=512,
    hyperparameters='inla',
)

# NEB: builds + fits gp. Omitting model_profile leaves the library
# profile. This example keeps the layered chain above, so it names extended.
# reactant and product are ase.Atoms with the same atoms in the same
# order. The list holds the reactant, eight copies for the images between
# the endpoints, and the product; interpolate() fills the copies.
images = [reactant] + [reactant.copy() for _ in range(8)] + [product]
neb = GPNEB(images, oracle=petmad, gp=gp, climb=True,
            model_profile='extended', use_idpp=True)
neb.interpolate('idpp')
neb.run(fmax=0.05, steps=500)

# Dimer: SAME gp, warm-started
dimer = GPDimer(neb.images[neb.max_energy_image], oracle=petmad, gp=gp,
                model_profile='extended')
dimer.run(fmax=0.01)

The low-level nanobind objects (GaussianProcessRegression, AtomicDimer, Observation, etc.) remain available for users who need direct C++ access; see the _core module.

Submodules

Exceptions

ABIError

GPR_ERR_ABI: header and library disagree.

AllocationError

GPR_ERR_ALLOC: a memory allocation failed.

CholeskyError

GPR_ERR_CHOLESKY: the covariance matrix is not positive definite.

EngineError

A failure reported by libgpr_engine over the rgpot engine ABI.

GPRidgeError

Base class of every error GPRidge raises on purpose.

InternalError

GPR_ERR_INTERNAL: any other failure inside the library.

InvalidArgumentError

GPR_ERR_INVALID_ARG: a size, shape, key or value out of range.

NotConvergedError

GPR_ERR_NOT_CONVERGED: a search ended without converging.

NotTrainedError

GPR_ERR_NOT_TRAINED: the model has no training data.

NullHandleError

GPR_ERR_NULL_HANDLE: a required handle or object was absent.

OptimizerError

GPR_ERR_OPTIMIZER: the hyperparameter optimizer failed.

OracleError

GPR_ERR_ORACLE: the oracle failed past the search's bound.

OutOfSupportError

GPR_ERR_OUT_OF_SUPPORT: a query's posterior energy standard

SizeLimitError

GPR_ERR_SIZE_LIMIT: the problem exceeds an index limit.

UnitMismatchError

GPR_ERR_UNIT_MISMATCH: inputs that must share a unit were

UnsupportedError

GPR_ERR_UNSUPPORTED: the feature is absent from this build.

Functions

read_build_info(→ dict[str, Any])

Version, SBOM digest, the build inventory, and the runtime components.

status_name(→ str)

Short static name of a GPR_* status code (gpr_status_name).

Package Contents

gpridge.read_build_info() → dict[str, Any]

Version, SBOM digest, the build inventory, and the runtime components.

dependencies are the CycloneDX components keyed by package URL and source is build-sbom. digest_verified is true when gpridge._core.build_info supplied the digest compiled from gpr_sbom_digest.h and the installed CycloneDX bytes match it.

A library built with -Dsbom=disabled embeds an empty digest. Then source is sbom-disabled, dependencies is empty, and no directory is searched: another installation’s SBOM does not describe this build. Without the extension, the first complete installed SBOM is read unverified; if there is none, SbomLookupError is raised.

runtime_components is gpridge.provenance.component_registry()’s component list, or None when the extension is not importable.

exception gpridge.ABIError

Bases: GPRidgeError, RuntimeError

GPR_ERR_ABI: header and library disagree.

status = -11
status_name = 'GPR_ERR_ABI'
exception gpridge.AllocationError

Bases: GPRidgeError, MemoryError

GPR_ERR_ALLOC: a memory allocation failed.

status = -4
status_name = 'GPR_ERR_ALLOC'
exception gpridge.CholeskyError

Bases: GPRidgeError, RuntimeError

GPR_ERR_CHOLESKY: the covariance matrix is not positive definite.

status = -5
status_name = 'GPR_ERR_CHOLESKY'
exception gpridge.EngineError(message: str, code: int | None = None)

Bases: GPRidgeError, RuntimeError

A failure reported by libgpr_engine over the rgpot engine ABI.

code is the engine’s return value (None when the call returned a null handle instead of a code).

status_name = 'RGPOT_ENGINE_ERROR'
code = None
exception gpridge.GPRidgeError

Bases: Exception

Base class of every error GPRidge raises on purpose.

status is the matching GPR_ERR_* code (0 when the error has no C counterpart) and status_name its symbolic name.

status: int = 0
status_name: str = ''
exception gpridge.InternalError

Bases: GPRidgeError, RuntimeError

GPR_ERR_INTERNAL: any other failure inside the library.

status = -99
status_name = 'GPR_ERR_INTERNAL'
exception gpridge.InvalidArgumentError

Bases: GPRidgeError, ValueError

GPR_ERR_INVALID_ARG: a size, shape, key or value out of range.

status = -2
status_name = 'GPR_ERR_INVALID_ARG'
exception gpridge.NotConvergedError

Bases: GPRidgeError, RuntimeError

GPR_ERR_NOT_CONVERGED: a search ended without converging.

status = -7
status_name = 'GPR_ERR_NOT_CONVERGED'
exception gpridge.NotTrainedError

Bases: GPRidgeError, ValueError

GPR_ERR_NOT_TRAINED: the model has no training data.

A ValueError, as get_alpha on an untrained model raised before.

status = -3
status_name = 'GPR_ERR_NOT_TRAINED'
exception gpridge.NullHandleError

Bases: GPRidgeError, ValueError

GPR_ERR_NULL_HANDLE: a required handle or object was absent.

status = -1
status_name = 'GPR_ERR_NULL_HANDLE'
exception gpridge.OptimizerError

Bases: GPRidgeError, RuntimeError

GPR_ERR_OPTIMIZER: the hyperparameter optimizer failed.

status = -6
status_name = 'GPR_ERR_OPTIMIZER'
exception gpridge.OracleError

Bases: GPRidgeError, RuntimeError

GPR_ERR_ORACLE: the oracle failed past the search’s bound.

status = -9
status_name = 'GPR_ERR_ORACLE'
exception gpridge.OutOfSupportError

Bases: GPRidgeError, ValueError

GPR_ERR_OUT_OF_SUPPORT: a query’s posterior energy standard deviation exceeds the caller’s max_energy_std.

status = -12
status_name = 'GPR_ERR_OUT_OF_SUPPORT'
exception gpridge.SizeLimitError

Bases: GPRidgeError, ValueError

GPR_ERR_SIZE_LIMIT: the problem exceeds an index limit.

status = -8
status_name = 'GPR_ERR_SIZE_LIMIT'
exception gpridge.UnitMismatchError

Bases: GPRidgeError, ValueError

GPR_ERR_UNIT_MISMATCH: inputs that must share a unit were computed in different ones, such as prefactor halves with different omega_scale.

status = -13
status_name = 'GPR_ERR_UNIT_MISMATCH'
exception gpridge.UnsupportedError

Bases: GPRidgeError, NotImplementedError

GPR_ERR_UNSUPPORTED: the feature is absent from this build.

status = -10
status_name = 'GPR_ERR_UNSUPPORTED'
gpridge.status_name(status: int) → str

Short static name of a GPR_* status code (gpr_status_name).