gpridge ======= .. py:module:: gpridge .. autoapi-nested-parse:: 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 ---------- .. toctree:: :maxdepth: 1 /autoapi/gpridge/_adapters/index /autoapi/gpridge/_api/index /autoapi/gpridge/_calculator/index /autoapi/gpridge/_core/index /autoapi/gpridge/_observers/index /autoapi/gpridge/ase_active_gp/index /autoapi/gpridge/ase_bridge/index /autoapi/gpridge/baker_board/index /autoapi/gpridge/build_info/index /autoapi/gpridge/dimer/index /autoapi/gpridge/engine/index /autoapi/gpridge/errors/index /autoapi/gpridge/fes/index /autoapi/gpridge/gp/index /autoapi/gpridge/instanton/index /autoapi/gpridge/integrations/index /autoapi/gpridge/neb/index /autoapi/gpridge/policy/index /autoapi/gpridge/provenance/index /autoapi/gpridge/pyeon_bridge/index /autoapi/gpridge/session/index /autoapi/gpridge/surrogate/index /autoapi/gpridge/wheel_smoke/index Exceptions ---------- .. autoapisummary:: gpridge.ABIError gpridge.AllocationError gpridge.CholeskyError gpridge.EngineError gpridge.GPRidgeError gpridge.InternalError gpridge.InvalidArgumentError gpridge.NotConvergedError gpridge.NotTrainedError gpridge.NullHandleError gpridge.OptimizerError gpridge.OracleError gpridge.OutOfSupportError gpridge.SizeLimitError gpridge.UnitMismatchError gpridge.UnsupportedError Functions --------- .. autoapisummary:: gpridge.read_build_info gpridge.status_name Package Contents ---------------- .. py:function:: 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. .. py:exception:: ABIError Bases: :py:obj:`GPRidgeError`, :py:obj:`RuntimeError` ``GPR_ERR_ABI``: header and library disagree. .. py:attribute:: status :value: -11 .. py:attribute:: status_name :value: 'GPR_ERR_ABI' .. py:exception:: AllocationError Bases: :py:obj:`GPRidgeError`, :py:obj:`MemoryError` ``GPR_ERR_ALLOC``: a memory allocation failed. .. py:attribute:: status :value: -4 .. py:attribute:: status_name :value: 'GPR_ERR_ALLOC' .. py:exception:: CholeskyError Bases: :py:obj:`GPRidgeError`, :py:obj:`RuntimeError` ``GPR_ERR_CHOLESKY``: the covariance matrix is not positive definite. .. py:attribute:: status :value: -5 .. py:attribute:: status_name :value: 'GPR_ERR_CHOLESKY' .. py:exception:: EngineError(message: str, code: int | None = None) Bases: :py:obj:`GPRidgeError`, :py:obj:`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). .. py:attribute:: status_name :value: 'RGPOT_ENGINE_ERROR' .. py:attribute:: code :value: None .. py:exception:: GPRidgeError Bases: :py:obj:`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. .. py:attribute:: status :type: int :value: 0 .. py:attribute:: status_name :type: str :value: '' .. py:exception:: InternalError Bases: :py:obj:`GPRidgeError`, :py:obj:`RuntimeError` ``GPR_ERR_INTERNAL``: any other failure inside the library. .. py:attribute:: status :value: -99 .. py:attribute:: status_name :value: 'GPR_ERR_INTERNAL' .. py:exception:: InvalidArgumentError Bases: :py:obj:`GPRidgeError`, :py:obj:`ValueError` ``GPR_ERR_INVALID_ARG``: a size, shape, key or value out of range. .. py:attribute:: status :value: -2 .. py:attribute:: status_name :value: 'GPR_ERR_INVALID_ARG' .. py:exception:: NotConvergedError Bases: :py:obj:`GPRidgeError`, :py:obj:`RuntimeError` ``GPR_ERR_NOT_CONVERGED``: a search ended without converging. .. py:attribute:: status :value: -7 .. py:attribute:: status_name :value: 'GPR_ERR_NOT_CONVERGED' .. py:exception:: NotTrainedError Bases: :py:obj:`GPRidgeError`, :py:obj:`ValueError` ``GPR_ERR_NOT_TRAINED``: the model has no training data. A ``ValueError``, as ``get_alpha`` on an untrained model raised before. .. py:attribute:: status :value: -3 .. py:attribute:: status_name :value: 'GPR_ERR_NOT_TRAINED' .. py:exception:: NullHandleError Bases: :py:obj:`GPRidgeError`, :py:obj:`ValueError` ``GPR_ERR_NULL_HANDLE``: a required handle or object was absent. .. py:attribute:: status :value: -1 .. py:attribute:: status_name :value: 'GPR_ERR_NULL_HANDLE' .. py:exception:: OptimizerError Bases: :py:obj:`GPRidgeError`, :py:obj:`RuntimeError` ``GPR_ERR_OPTIMIZER``: the hyperparameter optimizer failed. .. py:attribute:: status :value: -6 .. py:attribute:: status_name :value: 'GPR_ERR_OPTIMIZER' .. py:exception:: OracleError Bases: :py:obj:`GPRidgeError`, :py:obj:`RuntimeError` ``GPR_ERR_ORACLE``: the oracle failed past the search's bound. .. py:attribute:: status :value: -9 .. py:attribute:: status_name :value: 'GPR_ERR_ORACLE' .. py:exception:: OutOfSupportError Bases: :py:obj:`GPRidgeError`, :py:obj:`ValueError` ``GPR_ERR_OUT_OF_SUPPORT``: a query's posterior energy standard deviation exceeds the caller's ``max_energy_std``. .. py:attribute:: status :value: -12 .. py:attribute:: status_name :value: 'GPR_ERR_OUT_OF_SUPPORT' .. py:exception:: SizeLimitError Bases: :py:obj:`GPRidgeError`, :py:obj:`ValueError` ``GPR_ERR_SIZE_LIMIT``: the problem exceeds an index limit. .. py:attribute:: status :value: -8 .. py:attribute:: status_name :value: 'GPR_ERR_SIZE_LIMIT' .. py:exception:: UnitMismatchError Bases: :py:obj:`GPRidgeError`, :py:obj:`ValueError` ``GPR_ERR_UNIT_MISMATCH``: inputs that must share a unit were computed in different ones, such as prefactor halves with different ``omega_scale``. .. py:attribute:: status :value: -13 .. py:attribute:: status_name :value: 'GPR_ERR_UNIT_MISMATCH' .. py:exception:: UnsupportedError Bases: :py:obj:`GPRidgeError`, :py:obj:`NotImplementedError` ``GPR_ERR_UNSUPPORTED``: the feature is absent from this build. .. py:attribute:: status :value: -10 .. py:attribute:: status_name :value: 'GPR_ERR_UNSUPPORTED' .. py:function:: status_name(status: int) -> str Short static name of a ``GPR_*`` status code (``gpr_status_name``).