C API function reference ======================== **Status:** implemented. This page lists every function that ``abi/gpridge_c.symbols`` exports, with its purpose, the units and extents of its arguments, who owns each pointer, and what it returns on failure. The guide to the shared conventions is :doc:`the C API page `; the declarations are in ``gpr/capi/gpridge_c.h``, and the Doxygen pages hold the generated signatures. ``scripts/check_c_api_reference.py`` fails when a function of the symbol list has no row here, when a row leaves a column empty, or when the header gives a function no documentation comment. How to read the tables ---------------------- **Units.** The library converts no units. A coordinate has the unit of the oracle that the caller supplies, an energy has the oracle's energy unit, and a gradient is energy per coordinate unit. A variance has the square of the quantity's unit. The columns below name a unit only where the header fixes one (Angstrom for the local and periodic bands, eV/Angstrom for their force tolerance, radians for angles, eV for the energy-noise channel and for the random-feature selection report). **Extents.** Arrays are flat and row-major. :math:`N` is ``n_coords``, three times the number of moving atoms, and :math:`n` is the number of observations. A function with the suffix ``_checked`` takes the length of each caller buffer in doubles and rejects a buffer that is too short, as :doc:`the C API page ` describes. **Ownership.** A pointer argument is read or written during the call and stays with the caller unless the row says the library keeps a copy. A returned handle belongs to the caller until it is passed to the matching destroy function. A returned ``const char*`` is static or thread-local; the caller does not free it. **Failure.** A function that returns ``int`` as a status returns ``GPR_SUCCESS`` (0) or a negative code. The tables give the codes a function returns for its own checks. ``GPR_ERR_NULL_HANDLE`` is not "a handle argument is ``NULL``". - ``guard_model`` returns it for a ``NULL`` model and for a model that is not live. ``gpr_model_predict_energy_variance_interval`` and ``gpr_model_get_noise_floor_report`` return it for a ``NULL`` model only; they do not test liveness. - ``gpr_model_init`` returns ``GPR_ERR_INVALID_ARG`` for a ``NULL`` atoms handle and ``GPR_ERR_NULL_HANDLE`` when that handle is not live. - ``guard_neb`` returns it for a ``NULL`` NEB result and for one that is not live. ``gpr_neb_result_image_positions``, ``gpr_neb_result_image_energy`` and ``gpr_neb_result_all_energies`` also return it when the live result has no path. - ``gpr_potential_force`` and ``gpr_potential_force_with_uncertainty`` return it for a ``NULL`` potential and for one that is not live. - ``reject_dead_atoms`` and ``reject_dead_potential`` return it only for a non-null handle that is not live. A ``NULL`` atoms or potential argument of a dimer, minimizer or NEB search is ``GPR_ERR_INVALID_ARG``, except where a local or periodic band allows a ``NULL`` atoms handle. - An accessor that returns a count, a flag or a rank clears status and error to ``GPR_SUCCESS`` for ``NULL`` and preserves any existing error state for a live handle. A handle that is not live sets ``GPR_ERR_NULL_HANDLE`` and the accessor returns its sentinel. Destroying ``NULL`` or a live handle clears status and error to ``GPR_SUCCESS``, while preserving a pending ``GPR_ERR_ORACLE`` during cleanup; destroying a handle that is not live sets ``GPR_ERR_INVALID_ARG``. This status-clearing behaviour is a contract fix in ABI 1.17 without a minor version bump. An exception that reaches the common handler (``status_from_exception`` in ``gpr/capi/gpridge_c.cpp``) becomes one of these. The handler's order, and the five functions that catch before it, are tabulated in :doc:`the C API page `. - ``GPR_ERR_ALLOC`` for ``std::bad_alloc``. - ``GPR_ERR_SIZE_LIMIT`` for ``std::length_error``, and when a problem exceeds an index limit of the backend. - ``GPR_ERR_INVALID_ARG`` for ``std::invalid_argument`` and ``std::domain_error``, except BQ measure integration, which maps its caught ``std::domain_error`` to ``GPR_ERR_UNSUPPORTED``. - ``GPR_ERR_ORACLE`` when an oracle callback failed and the search could not step around it. - ``GPR_ERR_INTERNAL`` for any other exception. The message names it. Those five functions return a different status for the exceptions they catch. ``gpr_model_predict_energy_variance_interval`` (and the ``_checked`` form, which calls it) returns ``GPR_ERR_CHOLESKY`` for ``std::domain_error`` and ``GPR_ERR_INTERNAL`` for any other ``std::exception`` from the enclosure, including ``std::bad_alloc``. ``gpr_model_get_noise_floor_report`` returns ``GPR_ERR_CHOLESKY`` for ``std::runtime_error`` and every class derived from it. ``gpr_model_train_marginal_likelihood_checked`` returns ``GPR_ERR_OPTIMIZER`` for the same ``std::runtime_error`` classes. ``gpr_set_training_product`` returns ``GPR_ERR_UNSUPPORTED`` for any other ``std::exception``, and rethrows ``std::invalid_argument``, ``std::length_error`` and ``std::bad_alloc`` into the common handler. ``gpr_check_model_package`` returns ``GPR_ERR_UNSUPPORTED`` for any other ``std::exception``, including ``std::invalid_argument`` and ``std::length_error``, and rethrows only ``std::bad_alloc``. A constructor or a search that returns a handle returns ``NULL`` on failure and leaves the status and message where ``gpr_last_status`` and ``gpr_last_error_message`` read them. The message and status belong to the calling thread, and the next status-returning call, ``NULL``-handle accessor (``usable_or_null``), or destroy call on that thread clears them (except that all destroy calls preserve a pending ``GPR_ERR_ORACLE`` during cleanup); successful count/flag/rank accessors on live handles leave the thread's status and message intact. A function that returns a count, a flag or a value (the rows say so) returns that value instead, and a ``NULL`` handle gives 0 (or -1 for ``gpr_model_fit_iterations``, and "missing" for ``gpr_model_fit_stop_reason``). Version, ABI and errors ----------------------- .. table:: +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +============================+=========================================================================================================================================+========================+================================================================================================================================================================================================================================================================================================+================================================================================================================================================================================================================================================================+ | ``gpr_version`` | Release version of the library as "major.minor.patch". | none | Static string; the caller does not free it. | Never fails; never ``NULL``. | +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_version_components`` | Release version as three integers. | three ``int`` outputs | Caller supplies each pointer; any may be ``NULL``. | Returns nothing; unparsed parts are 0. | +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_abi_version`` | ABI major and minor of the loaded library. | two ``int`` outputs | Caller supplies each pointer; any may be ``NULL``. | Returns nothing. | +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_abi_check`` | Check that the loaded library implements the ABI a caller was built against. The macro ``GPR_ABI_CHECK()`` passes the header's numbers. | header major and minor | none | ``GPR_ERR_ABI`` with both versions in the message when the major differs or the library minor is lower. | +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_last_error`` | Message of the last failing call on this thread. | none | Thread-local string, valid until the next status-returning call, constructor, ``NULL``-handle accessor, or non-oracle destroy on the thread; preserved across successful count/flag/rank accessors and when preserving ``GPR_ERR_ORACLE`` during destroy cleanup; the caller does not free it. | Never fails; never ``NULL``, empty after a cleared status. | +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_last_error_message`` | The same string under the name the bindings call (ABI 1.6). | none | As ``gpr_last_error``. | As ``gpr_last_error``. | +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_last_error_copy`` | Copy the message into a caller buffer. | ``capacity`` bytes | The caller owns ``buf``; ``buf`` may be ``NULL`` when ``capacity`` is 0. | Returns the message length; a value of at least ``capacity`` means the copy was cut. The copy is terminated when ``capacity`` is above 0. | +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_status_name`` | Name of a status code, such as "GPR\_ERR\_ORACLE". | a status code | Static string; the caller does not free it. | Never ``NULL``; an unknown code gives a generic name. | +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_last_status`` | Status of the last failing call on this thread, like ``errno``. | none | none | Returns the code; ``GPR_SUCCESS`` after a status-returning success, constructor success, ``NULL``-handle accessor, or non-oracle destroy; preserved across successful count/flag/rank accessors and when preserving ``GPR_ERR_ORACLE`` during destroy cleanup. | +----------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Configuration defaults ---------------------- Each function returns a struct by value, filled with the library defaults. The header states the default beside each field. The caller edits the copy and passes it by pointer; the library reads it during the call. .. table:: +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +=========================================+===========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+====================================================================================================================================================+=====================================================+========================================================+ | ``gpr_atoms_config_defaults`` | Zeroed atoms descriptor: every atom moves, one type, atomic number 1. | per-atom arrays are ``NULL`` | Returned by value; the arrays stay with the caller. | Never fails. | +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ | ``gpr_atoms_simple`` | Descriptor for :math:`n` identical moving atoms with one pair type. | ``n_atoms`` atoms | Returned by value. | Never fails. | +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ | ``gpr_model_config_defaults`` | GP and Student-t settings: ``sigma2`` and ``jitter_sigma2`` 1e-4, tolerances 1e-3, SCG with 400 iterations. | noise variances in squared output units | Returned by value. | Never fails. | +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ | ``gpr_dimer_config_defaults`` | Dimer settings, the unflagged ``gprd`` values. | angles in radians; lengths in the coordinate unit; variance gate in squared energy unit | Returned by value. | Never fails. | +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ | ``gpr_neb_config_defaults`` | NEB and GP-NEB settings: GP-OIE mode, climbing image on, tolerance 0.05, at most 200 outer iterations, ``use_idpp`` 0. SIDPP is the library initializer when ``use_idpp`` is nonzero. | force tolerance in energy per coordinate unit; ``lbfgs_max_move`` in Angstrom | Returned by value. | Never fails. | +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ | ``gpr_local_band_config_defaults`` | Local-band knobs (ABI 1.6). | lengths in Angstrom | Returned by value. | Never fails. | +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ | ``gpr_periodic_band_config_defaults`` | Periodic-band choices (ABI 1.7): uniform springs, linear path, tolerance 0.05. | ``fmax`` in eV/Angstrom, spring in eV/Angstrom:math:`^2`, ``max_move`` in Angstrom | Returned by value. | Never fails. | +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ | ``gpr_ocineb_config_defaults`` | Minimum-mode dimer-burst controls of OCINEB (ABI 1.2). | cosine tolerance is dimensionless; forces as for the NEB | Returned by value. | Never fails. | +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ | ``gpr_minimize_config_defaults`` | Minimizer settings. | ``conv_tol`` is a gradient norm in energy per coordinate unit | Returned by value. | Never fails. | +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ | ``gpr_neb_request_index_certificate`` | Ask the next NEB search on this thread to certify the stopped band (ABI 1.6). The request is consumed by that search. On the periodic searches a nonzero ``step`` takes precedence over ``gpr_local_band_config_t::certificate_step``. | ``step`` is the stencil displacement in the coordinate unit; 0 keeps the library step (on the periodic searches, the step of ``certificate_step``) | none; the request is thread-local | ``GPR_ERR_INVALID_ARG`` for a negative ``step``. | +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ | ``gpr_neb_request_sidpp`` | Select SIDPP (1) or classic IDPP (0) for the next NEB search on this thread (ABI 1.16). SIDPP is the default and the request is consumed even if search validation fails. It has no effect on ``gpr_neb_search_periodic`` or ``gpr_neb_search_periodic_potential``, which take the initializer from ``gpr_periodic_band_config_t::initial`` alone (``GPR_PERIODIC_BAND_SIDPP`` builds the sequential IDPP path) and still consume the request. | none | none; the request is thread-local | ``GPR_ERR_INVALID_ARG`` for a value other than 0 or 1. | +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ | ``gpr_neb_request_vibrational_stencil`` | Choose the true-oracle Hessian stencil of the next non-local NEB search on this thread (ABI 1.21). 0, the default, measures every Cartesian coordinate, and the resolution includes the rigid columns. 1 measures the vibrational directions; that resolution is the measured block and can call a borderline mode resolved where 0 leaves it unresolved. The request is consumed by that search. A local or periodic band takes the choice from ``gpr_local_band_config_t::vibrational_stencil`` and still consumes the request. ``gpr_neb_config_t`` stays 280 bytes, so a caller built against ABI 1.14 keeps working. | none | none; the request is thread-local | ``GPR_ERR_INVALID_ARG`` for a value other than 0 or 1. | +-----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------+--------------------------------------------------------+ Atoms handle ------------ .. table:: +-----------------------------+----------------------------------------------+----------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +=============================+==============================================+================================================================================================================+==========================================================================================================================================+================================================================================================================================================================================================================+ | ``gpr_atoms_create`` | Build the atoms handle from a descriptor. | ``is_frozen``, ``atom_types``, ``atomic_nrs`` hold ``n_atoms_total`` entries; ``positions`` holds 3 times that | Caller owns the returned handle and destroys it with ``gpr_atoms_destroy``. The descriptor and its arrays are read during the call only. | Returns ``NULL`` with ``GPR_ERR_INVALID_ARG`` for a ``NULL`` descriptor, ``n_atoms_total`` below 1, a negative or non-finite ``actdist_fro``, or a type index that is negative or not below ``n_atoms_total``. | +-----------------------------+----------------------------------------------+----------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_atoms_create_simple`` | Handle for :math:`n` identical moving atoms. | ``n_atoms`` atoms | As ``gpr_atoms_create``. | As ``gpr_atoms_create``, so ``NULL`` for ``n_atoms`` below 1. | +-----------------------------+----------------------------------------------+----------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_atoms_destroy`` | Free an atoms handle. | none | Takes ownership back. Accepts ``NULL``. | Returns nothing; clears ``gpr_last_status`` and ``gpr_last_error`` on ``NULL`` or a live handle (preserving ``GPR_ERR_ORACLE`` during cleanup), and sets ``GPR_ERR_INVALID_ARG`` on a handle that is not live. | +-----------------------------+----------------------------------------------+----------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_atoms_n_moving`` | Number of moving atoms. | atoms | The handle stays with the caller. | Returns the count; 0 for ``NULL``. | +-----------------------------+----------------------------------------------+----------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_atoms_n_pairtypes`` | Number of pair types of the kernel. | pair types | The handle stays with the caller. | Returns the count; 0 for ``NULL``. | +-----------------------------+----------------------------------------------+----------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Model lifecycle and training ---------------------------- .. table:: +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +=================================================+======================================================================================================================================================================================================================================================================================================================================================================================================+========================================================================================================================================================+==================================================================================================+===================================================================================================================================================================================================================================+ | ``gpr_model_create`` | Create an empty GP (``GPR_MODEL_GP``) or Student-t (``GPR_MODEL_TP``) model. | none | Caller owns the handle and destroys it with ``gpr_model_destroy``. | Returns ``NULL`` on an allocation failure. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_destroy`` | Free a model and the data it copied. | none | Takes ownership back. Accepts ``NULL``. | Returns nothing; clears ``gpr_last_status`` and ``gpr_last_error`` on ``NULL`` or a live handle (preserving ``GPR_ERR_ORACLE`` during cleanup), and sets ``GPR_ERR_INVALID_ARG`` on a handle that is not live. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_type`` | Type tag the model was created with. | none | The handle stays with the caller. | Returns the tag; ``GPR_MODEL_GP`` for ``NULL``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_init`` | Configure the model and copy the atoms descriptor. It can be called again to reconfigure: the model is rebuilt, so it is untrained and a later fit starts from the library defaults exactly as on a fresh handle. | one ``gpr_model_config_t`` | The library copies the atoms descriptor, so the caller may destroy ``atoms`` afterwards. | ``GPR_ERR_NULL_HANDLE`` for a ``NULL`` model or a model or atoms handle that is not live; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` config or atoms handle, or for ``GPR_OPT_FACTORIZED``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_train`` | Fit hyperparameters and the posterior on :math:`n` observations. It replaces earlier training data. | ``R`` and ``G`` are :math:`n \times N`, ``E`` has :math:`n` entries; ``n_coords`` must equal 3 times the moving atom count | The library copies the arrays, so the caller may free them after the call. | ``GPR_ERR_INVALID_ARG`` before ``gpr_model_init``, for a ``NULL`` array, a non-positive size or an ``n_coords`` mismatch. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_train_checked`` | ``gpr_model_train`` with the length of each buffer (ABI 1.11). | lengths in doubles: ``R_len``, ``G_len`` at least :math:`nN`, ``E_len`` at least :math:`n` | As ``gpr_model_train``. | ``GPR_ERR_INVALID_ARG``, naming the short buffer, before any read. Otherwise as ``gpr_model_train``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_update`` | Append observations and optimise the hyperparameters again on the whole set. It is not a rank-one update. | ``R_new``, ``G_new`` are :math:`n_{new} \times N=, =E_new= has \(n_{new}` entries | The library copies the arrays. | ``GPR_ERR_NOT_TRAINED`` before a train; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` array, a non-positive size or an ``n_coords`` mismatch. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_update_checked`` | ``gpr_model_update`` with buffer lengths (ABI 1.11). | lengths in doubles, as for ``gpr_model_train_checked`` | As ``gpr_model_update``. | ``GPR_ERR_INVALID_ARG`` for a short buffer; otherwise as ``gpr_model_update``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_train_marginal_likelihood_checked`` | Fit the signal variance and length scales by the Gaussian negative log marginal likelihood alone, with no prior or barrier term, and install the posterior (ABI 1.13). When the first start does not converge the fit restarts once, still without a prior; ``gpr_model_fit_restarts`` reports it. | arrays as ``gpr_model_train_checked``; ``lengthscales_len`` at least the value of ``gpr_model_n_lengthscales``; the report is in physical output units | The library copies the observations. The caller supplies the report and the length-scale buffer. | ``GPR_ERR_INVALID_ARG`` for a short buffer; ``GPR_ERR_OPTIMIZER`` when the fit throws a ``std::runtime_error`` (or a derived class) or does not return finite parameters; see the exception table in :doc:`the C reference ` . | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_append_fixed_checked`` | Append complete energy-gradient rows at the fitted hyperparameters by a Cholesky block update, with no refit and no full factorisation (ABI 1.13). | arrays as ``gpr_model_update_checked`` | The library copies the rows. | ``GPR_ERR_NOT_TRAINED`` before a train; ``GPR_ERR_UNSUPPORTED`` when the live factor cannot be extended in place; ``GPR_ERR_INVALID_ARG`` for a short buffer or a shape mismatch. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_fit_iterations`` | Optimizer iterations of the last train: rgmin's SCG steps plus the L-BFGS fallback steps that finish a stalled rgmin SCG fit. After a restarted marginal-likelihood fit the count covers both passes. | iterations | The handle stays with the caller. | Returns the count; -1 for a missing model. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_fit_restarts`` | Restarts the last train needed (ABI 1.15): 1 when ``gpr_model_train_marginal_likelihood_checked`` restarted after its first start failed to converge, 0 after any other train or before one. The count is also set when the restart fails and the fit returns ``GPR_ERR_OPTIMIZER``. | restarts | Caller supplies the ``int``. | ``GPR_ERR_NULL_HANDLE`` for a ``NULL`` model; ``GPR_ERR_INVALID_ARG`` for an uninitialised model or a ``NULL`` ``out``. Neither writes the ``int``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_fit_stop_reason`` | Why the last train stopped: "budget" when an rgmin fit exhausts its iteration budget, "library" when it does not, "restored scg point" when a rejected L-BFGS fallback restores the SCG point, "wall-clock limit" when the wall is already spent, "non-finite marginal likelihood" when a failed fit keeps a non-finite input marginal likelihood, "unset" before any train, "missing" for ``NULL``. | none | Static string; the caller does not free it. | Never fails; never ``NULL``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_n_observations`` | Number of stored training observations. | observations | The handle stays with the caller. | Returns the count; 0 for ``NULL`` or an untrained model. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Prediction ---------- Every prediction function takes the ``n_coords`` of the training call and rejects another value with ``GPR_ERR_INVALID_ARG``. Every one returns ``GPR_ERR_NOT_TRAINED`` before a train, except the support query, which reports zero. The ``_checked`` forms add a length in doubles after each pointer and return ``GPR_ERR_INVALID_ARG`` for a short buffer before writing. .. table:: +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +========================================================+=====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+========================================================================================================+====================================================================+=======================================================================================================================================================================================================================================================================================================================================================================================================================================+ | ``gpr_model_predict`` | Posterior mean energy and gradient at one point. | query, gradient: :math:`N`; energy: one value | Caller supplies the output arrays. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer or an ``n_coords`` mismatch. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_checked`` | ``gpr_model_predict`` with buffer lengths (ABI 1.11). | ``R_len``, ``G_len`` at least :math:`N` | As ``gpr_model_predict``. | As ``gpr_model_predict``, plus the short-buffer rejection. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_variance`` | Posterior variance of the energy and of each gradient component. | energy variance in squared energy unit; gradient variance :math:`N` values | Caller supplies the output arrays. | As ``gpr_model_predict``. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_variance_checked`` | ``gpr_model_predict_variance`` with buffer lengths (ABI 1.11). | ``R_len``, ``var_G_len`` at least :math:`N` | As ``gpr_model_predict_variance``. | As ``gpr_model_predict_variance``, plus the short-buffer rejection. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_full`` | Mean and variance of energy and gradient in one call. | as ``gpr_model_predict`` and ``gpr_model_predict_variance`` | Caller supplies the output arrays. | As ``gpr_model_predict``. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_full_checked`` | ``gpr_model_predict_full`` with buffer lengths (ABI 1.11). | lengths at least :math:`N` for query, gradient and variance gradient | As ``gpr_model_predict_full``. | As ``gpr_model_predict_full``, plus the short-buffer rejection. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_batch`` | Prediction at :math:`q` query points. Either variance output may be ``NULL`` to skip it. | queries, gradients: :math:`q \times N`; energies: :math:`q` | Caller supplies the output arrays. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for a shape mismatch. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_batch_checked`` | ``gpr_model_predict_batch`` with buffer lengths (ABI 1.11). | lengths at least :math:`qN` for queries and gradients, :math:`q` for energies | As ``gpr_model_predict_batch``. | As ``gpr_model_predict_batch``, plus the short-buffer rejection. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_prediction_factors`` | The kernel row, the weights and the scale of one energy prediction, in the trained factor order. | ``capacity`` is the length of ``kstar`` and ``weights`` in doubles; ``order`` receives the length used | Caller supplies every output buffer. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` when ``capacity`` is too small. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_hessian`` | Symmetric dense Hessian of the posterior mean. The sources are tried in this order. An active posterior whose background and residual kernels are both exact assembles their matrices. Otherwise, when the model is neither an atomic environment nor an active posterior, a prepared HS-SVD operator applied to the identity is the matrix, and it is tried before any exact MAP kernel Hessian. A failed apply is final: the call returns ``GPR_ERR_UNSUPPORTED`` and does not write ``H_out``, and it does not fall through to the exact kernel, the action columns or the fourth-order gradient stencil. When that operator is not prepared, a MAP kernel with an exact Hessian assembles the columns of its exact action. Refusal of an exact term is final and is not replaced by a finite-difference stencil, including in a mean with one exact term and one generic term. A generic term without an analytic contraction is not a refusal; the matrix is then the columns of the prepared mean-Hessian action, whose generic miss uses the fourth-order gradient stencil. An atomic-environment model skips the exact and HS-SVD assembly and always uses the dispatched product. The stored matrix is the symmetric part. | ``H_out`` is :math:`N \times N`, row-major | Caller supplies ``H_out``. A failing call does not write it. | ``GPR_ERR_UNSUPPORTED`` when the assembly refuses or the Hessian is unavailable, including a prepared HS-SVD block apply that fails. That refusal does not fall through to the action columns or to a finite-difference stencil. Otherwise as ``gpr_model_predict``. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_hessian_checked`` | ``gpr_model_predict_hessian`` with buffer lengths (ABI 1.24). | ``R_len`` at least :math:`N`; ``H_len`` at least :math:`N^2` | As ``gpr_model_predict_hessian``. | As ``gpr_model_predict_hessian``, plus short-buffer rejection before writing output. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_hessian_action`` | One action of the prepared posterior-mean Hessian, :math:`Hv` (ABI 1.8). An exact kernel that returns no action, or an action that returns false, refuses, including when that term is one part of a mean whose other term is generic. A kernel without an analytic contraction uses the fourth-order gradient stencil. An atomic-environment model uses the dispatched product. | ``v``, ``Hv_out``: :math:`N` | Caller supplies ``Hv_out``. A failing call does not write it. | ``GPR_ERR_UNSUPPORTED`` when the prepared action is missing or returns false; ``GPR_ERR_INTERNAL`` when the product length is not :math:`N`; otherwise as ``gpr_model_predict``. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_hessian_action_checked`` | ``gpr_model_predict_hessian_action`` with buffer lengths (ABI 1.12). | ``R_len``, ``v_len``, ``Hv_len`` at least :math:`N` | As ``gpr_model_predict_hessian_action``. | As ``gpr_model_predict_hessian_action``, plus the short-buffer rejection. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_prediction_supported`` | Whether the query lies inside the kernel support, by the decision the active-learning loops use (ABI 1.12). | ``supported`` receives 1 or 0 | Caller supplies the ``int``. | ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer or an ``n_coords`` mismatch. An untrained model reports 0, not an error. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_prediction_supported_checked`` | The support query with a buffer length (ABI 1.12). | ``R_len`` at least :math:`N` | As ``gpr_model_prediction_supported``. | As ``gpr_model_prediction_supported``, plus the short-buffer rejection. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_energy_variance_interval`` | Lower and upper endpoints that enclose the energy variance of each query point, from the bordered Schur certificate of an exact-kernel HS-SVD MAP model (ABI 1.14). | queries: :math:`q \times N`; both outputs: :math:`q` values in squared energy unit | Caller supplies both output arrays; neither is written on failure. | ``GPR_ERR_NULL_HANDLE`` for a ``NULL`` model (liveness is not tested); ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer, a non-positive ``n_queries`` or an ``n_coords`` mismatch; ``GPR_ERR_UNSUPPORTED`` for any other model; ``GPR_ERR_CHOLESKY`` when :math:`K + \sigma^2 I` is not certified positive definite or the upper endpoint is negative. See the exception table in :doc:`the C reference ` . | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_predict_energy_variance_interval_checked`` | ``gpr_model_predict_energy_variance_interval`` with buffer lengths (ABI 1.14). | ``R_len`` at least :math:`qN`; both output lengths at least :math:`q` | As ``gpr_model_predict_energy_variance_interval``. | As ``gpr_model_predict_energy_variance_interval``, plus the short-buffer rejection. | +--------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Posterior derivatives --------------------- The batched primitives of ABI 1.20 work on :math:`B` points, ``R`` of :math:`B \times N` values. Each fills a ``gpr_derivative_report_t`` when one is given: the unit tags, the point count, whether rigid motions were projected, the largest posterior energy standard deviation and its point, the rigid invariance residuals and, for the conditioning call, how the factor was extended. Options are a ``gpr_derivative_options_t`` or ``NULL`` for the defaults. With ``max_energy_std`` above zero a point whose posterior energy standard deviation exceeds it returns ``GPR_ERR_OUT_OF_SUPPORT``, writes the report and leaves every output untouched. Variances and covariances are probabilistic estimates under the fitted GP, never certificates. Calls on one model are serialized by a per-model lock; with one BLAS thread the results are bit-identical from run to run. .. table:: +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +===================================================+===============================================================================================================================================================================================================================================================================================================+===============================================================================================================================================================================+==========================================================================================+=====================================================================================================================================================================================================================================+ | ``gpr_derivative_options_defaults`` | The default ``gpr_derivative_options_t`` with ``struct_size`` set: native unit tags, no rigid projection, no support threshold, the default variance step (ABI 1.20). | none | Returns the struct by value. | Cannot fail. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_mean_hessian_batch`` | Exact posterior-mean Hessians at :math:`B` points, symmetric, and optionally the six rigid invariance residuals :math:`\lVert H g_k \rVert` per point (ABI 1.20). | ``H_out``: :math:`B N^2`, point-major and row-major, in energy per length squared; ``residuals_out``: :math:`6B` or ``NULL`` | Caller supplies the outputs and the report. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer, a bad option or an ``n_coords`` mismatch; ``GPR_ERR_UNSUPPORTED`` for a model without a mean-Hessian operator; ``GPR_ERR_OUT_OF_SUPPORT``. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_mean_hessian_batch_checked`` | ``gpr_model_mean_hessian_batch`` with buffer lengths (ABI 1.20). | ``R_len`` at least :math:`BN`, ``H_len`` at least :math:`BN^2`, ``residuals_len`` at least :math:`6B` | As ``gpr_model_mean_hessian_batch``. | As ``gpr_model_mean_hessian_batch``, plus the short-buffer rejection. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_mean_hessian_action_batch`` | Posterior-mean Hessian actions :math:`H(x_b) v_{b,i}` for :math:`k` vectors per point (ABI 1.20). | ``V``, ``Hv_out``: :math:`BkN`, the vectors of point :math:`b` as :math:`k` rows | Caller supplies ``Hv_out``. | As ``gpr_model_mean_hessian_batch``; ``GPR_ERR_INVALID_ARG`` for :math:`k < 1`. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_mean_hessian_action_batch_checked`` | ``gpr_model_mean_hessian_action_batch`` with buffer lengths (ABI 1.20). | ``R_len`` at least :math:`BN`; ``V_len``, ``Hv_len`` at least :math:`BkN` | As ``gpr_model_mean_hessian_action_batch``. | As ``gpr_model_mean_hessian_action_batch``, plus the short-buffer rejection. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_hessian_bilinear_covariance`` | Posterior covariance of :math:`v_i^\top H w_j` at each point, over the pairs :math:`i k_r + j` (ABI 1.20). | ``V``: :math:`B k_l N`; ``W``: :math:`B k_r N`; ``cov_out``: :math:`B (k_l k_r)^2` in squared Hessian units | Caller supplies ``cov_out``. | As ``gpr_model_mean_hessian_action_batch``. ``GPR_ERR_UNSUPPORTED``, outputs untouched, when a covariance or variance overflows, is NaN or underflows the normal double range. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_hessian_bilinear_covariance_checked`` | ``gpr_model_hessian_bilinear_covariance`` with buffer lengths (ABI 1.20). | lengths at least the extents above | As ``gpr_model_hessian_bilinear_covariance``. | As ``gpr_model_hessian_bilinear_covariance``, plus the short-buffer rejection. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_hessian_trace_variance`` | Posterior variance of :math:`\mathrm{tr}(A\,\delta H)` for one symmetric :math:`A` per point (ABI 1.20). | ``A``: :math:`B N^2`, row-major; ``var_out``: :math:`B` | Caller supplies ``var_out``. | As ``gpr_model_mean_hessian_batch``; ``GPR_ERR_INVALID_ARG`` for a non-symmetric :math:`A`. ``GPR_ERR_UNSUPPORTED``, outputs untouched, when a covariance or variance overflows, is NaN or underflows the normal double range. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_hessian_trace_variance_checked`` | ``gpr_model_hessian_trace_variance`` with buffer lengths (ABI 1.20). | ``R_len`` at least :math:`BN`, ``A_len`` at least :math:`BN^2`, ``var_len`` at least :math:`B` | As ``gpr_model_hessian_trace_variance``. | As ``gpr_model_hessian_trace_variance``, plus the short-buffer rejection. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_posterior_variance_batch`` | Posterior variance of the energy and of each gradient component at :math:`B` points (ABI 1.20). | ``var_E_out``: :math:`B` in squared energy unit; ``var_G_out``: :math:`BN` | Caller supplies both outputs. | As ``gpr_model_mean_hessian_batch``, without ``GPR_ERR_UNSUPPORTED``. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_posterior_variance_batch_checked`` | ``gpr_model_posterior_variance_batch`` with buffer lengths (ABI 1.20). | ``R_len``, ``var_G_len`` at least :math:`BN`; ``var_E_len`` at least :math:`B` | As ``gpr_model_posterior_variance_batch``. | As ``gpr_model_posterior_variance_batch``, plus the short-buffer rejection. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_condition_fixed`` | Condition the posterior on caller-chosen oracle rows with the hyperparameters held fixed, then predict mean and variance at query points; equal to a fresh fit at those hyperparameters to roundoff (ABI 1.20). | ``R_new``, ``G_new``: :math:`n_{\mathrm{new}} N`; ``E_new``: :math:`n_{\mathrm{new}}`; ``R_query``, ``G_out``, ``var_G_out``: :math:`qN`; ``E_out``, ``var_E_out``: :math:`q` | Caller supplies every output. The rows join the model's training data. | As ``gpr_model_posterior_variance_batch``; ``GPR_ERR_UNSUPPORTED``, model unchanged, when the rows cannot be factored; ``GPR_ERR_OUT_OF_SUPPORT`` with the rows appended and the outputs untouched. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_condition_fixed_checked`` | ``gpr_model_condition_fixed`` with buffer lengths (ABI 1.20). | every length at least its extent above | As ``gpr_model_condition_fixed``. | As ``gpr_model_condition_fixed``, plus the short-buffer rejection. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_condition_fixed_hessian`` | Condition the posterior on a fixed point with an optional exact Hessian or Hessian-vector-product callback ``gpr_hvp_fn``, then predict mean and variance at query points (ABI 1.20). When recorded, ``gpr_htst_half`` at ``R_new`` uses the exact Hessian in the Vineyard prefactor instead of GP curvature. | As ``gpr_model_condition_fixed`` with :math:`n_{\mathrm{new}} = 1` when ``H_new`` or ``hvp`` is non-``NULL``; ``H_new``: :math:`N^2` row-major or ``NULL`` | As ``gpr_model_condition_fixed``; the library copies the symmetric Hessian at ``R_new``. | As ``gpr_model_condition_fixed``; ``GPR_ERR_INVALID_ARG``, model and outputs untouched, if both ``H_new`` and ``hvp`` are non-``NULL``, :math:`n_{\mathrm{new}} \ne 1`, or the Hessian or HVP operator is non-finite or asymmetric. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_condition_fixed_hessian_checked`` | ``gpr_model_condition_fixed_hessian`` with buffer lengths (ABI 1.20). | every length at least its extent above; ``H_new_len`` at least :math:`N^2` when ``H_new`` is non-``NULL`` | As ``gpr_model_condition_fixed_hessian``. | As ``gpr_model_condition_fixed_hessian``, plus the short-buffer rejection. | +---------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Calibration ----------- .. table:: +----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +========================================+===================================================================================================================================================+===========================================================================================================================================================+========================================================+===================================================================================================================================================+ | ``gpr_model_calibrate_forces_checked`` | Standardised residuals of the true force on held-out rows, with coverage and a calibration scale (ABI 1.13). The rows are not added to the model. | ``R_holdout``, ``G_true``: :math:`n_h \times N`, ``G_true`` is the energy gradient; ``nominal_probability`` is in (0, 1); the report holds physical units | Caller supplies the report; the library keeps nothing. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for a short buffer, a Student-t model or a probability without a representable central quantile. | +----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_calibrate_loo_checked`` | Closed-form leave-one-out calibration of every training channel (ABI 1.13). It makes no oracle call and does not change the model. | ``nominal_probability`` as above | Caller supplies the report. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for a Student-t model or an unusable probability. | +----------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ Hyperparameters and the random-feature setting ---------------------------------------------- .. table:: +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +========================================+=====================================================================================================================================================================================================================================================+===============================================================================================================+=====================================================================+=================================================================================================================================================================================================================================================================================================================================================+ | ``gpr_model_n_lengthscales`` | Number of kernel length scales. | count | The handle stays with the caller. | Returns the count; 0 for ``NULL`` or an uninitialised model. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_get_lengthscales`` | Copy the length scales out. | ``out`` holds ``gpr_model_n_lengthscales`` doubles | Caller supplies ``out``. | ``GPR_ERR_INVALID_ARG`` for an uninitialised model or a ``NULL`` pointer. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_set_lengthscales`` | Replace the length scales. | ``n_values`` must equal ``gpr_model_n_lengthscales`` | The library copies the values. | ``GPR_ERR_INVALID_ARG`` for an uninitialised model, a ``NULL`` pointer, a non-positive count or a count mismatch. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_get_magn_sigma2`` | Signal variance. | squared output unit | Caller supplies the ``double``. | ``GPR_ERR_INVALID_ARG`` for an uninitialised model or a ``NULL`` pointer. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_set_magn_sigma2`` | Set the signal variance. | squared output unit | none | ``GPR_ERR_INVALID_ARG`` for an uninitialised model. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_get_sigma2`` | Physical output-noise variance. | squared output unit | Caller supplies the ``double``. | ``GPR_ERR_INVALID_ARG`` for an uninitialised model or a ``NULL`` pointer. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_set_sigma2`` | Set a positive finite noise variance and refresh the noise-dependent state of a trained model. | squared output unit | none | ``GPR_ERR_INVALID_ARG`` for an uninitialised model or a value that is not positive and finite. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_get_jitter`` | Numerical diagonal jitter variance of an initialised model. | squared output unit | Caller supplies the ``double``. | ``GPR_ERR_INVALID_ARG`` for an uninitialised model or a ``NULL`` pointer. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_set_hssvd_backend`` | Select the posterior solver of an initialised model for its next training call (ABI 1.19): ``GPR_HSSVD_BACKEND_DEFAULT`` (0) and ``GPR_HSSVD_BACKEND_HSSVD`` (1) keep the HS-SVD stable basis, ``GPR_HSSVD_BACKEND_CHOLESKY`` (2) selects Cholesky. | a ``gpr_hssvd_backend_t`` value | none | ``GPR_ERR_NULL_HANDLE`` for a ``NULL`` or dead model; ``GPR_ERR_INVALID_ARG`` for an uninitialised model or any other value. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_get_hssvd_backend`` | The ``gpr_hssvd_backend_t`` value last stored by ``gpr_model_init`` or ``gpr_model_set_hssvd_backend`` (ABI 1.19). | a ``gpr_hssvd_backend_t`` value | Caller supplies the ``int``. | ``GPR_ERR_NULL_HANDLE`` for a ``NULL`` or dead model; ``GPR_ERR_INVALID_ARG`` for an uninitialised model or a ``NULL`` ``out``. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_get_noise_floor_report`` | The condition-floored noise a trained model inverts, the certificate gap and the noise the variance interval certifies (ABI 1.14). | ``gpr_noise_floor_report_t``: noise values in squared output unit | Caller supplies the struct; it is untouched on failure. | ``GPR_ERR_NULL_HANDLE`` for a ``NULL`` model (liveness is not tested); ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer; ``GPR_ERR_UNSUPPORTED`` for a model that is not an exact-kernel HS-SVD MAP model; ``GPR_ERR_CHOLESKY`` when the factor cannot be built. See the exception table in :doc:`the C reference ` . | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_get_alpha`` | Posterior mean weights :math:`\alpha`. | ``out`` needs :math:`n(1+N)` doubles; ``n`` is its capacity | Caller supplies ``out``; a buffer that is too small is not written. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer or a small capacity. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_tp_prefactor`` | Signal-variance prefactor of a Student-t model. | one value | Caller supplies the ``double``. | ``GPR_ERR_INVALID_ARG`` for a GP model or a ``NULL`` pointer; ``GPR_ERR_NOT_TRAINED``. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_set_rff_features`` | Set the random-feature count: positive for a fixed count, 0 for off, -1 for held-out selection (ABI 1.9). Selection runs on the next train or update. | ``force_tol_fraction`` is used for -1 only: 0 derives it from the gradient noise, otherwise it lies in [0, 1) | none | ``GPR_ERR_INVALID_ARG`` for an uninitialised model, a Student-t model with a nonzero count, a count below -1 or a fraction out of range. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_get_rff_selection`` | Copy the report of the last selection. Before a train it is the empty report (ABI 1.9). | ``gpr_rff_selection_t``: errors in eV and eV/Angstrom, sizes in bytes | Caller supplies the struct. | ``GPR_ERR_INVALID_ARG`` for an uninitialised model or a ``NULL`` pointer. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_set_rigid_null_deflation`` | Enable (1) or disable (0, default) rigid-motion nullspace deflation on training factorizations (ABI 1.22). Toggling invalidates any cached posterior factorization so the model must be re-trained before predicting. | ``enabled`` is 0 or 1 | none | ``GPR_ERR_NULL_HANDLE`` for a ``NULL`` or destroyed model; ``GPR_ERR_INVALID_ARG`` for an uninitialised model, a Student-t model with ``enabled=1``, a value other than 0 or 1, or an incompatible ``principled_nugget`` configuration; ``GPR_ERR_UNSUPPORTED`` on ScaLAPACK builds when ``enabled=1``. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_model_get_rigid_null_deflation`` | Query whether rigid-motion nullspace deflation is enabled (ABI 1.22). | writes 1 or 0 to ``\*out`` | Caller supplies ``out``; untouched on failure. | ``GPR_ERR_NULL_HANDLE`` for a ``NULL`` or destroyed model; ``GPR_ERR_INVALID_ARG`` for an uninitialised model or a ``NULL`` pointer. | +----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Scalar GP and Bayesian quadrature --------------------------------- A handle has one writer at a time. The functions that change it are ``gpr_bq_reset``, the train, append and fit functions, every ``set`` function and ``gpr_bq_destroy``; none of them may overlap another call on the same handle, and the library takes no lock on the handle. Distinct handles may be used from different threads. A destroyed handle gives ``GPR_ERR_NULL_HANDLE`` from a status function and 0 from a query function; a second ``gpr_bq_destroy`` sets ``GPR_ERR_INVALID_ARG``. A function that fails leaves its output buffers unwritten. ``GPR_ERR_OPTIMIZER`` means that hyperparameter inference failed and the model kept its previous state; the library does not substitute another treatment. .. table:: +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +=================================================+==================================================================================================================================================================+=============================================================================================================================================================================================================================================================+===================================================================================================================+==================================================================================================================================================================================================================================================================================================================================+ | ``gpr_bq_config_defaults`` | Returns a ``gpr_bq_config_t`` holding the documented defaults (ABI 1.17). | one struct returned by value | Nothing is allocated. | None. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_create`` | Builds a scalar GP and Bayesian quadrature handle from a configuration (ABI 1.17). | ``config`` is one struct, copied; ``NULL`` selects the defaults | Returns a handle that the caller destroys with ``gpr_bq_destroy``. The library keeps a copy of the configuration. | Returns ``NULL`` and sets ``GPR_ERR_INVALID_ARG`` for an invalid configuration, or ``GPR_ERR_UNSUPPORTED`` for an unsupported configuration (``std::domain_error``). | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_destroy`` | Releases a handle. | none | Takes the handle back. Accepts ``NULL``. A handle that was already destroyed is not touched. | Returns nothing; clears ``gpr_last_status`` and ``gpr_last_error`` on ``NULL`` or a live handle (preserving ``GPR_ERR_ORACLE`` during cleanup). A second destroy sets ``GPR_ERR_INVALID_ARG`` in ``gpr_last_status``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_reset`` | Replaces the configuration and drops every observation and any stored box. | ``config`` is one struct, copied; ``NULL`` selects the defaults | The handle stays with the caller; it is a writer call. | ``GPR_ERR_NULL_HANDLE``; ``GPR_ERR_INVALID_ARG`` for an invalid configuration or ``GPR_ERR_UNSUPPORTED`` for an unsupported configuration (``std::domain_error``), leaving the handle unchanged. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_dimension`` | Input dimension of the configuration. | returns a count | Caller keeps the handle. | Returns 0 for ``NULL`` while clearing status and error to ``GPR_SUCCESS``, or for a destroyed handle with ``GPR_ERR_NULL_HANDLE``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_n_observations`` | Number of stored observations. | returns a count | Caller keeps the handle. | Returns 0 for ``NULL`` while clearing status and error to ``GPR_SUCCESS``, or for a destroyed handle with ``GPR_ERR_NULL_HANDLE``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_n_lengthscales`` | Number of length scales, ``dimension`` for an ARD configuration and 1 otherwise. | returns a count | Caller keeps the handle. | Returns 0 for ``NULL`` while clearing status and error to ``GPR_SUCCESS``, or for a destroyed handle with ``GPR_ERR_NULL_HANDLE``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_train_checked`` | Trains on observations and infers the integration box from the training extrema. | ``X``: :math:`n \times d`; ``y``, ``noise_var``: :math:`n`; ``noise_var`` may be ``NULL`` with length 0 for zero noise; ``d`` equals the configured dimension | Caller supplies every input; the library copies what it keeps. | ``GPR_ERR_INVALID_ARG`` for a short buffer, a non-finite value, a negative variance or a dimension mismatch; ``GPR_ERR_CHOLESKY`` when the covariance does not factor; ``GPR_ERR_OPTIMIZER`` when hyperparameter inference fails. A failed call leaves the model unchanged. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_train_bounded_checked`` | Trains and stores an explicit integration box that later refits and appends keep. | as ``gpr_bq_train_checked``, plus ``lower`` and ``upper``: :math:`d` each with ``lower[k] < upper[k]`` | As ``gpr_bq_train_checked``. | As ``gpr_bq_train_checked``; a point outside the box or a degenerate box gives ``GPR_ERR_INVALID_ARG`` and leaves the model unchanged. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_append_checked`` | Appends observations to a trained model, optionally refitting the hyperparameters. | ``X_new``: :math:`m \times d`; ``y_new``, ``noise_var_new``: :math:`m`; ``refit`` nonzero re-infers with the configured treatment | Caller supplies every input; the library copies what it keeps. | As ``gpr_bq_train_checked``, plus ``GPR_ERR_NOT_TRAINED`` before a train. A row outside a stored box gives ``GPR_ERR_INVALID_ARG``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_fit_hyperparameters_checked`` | Re-infers the hyperparameters of a trained model with the given treatment, which becomes the configured treatment. | ``lengthscales_out`` receives ``gpr_bq_n_lengthscales`` values; ``report`` (``gpr_bq_fit_report_t``, including ``failed_trials``) may be ``NULL`` | Caller supplies the report and the buffer; both may be absent. | ``GPR_ERR_NULL_HANDLE``; ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for an invalid treatment or output buffer; ``GPR_ERR_CHOLESKY`` when the covariance does not factor; ``GPR_ERR_OPTIMIZER`` for another BQ inference failure; ``GPR_ERR_INTERNAL`` for another runtime error. A failed call leaves the model unchanged. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_get_lengthscales_checked`` | Copies the current length scales out. | ``out``: ``gpr_bq_n_lengthscales`` values | Caller supplies the buffer. | ``GPR_ERR_NULL_HANDLE``; ``GPR_ERR_INVALID_ARG`` for a short buffer. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_set_lengthscales_checked`` | Pins the length scales and rebuilds a trained model with them held and the signal variance kept, leaving the configured hyperparameter treatment unchanged. | ``values``: ``gpr_bq_n_lengthscales`` positive finite values | Caller supplies the values; the library copies them. It is a writer call. | ``GPR_ERR_INVALID_ARG`` for a wrong count or a value that is not positive and finite; ``GPR_ERR_CHOLESKY`` or ``GPR_ERR_OPTIMIZER`` when the rebuild fails, as for ``gpr_bq_fit_hyperparameters_checked``. A failed call leaves the model unchanged. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_get_magn_sigma2`` | Signal variance of the posterior. | one double in squared output unit | Caller supplies the double. | ``GPR_ERR_NULL_HANDLE``; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_set_magn_sigma2`` | Pins the signal variance and rebuilds a trained model with it held and the length scales kept, leaving the configured hyperparameter treatment unchanged. | one positive finite value | It is a writer call. | ``GPR_ERR_INVALID_ARG`` unless the value is positive and finite; ``GPR_ERR_CHOLESKY`` or ``GPR_ERR_OPTIMIZER`` when the rebuild fails, as for ``gpr_bq_fit_hyperparameters_checked``. A failed call leaves the model unchanged. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_get_extra_sigma2`` | Extra observation-noise variance added to every observation. | one double in squared output unit | Caller supplies the double. | ``GPR_ERR_NULL_HANDLE``; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_set_extra_sigma2`` | Sets the extra observation-noise variance and refits a trained model with its configured treatment. | one non-negative finite value | It is a writer call. | ``GPR_ERR_INVALID_ARG`` unless the value is non-negative and finite; ``GPR_ERR_CHOLESKY`` or ``GPR_ERR_OPTIMIZER`` when the refit fails, as for ``gpr_bq_fit_hyperparameters_checked``. A failed call leaves the model unchanged. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_predict_batch_checked`` | Posterior mean and latent-function variance at several points. | ``X_queries``: :math:`q \times d`; ``mean_out``, ``var_out``: :math:`q`; ``var_out`` may be ``NULL`` with length 0 | Caller supplies the output arrays. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for a short buffer or a dimension mismatch. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_kernel_mean_checked`` | Kernel mean of the box measure at the training points or at explicit points. | ``lower``, ``upper``: :math:`d` each; ``X``: :math:`p \times d`, or ``NULL`` with length 0 for the training points; ``z_out``: :math:`p` | Caller supplies the output array. | ``GPR_ERR_NOT_TRAINED`` when the model has neither observations nor positive configured hyperparameters; ``GPR_ERR_INVALID_ARG``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_kernel_double_integral_checked`` | Kernel double integral over the box. | ``lower``, ``upper``: :math:`d` each; one output in output unit squared times volume squared | Caller supplies the double. | As ``gpr_bq_kernel_mean_checked``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_integrate_checked`` | Integral mean and variance over a box. | ``lower``, ``upper``: :math:`d` each; two doubles out | Caller supplies the doubles. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG``; ``GPR_ERR_INTERNAL`` for another integration exception. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_integrate_report_checked`` | Integral over a box with the full decomposition of the variance. | as ``gpr_bq_integrate_checked``; one ``gpr_bq_integral_report_t`` out | Caller supplies the report. | As ``gpr_bq_integrate_checked``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_integrate_measure_checked`` | Integral against a Lebesgue box, the uniform probability on a box, or a Gaussian measure. | ``kind`` is a ``gpr_bq_measure_kind_t``; a box takes ``lower`` and ``upper`` (:math:`d` each); a Gaussian takes ``mean`` (:math:`d`) and a symmetric positive definite ``covariance`` (:math:`d \times d`); three doubles out: mean, variance, measure mass | Caller supplies every input and the three doubles. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for another ``kind`` or a covariance that is not positive definite; ``GPR_ERR_UNSUPPORTED`` for a product Matern kernel under a non-diagonal covariance in more than two dimensions, where the joint mixture exceeds its node limit. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_integrate_uncertainty_checked`` | As ``gpr_bq_integrate_measure_checked``, with the uncertainty split by source. | as ``gpr_bq_integrate_measure_checked``; one ``gpr_bq_uncertainty_t`` out | Caller supplies the report. | As ``gpr_bq_integrate_measure_checked``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_set_basis`` | Selects the Bayes-Sard mean model: none, constant or affine, or ``GPR_BQ_BASIS_FOLLOW_CONFIG`` to follow ``use_prior_mean``. A trained model is rebuilt with it. | one ``gpr_bq_basis_t`` value | It is a writer call. | ``GPR_ERR_INVALID_ARG`` for another value or when the observations cannot determine the basis; ``GPR_ERR_CHOLESKY`` or ``GPR_ERR_OPTIMIZER`` when the rebuild fails, as for ``gpr_bq_fit_hyperparameters_checked``. A failed call leaves the model unchanged. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_get_basis`` | Active basis selection, ``GPR_BQ_BASIS_FOLLOW_CONFIG`` until one is set. | one ``int`` holding a ``gpr_bq_basis_t`` | Caller supplies the ``int``. | ``GPR_ERR_NULL_HANDLE``; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_integrate_cumulative_checked`` | Joint posterior of the integrals over nested upper limits. | ``lower``: :math:`d`; ``upper_limits``: :math:`l \times d`; ``mean_out``: :math:`l`; ``covariance_out``: :math:`l \times l`, row-major, with the marginal variances on its diagonal | Caller supplies the output arrays. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_sample_cumulative_checked`` | Draws joint samples of the cumulative integrals, deterministic in the seed. | as ``gpr_bq_integrate_cumulative_checked``; ``draws_out``: :math:`n_d \times l`, row-major | Caller supplies the output array. | As ``gpr_bq_integrate_cumulative_checked``; ``GPR_ERR_INVALID_ARG`` for a non-positive draw count. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_candidate_variance_reduction_checked`` | Variance reduction of the integral from one extra observation at each candidate. | ``X_candidates``: :math:`c \times d`; candidate noise: :math:`c`, or ``NULL`` with length 0 for the configured noise; output: :math:`c` | Caller supplies the output array. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG``. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_select_batch_candidates_checked`` | Greedily chooses a batch of candidates, each conditioned on the earlier ones. | as the variance reduction; indices and step reductions: :math:`b` each | Caller supplies the output arrays. | ``GPR_ERR_NOT_TRAINED`` before selection; ``GPR_ERR_INVALID_ARG`` unless ``0 < batch_size <`` n\_candidates=; ``GPR_ERR_INTERNAL`` for another selection exception. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_calibrate_loo_checked`` | Closed-form leave-one-out calibration summary. It makes no oracle call and does not change the model. | ``nominal_probability`` in (0, 1); one ``gpr_calibration_report_t`` out | Caller supplies the report. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for an unusable probability or when the observations do not exceed the basis size; ``GPR_ERR_INTERNAL`` for another numerical failure. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_bq_calibrate_loo_scores_checked`` | As ``gpr_bq_calibrate_loo_checked``, and also writes every standardized leave-one-out score. | ``z_scores_out``: ``gpr_bq_n_observations`` values; one ``gpr_bq_loo_report_t`` out | Caller supplies the report and the buffer. | As ``gpr_bq_calibrate_loo_checked``, plus the short-buffer rejection. | +-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Free-energy surrogate --------------------- A handle has one writer at a time: ``gpr_fes_train_checked`` and ``gpr_fes_destroy`` must not overlap another call on the same handle. A destroyed handle gives ``GPR_ERR_NULL_HANDLE`` from a status function and 0 from a query function; a second ``gpr_fes_destroy`` sets ``GPR_ERR_INVALID_ARG``. A function that fails leaves its outputs unwritten, and a failed train keeps the previous posterior. The size-prefixed structures are read and written up to their ``struct_size``. .. table:: +----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +========================================+==========================================================================================================================================================================================================================================================+========================================================================================================================================================================================================================================================================================+=====================================================================+==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+ | ``gpr_fes_config_init`` | Writes the default ``gpr_fes_config_t`` (squared exponential, one length scale) (ABI 1.23). | first ``min(out_size, sizeof)`` bytes; ``struct_size`` set to that count | Caller supplies the struct. | ``GPR_ERR_INVALID_ARG`` for ``NULL`` or an ``out_size`` below ``sizeof(size_t)``. | +----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_fes_create`` | Builds an untrained free-energy surrogate over ``dimension`` collective variables (ABI 1.23). | both configurations are one struct each, copied; ``NULL`` selects the defaults; ``grad_noise_var`` holds ``dimension`` variances added to the gradient components, copied, or ``NULL`` with length 0 for the value noise over the squared spread of the points along each variable | Returns a handle that the caller destroys with ``gpr_fes_destroy``. | Returns ``NULL`` with ``GPR_ERR_INVALID_ARG`` for a non-positive dimension, ``ard`` other than 0 or 1, an optimizer other than SCG, an invalid field or a ``grad_noise_var`` of the wrong length or with a negative entry; ``GPR_ERR_UNSUPPORTED`` for a kernel other than squared exponential, ``const_sigma2`` or a ZBL or force-field prior mean. | +----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_fes_destroy`` | Releases a handle from ``gpr_fes_create`` (ABI 1.23). | none | The handle is invalid afterwards. | Clears the status for ``NULL`` or a live handle; ``GPR_ERR_INVALID_ARG`` in ``gpr_last_status`` for a destroyed one. | +----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_fes_dimension`` | Collective-variable dimension (ABI 1.23). | count | none | 0 for ``NULL`` or a destroyed handle. | +----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_fes_n_observations`` | Training points of the last successful train (ABI 1.23). | count | none | 0 before training, for ``NULL`` or for a destroyed handle. | +----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_fes_noise_from_weights_checked`` | Noise variances :math:`\sigma^2_\text{ref} w_\text{max} / \max(w_i, r w_\text{max})` from relative sample weights; an approximation that ignores sample correlation (ABI 1.23). | ``weights_len``, ``noise_var_len`` at least ``n_obs``; variances in the square of the unit of :math:`F` | Caller supplies the output. | ``GPR_ERR_INVALID_ARG`` for a short buffer, a non-positive or non-finite weight or reference variance, or a relative weight outside :math:`(0, 1]`. | +----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_fes_train_checked`` | Replaces the training data with :math:`F` and optional gradients and fits the hyperparameters (ABI 1.23). | ``s_len``, ``grad_F_len``, ``grad_noise_var_len`` at least ``n_obs * dimension``; ``F_len``, ``F_noise_var_len``, ``grad_present_len`` at least ``n_obs``; ``F_noise_var`` may be ``NULL`` with length 0; the gradient trio is all given or all ``NULL`` with length 0 | The library copies the data. | ``GPR_ERR_INVALID_ARG`` for a short buffer, a dimension mismatch, a non-finite value, a negative variance, a flag other than 0 or 1, points with no spread or constant data with a fitted signal variance; ``GPR_ERR_CHOLESKY``; ``GPR_ERR_OPTIMIZER``. | +----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_fes_predict_batch_checked`` | Posterior mean of :math:`F` with its gradient and latent variance when requested (ABI 1.23). | ``s_query_len`` and ``grad_F_len`` at least ``n_queries * dimension``, ``F_len`` and ``var_F_len`` at least ``n_queries``; the gradient and variance buffers may be ``NULL`` with length 0 | Caller supplies the outputs. | ``GPR_ERR_NOT_TRAINED`` before a train; ``GPR_ERR_INVALID_ARG`` for a short buffer, a dimension mismatch or a non-finite query. | +----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_fes_rate_config_init`` | Writes the default ``gpr_fes_rate_config_t``: 2048 draws, seed 0, credible mass 0.95, saddle tolerance :math:`10^{-6}`, and ``beta`` 0, which the rate call rejects (ABI 1.23). | first ``min(out_size, sizeof)`` bytes; ``struct_size`` set to that count | Caller supplies the struct. | ``GPR_ERR_INVALID_ARG`` for ``NULL`` or an ``out_size`` below ``sizeof(size_t)``. | +----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_fes_rate_path_checked`` | Overdamped Kramers-Langer rate from ``reactant_index`` to ``product_index`` along a path, at the index-one saddle of the posterior mean, with barrier, prefactor and rate summaries over joint posterior draws of :math:`F` and its Hessians (ABI 1.23). | ``path_len`` at least ``n_path * dimension``, ``n_path`` at least 3; ``diffusion`` holds exactly ``dimension`` diagonal entries of the diffusion tensor, entry :math:`k` in the squared unit of variable :math:`k` per time; ``beta`` in inverse units of :math:`F`, the rate per time | Caller supplies the configuration and the report. | ``GPR_ERR_NOT_TRAINED``; ``GPR_ERR_INVALID_ARG`` for a short path, indices out of range or without an interior point between them, fewer than 2 draws, a non-positive ``beta``, a ``diffusion`` whose length is not ``dimension`` or with an entry that is not positive and finite, a credible mass outside :math:`(0, 1)` or a non-positive saddle tolerance; ``GPR_ERR_NOT_CONVERGED`` when the search finds no index-one saddle of the posterior mean on the path; ``GPR_ERR_UNSUPPORTED`` when the mean barrier at that saddle is not positive or fewer than 90% of the draws have a positive barrier, a positive-definite reactant Hessian and an index-one saddle. | +----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Scalar surrogate and parameter search ------------------------------------- A ``gpr_sgp_t`` is a scalar GP for an oracle that returns a value and, optionally, the variance of its noise. A ``gpr_psearch_t`` minimizes such an oracle over a box by ask and tell. Both take a ``gpr_bq_kernel_t`` value and accept the squared exponential and the two isotropic Matern kernels. The formulas are on the page :doc:`The scalar surrogate for a noisy oracle <../../explanation/scalar_surrogate>`. .. table:: +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +============================================+==========================================================================================================================================================================================================================+================================================================================================================================================================================================================================+=========================================================================+==============================================================================================================================================================================================================================================+ | ``gpr_sgp_create`` | Builds a scalar surrogate over ``dimension`` coordinates with unit hyperparameters and a zero mean (ABI 1.26). | ``kernel`` is a ``gpr_bq_kernel_t`` value | Returns a handle that the caller destroys with ``gpr_sgp_destroy``. | Returns ``NULL`` with ``GPR_ERR_INVALID_ARG`` for a non-positive dimension or an unknown kernel; ``GPR_ERR_UNSUPPORTED`` for a product kernel. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_sgp_destroy`` | Releases a handle from ``gpr_sgp_create`` (ABI 1.26). | none | The handle is invalid afterwards. | Clears the status for ``NULL`` or a live handle; ``GPR_ERR_INVALID_ARG`` in ``gpr_last_status`` for a destroyed one. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_sgp_n_observations`` | Rows observed so far (ABI 1.26). | count | none | 0 for ``NULL`` or a destroyed handle. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_sgp_set_kernel`` | Selects the radial shape; a new fit is needed before a prediction (ABI 1.26). | a ``gpr_bq_kernel_t`` value | none | ``GPR_ERR_INVALID_ARG`` for an unknown value; ``GPR_ERR_UNSUPPORTED`` for a product kernel. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_sgp_set_mean_basis`` | Selects a zero, constant or affine mean, fitted by generalized least squares at each fit (ABI 1.26). | ``GPR_BQ_BASIS_NONE``, ``GPR_BQ_BASIS_CONSTANT`` or ``GPR_BQ_BASIS_AFFINE`` | none | ``GPR_ERR_INVALID_ARG`` for any other value. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_sgp_set_hyperparameters_checked`` | Sets the length scales, the signal variance and the shared noise variance (ABI 1.26). | ``length_scales_len`` is 1 or the dimension; length scales in coordinate units, variances in the squared unit of the values | The library copies the values. | ``GPR_ERR_INVALID_ARG`` for a wrong length, a non-positive length scale or signal variance, or a negative noise variance. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_sgp_get_hyperparameters_checked`` | Reads the hyperparameters, as set or as the last fit left them (ABI 1.26). | ``length_scales_len`` at least the dimension; the two scalar outputs are optional | Caller supplies the outputs. | ``GPR_ERR_INVALID_ARG`` for a ``NULL`` or short length-scale buffer. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_sgp_observe_checked`` | Appends rows with one noise variance each, or without one for rows that share the noise variance (ABI 1.26). | ``X_len`` at least ``n_obs * n_dims``, ``y_len`` and ``noise_var_len`` at least ``n_obs``; ``noise_var`` may be ``NULL`` with length 0 | The library copies the rows. | ``GPR_ERR_INVALID_ARG`` for a short buffer, a non-finite value, a negative variance, a wrong ``n_dims``, or a mixture of rows with and without a variance. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_sgp_fit_checked`` | Conditions on the rows; with ``optimize`` it first maximizes the log marginal likelihood over the length scales, the signal variance and, without per-row noise, the noise variance from ``n_starts`` starts (ABI 1.26). | the optional output is the log marginal likelihood | Caller supplies the output. | ``GPR_ERR_NOT_TRAINED`` without rows; ``GPR_ERR_INVALID_ARG`` for a non-positive ``n_starts`` with ``optimize``; ``GPR_ERR_CHOLESKY``; ``GPR_ERR_OPTIMIZER``. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_sgp_predict_checked`` | Mean and standard deviation at query rows: latent for ``query_noise_var`` 0, of a new run when it is positive (ABI 1.26). | ``X_len`` at least ``n_queries * n_dims``, ``mean_len`` and ``std_len`` at least ``n_queries``; ``std_out`` may be ``NULL`` with length 0 | Caller supplies the outputs. | ``GPR_ERR_NOT_TRAINED`` before a fit; ``GPR_ERR_INVALID_ARG`` for a short buffer, a wrong ``n_dims``, a non-finite query or a negative ``query_noise_var``. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_psearch_create`` | Builds a parameter search over a box; ``noisy`` selects the posterior-mean incumbent (ABI 1.26). | ``lower_len`` and ``upper_len`` at least ``dimension``; ``axis_kind`` holds one ``gpr_psearch_axis_t`` value per axis or is ``NULL`` with length 0 | Returns a handle that the caller destroys with ``gpr_psearch_destroy``. | Returns ``NULL`` with ``GPR_ERR_INVALID_ARG`` for an empty or non-finite bound, a non-positive lower bound of a logarithmic axis, an integer axis without a whole number, or an unknown kind; ``GPR_ERR_UNSUPPORTED`` for a product kernel. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_psearch_destroy`` | Releases a handle from ``gpr_psearch_create`` (ABI 1.26). | none | The handle is invalid afterwards. | Clears the status for ``NULL`` or a live handle; ``GPR_ERR_INVALID_ARG`` in ``gpr_last_status`` for a destroyed one. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_psearch_set_allowed_values_checked`` | Restricts the zero-based ``axis`` to a list of values, ordered by position or, with ``categorical``, unordered (ABI 1.26). | ``values_len`` distinct finite values | The library copies the list. | ``GPR_ERR_INVALID_ARG`` for a bad axis, an empty, repeated or non-finite list, or a call after the first observation or proposal. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_psearch_observe_checked`` | Reports evaluated rows with optional noise variances and constraint values, feasible at or below zero (ABI 1.26). | ``X_len`` at least ``n_obs * n_dims``; ``y_len``, ``noise_var_len`` and ``constraint_len`` at least ``n_obs``; the two optional arrays may be ``NULL`` with length 0; a row without a loss holds NaN and a positive constraint | The library copies the rows. | ``GPR_ERR_INVALID_ARG`` for a short buffer, a wrong ``n_dims``, a non-finite parameter, a NaN loss without a positive constraint, a negative variance or a mixture of rows with and without a variance; no row of the call is then recorded. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_psearch_propose_checked`` | Writes up to ``q`` rows to evaluate next: Halton points before any observation, then expected improvement (times the probability of feasibility) under the constant liar (ABI 1.26). | ``X_len`` at least ``q * n_dims``; ``\*n_proposed_out`` rows are written | Caller supplies the outputs. | ``GPR_ERR_INVALID_ARG`` for a short buffer, a non-positive ``q`` or a wrong ``n_dims``; ``GPR_ERR_CHOLESKY``. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_psearch_best_checked`` | The feasible evaluated row with the smallest loss, or with the smallest posterior mean for a noisy search (ABI 1.26). | ``x_len`` at least the dimension; ``loss_out`` is optional | Caller supplies the outputs. | ``GPR_ERR_NOT_TRAINED`` without a feasible observation; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` or short buffer; ``GPR_ERR_CHOLESKY``. | +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Potential wrapper ----------------- .. table:: +-----------------------------------------------+-------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +===============================================+=====================================================================================+=======================================================================================================================+=============================================================================================================================================+================================================================================================================================================================================================================+ | ``gpr_potential_from_force_with_uncertainty`` | Wrap a force callback with energy- and force-noise channels as a potential handle. | positions and forces in the units of the callback; the noise channels are standard deviations, the energy noise in eV | The library keeps ``fn`` and ``user_data``, so both must outlive the handle. The caller destroys the handle with ``gpr_potential_destroy``. | Returns ``NULL`` with ``GPR_ERR_INVALID_ARG`` for a ``NULL`` callback. | +-----------------------------------------------+-------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_potential_from_force`` | Wrap a plain ``gpr_force_fn`` (the dimer callback) as a potential handle (ABI 1.1). | as above; the noise slot may be ``NULL`` | As above. | As above. | +-----------------------------------------------+-------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_potential_destroy`` | Free a potential handle. | none | Takes ownership back; ``user_data`` stays with the caller. Accepts ``NULL``. | Returns nothing; clears ``gpr_last_status`` and ``gpr_last_error`` on ``NULL`` or a live handle (preserving ``GPR_ERR_ORACLE`` during cleanup), and sets ``GPR_ERR_INVALID_ARG`` on a handle that is not live. | +-----------------------------------------------+-------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_potential_force`` | Evaluate energy and forces once. | ``R``, ``F``: 3 times ``n_atoms``; ``atomic_nrs``: ``n_atoms``; ``box``: 9 values, required | Caller supplies the output arrays; ``energy_noise_rms`` may be ``NULL``. | ``GPR_ERR_NULL_HANDLE`` for a ``NULL`` potential or one that is not live; ``GPR_ERR_INVALID_ARG`` for a bad pointer or size, including a ``NULL`` ``box``; ``GPR_ERR_ORACLE`` when the callback fails. | +-----------------------------------------------+-------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_potential_force_with_uncertainty`` | Evaluate energy, forces and both noise channels. | as ``gpr_potential_force``; the noise channels are standard deviations | Both noise outputs may be ``NULL``. ``box`` is required. | As ``gpr_potential_force``. | +-----------------------------------------------+-------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Dimer search ------------ .. table:: +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +================================+========================================================================================================================================+==========================================================================================================================================================================================+=====================================================================================================================================+======================================================================================================================================================================================================+ | ``gpr_dimer_search`` | GP-accelerated dimer saddle search with a force callback. | ``R_init``, ``orient_init``, ``R_saddle``, ``orient_out``: 3 times ``n_atoms_total``; observations: :math:`n_{init} \times N`; the saddle energy is relative to the first measured point | Caller supplies every output array; optional outputs and observations may be ``NULL``. The library keeps no pointer after the call. | ``GPR_ERR_INVALID_ARG`` for a ``NULL`` required argument; ``GPR_ERR_ORACLE`` after more than eight consecutive failed evaluations or a failure it cannot step around. | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_dimer_search_potential`` | ``gpr_dimer_search`` over a potential handle. | as ``gpr_dimer_search`` | The potential stays with the caller. | As ``gpr_dimer_search``. | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_dimer_search_report`` | ``gpr_dimer_search_potential`` with a report: converged flag, stop reason, curvature, final force, call counts, certificate (ABI 1.1). | the report's lengths are in the coordinate unit; ``max_oracle_calls`` is an input budget, 0 for none | Caller sets ``report->struct_size`` and supplies the struct; the library fills only fields that fit. | ``GPR_ERR_INVALID_ARG`` for a ``NULL`` report or an unset ``struct_size``. A search that stops short of the force criterion returns ``GPR_SUCCESS`` with ``converged`` 0 and the reason in ``stop``. | +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ NEB searches and results ------------------------ The search functions return a result handle. The caller destroys it with ``gpr_neb_result_destroy``. A search fails with ``NULL`` and ``GPR_ERR_INVALID_ARG`` for a ``NULL`` required argument. A non-null atoms or potential handle that is not live fails with ``GPR_ERR_NULL_HANDLE`` (``reject_dead_atoms``, ``reject_dead_potential``). ``gpr_neb_search`` and ``gpr_neb_search_potential`` run ``GPR_NEB_GP_OIE`` and ``GPR_NEB_GP_AIE`` when ``n_coords`` is a multiple of 3, and both reject ``GPR_NEB_GP_LOCAL``. .. table:: +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +=======================================+===============================================================================================================================================================================================================================================================================+=======================================================================================================================================================================+=====================================================================================================+========================================================================================================================================================================================================================================================================================================+ | ``gpr_neb_search`` | NEB. ``GPR_NEB_STANDARD``, ``AIE`` and ``OIE`` run without a surrogate. ``GPR_NEB_GP_OIE`` and ``GPR_NEB_GP_AIE`` (the default) run when ``n_coords`` is a multiple of 3: the entry builds all-moving atoms with ``gpr_atoms_create_simple`` and calls ``gpr_neb_search_gp``. | endpoints: :math:`N` each; ``n_images`` excludes the two endpoints | The caller owns the result. The oracle and ``user_data`` are used during the call only. | ``NULL`` with ``GPR_ERR_INVALID_ARG`` for a null argument, a non-positive size, a GP mode whose ``n_coords`` is not a multiple of 3 (``kGpModeWithoutGp``), or ``GPR_NEB_GP_LOCAL`` (``kLocalModeEntry``); ``GPR_ERR_ORACLE`` through ``gpr_last_status`` when the oracle failed beyond the bound. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_search_potential`` | ``gpr_neb_search`` over a potential handle. A GP mode runs whenever the length check passes: all-moving atoms are built from ``atomic_nrs``, one atom type per element in order of first appearance. | ``atomic_nrs``: :math:`N/3`, required; ``box``: 9 values, required; ``n_coords`` a positive multiple of 3; the oracle is energy and gradient equal to minus the force | As ``gpr_neb_search``. | ``NULL`` with ``GPR_ERR_INVALID_ARG`` for a ``NULL`` argument (including ``box``), a length that is not a positive multiple of 3, or ``GPR_NEB_GP_LOCAL`` once that length check has passed (``kLocalModeEntry``). A potential that is not live is ``GPR_ERR_NULL_HANDLE``. A GP mode is not an error. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_search_gp`` | GP-accelerated NEB (``GPR_NEB_GP_OIE`` or ``GP_AIE``) (ABI 1.2). | coordinates cover every atom of the handle, ``n_coords`` is 3 times ``n_atoms_total``; frozen atoms keep their initial position | The caller owns the result. ``model`` may be ``NULL`` for the ``gprn`` settings. | ``NULL`` with ``GPR_ERR_INVALID_ARG`` for a non-GP mode, a missing atoms handle or an optimiser other than SCG. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_search_gp_potential`` | ``gpr_neb_search_gp`` over a potential handle (ABI 1.2). | ``box`` is 9 values or ``NULL``; a periodic box sets the minimum-image lattice | As ``gpr_neb_search_gp``. | As ``gpr_neb_search_gp``, ``GPR_ERR_INVALID_ARG`` for a ``NULL`` potential, and ``GPR_ERR_NULL_HANDLE`` for an atoms or potential handle that is not live. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_ocineb_search`` | GP-NEB with minimum-mode dimer bursts on the climbing image (ABI 1.2). | as ``gpr_neb_search_gp`` | As ``gpr_neb_search_gp``. ``oci`` may be ``NULL`` for the defaults. | As ``gpr_neb_search_gp``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_search_local`` | Local band of mode ``GPR_NEB_GP_LOCAL`` (ABI 1.6). | lengths in Angstrom; ``box``: 9 values or ``NULL`` | The caller owns the result. ``atoms``, ``config`` and ``local`` may be ``NULL``. | ``NULL`` with ``GPR_ERR_INVALID_ARG`` for non-finite endpoints, an atoms handle with no moving atom or a bad size. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_search_local_potential`` | ``gpr_neb_search_local`` over a potential handle (ABI 1.6). | ``atomic_nrs``: :math:`N/3` when ``atoms`` is ``NULL`` | As ``gpr_neb_search_local``. | As ``gpr_neb_search_local``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_search_periodic`` | Periodic local band, the C binding of ``GPLocalBand`` (ABI 1.7). | ``box``: the cell rows a, b, c, 9 values; lengths in Angstrom, ``fmax`` in eV/Angstrom | As ``gpr_neb_search_local``. It does not certify; call ``gpr_neb_request_index_certificate`` first. | As ``gpr_neb_search_local``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_search_periodic_potential`` | ``gpr_neb_search_periodic`` over a potential handle (ABI 1.7). | as ``gpr_neb_search_periodic`` | As ``gpr_neb_search_local``. | As ``gpr_neb_search_local``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_converged`` | 1 when the band converged. | none | The handle stays with the caller. | Returns the flag; 0 for ``NULL``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_convergence_status`` | Whether the band met the force tolerance (``GPR_NEB_FORCE_TOLERANCE``) or stopped at the resolution of its model (``GPR_NEB_MODEL_NOISE_FLOOR``) (ABI 1.1). | a ``gpr_neb_status_t`` | As above. | Returns the code; ``GPR_NEB_NOT_CONVERGED`` for ``NULL``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_oracle_calls`` | Total oracle evaluations. | calls | As above. | Returns the count; 0 for ``NULL``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_outer_iterations`` | Outer iterations performed. | iterations | As above. | Returns the count; 0 for ``NULL``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_barrier`` | Reported saddle image energy minus reactant energy. | the oracle's energy unit | As above. | Returns the value; 0.0 for ``NULL``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_max_energy_image`` | Index of the highest-energy image. | zero-based index | As above. | Returns the index; 0 for ``NULL``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_n_images`` | Number of images including the endpoints. | images | As above. | Returns the count; 0 for ``NULL``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_image_positions`` | Positions of one image. | ``out`` holds ``n_coords`` doubles; at most the image length is copied; a band over moving atoms returns the full layout | Caller supplies ``out``. | ``GPR_ERR_NULL_HANDLE`` for a ``NULL`` result, a result that is not live, or a live result with no path; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer or an index out of range. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_image_energy`` | Energy of one image. | one ``double`` | Caller supplies the ``double``. | As ``gpr_neb_result_image_positions``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_all_energies`` | Energy of every image. | ``out`` holds ``n_total`` doubles; at most ``n_images`` are written | Caller supplies ``out``. | ``GPR_ERR_NULL_HANDLE`` for a ``NULL`` result, a result that is not live, or a live result with no path; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_report`` | Fill a ``gpr_neb_report_t`` from any NEB result: convergence, call counts, refits, barriers, dimer accounting, certificate (ABI 1.2). | the report's counts are calls and iterations | Caller sets ``report->struct_size`` and supplies the struct. | ``GPR_ERR_NULL_HANDLE`` for a ``NULL`` result or a result that is not live; ``GPR_ERR_INVALID_ARG`` for a ``NULL`` report or an unset ``struct_size``. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_destroy`` | Free a NEB result. | none | Takes ownership back. Accepts ``NULL``. | Returns nothing; clears ``gpr_last_status`` and ``gpr_last_error`` on ``NULL`` or a live handle (preserving ``GPR_ERR_ORACLE`` during cleanup), and sets ``GPR_ERR_INVALID_ARG`` on a handle that is not live. | +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Minimizer --------- .. table:: +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +==========================================+======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================+===========================================================================================================================================+===========================================================================================+===============================================================================================================================================================================================================================================+ | ``gpr_minimize_request_max_inner_steps`` | Set the inner surrogate L-BFGS step cap (default 200) for the next ``gpr_minimize`` call on this thread (ABI 1.18). The call takes the request when it starts, even if validation then rejects it, so a nested ``gpr_minimize`` made from an oracle callback does not inherit it; a request made in a callback applies to the next call after it. | none | none; the request is thread-local | ``GPR_ERR_INVALID_ARG`` for a value below 1. | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_minimize`` | GP-accelerated geometry minimisation. The GP gradient only proposes a stop; ``converged`` is set when an actual oracle evaluation at that exact position has gradient norm under ``conv_tol``. On success ``R_final``, ``E_final`` and ``G_final`` are always an exact oracle evaluation at ``R_final`` (never a surrogate prediction or an averaged near-coincident row): the converged point, or the lowest-energy oracle evaluation when the search did not converge. ``config.max_iter`` bounds outer surrogate-relaxation cycles (up to 200 inner surrogate steps each by default, or the cap set by ``gpr_minimize_request_max_inner_steps``). | ``R_init``, ``R_final``, ``G_final``: :math:`N`; ``E_final`` one value; ``G_final``, ``converged`` and ``n_oracle_calls`` may be ``NULL`` | Caller supplies every output. The oracle and ``user_data`` are used during the call only. | ``GPR_ERR_INVALID_ARG`` for a ``NULL`` required argument, including a ``NULL`` atoms handle, or a non-positive ``n_coords``; ``GPR_ERR_NULL_HANDLE`` for an atoms handle that is not live; ``GPR_ERR_ORACLE`` at the first failed evaluation. | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Harmonic prefactors ------------------- The Vineyard prefactor :math:`\nu = \prod \nu_{\min} / \prod' \nu_{\mathrm{saddle}}` of ABI 1.20 is assembled from one half per stationary point, :math:`\ln\nu =` ``ln_sum`` (minimum) :math:`-` ``ln_sum`` (saddle). Frequencies are :math:`\omega / 2\pi` of the mass-weighted Hessian with the rigid modes projected out, scaled by ``omega_scale`` (1 keeps native units, ``GPR_HTST_OMEGA_EV_ANGSTROM_AMU`` gives Hz for eV, Angstrom and amu). Masses are one positive value per atom or ``NULL`` for unit masses. A half that cannot be formed or has the wrong index says so in ``status``; nothing falls back silently. .. table:: +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +========================================+======================================================================================================================================================================================================================================================================================================================================+=========================================================================================================================+==========================================================================================+=====================================================================================================================================================================================================================================================================================================================================================================+ | ``gpr_htst_options_defaults`` | The default ``gpr_htst_options_t`` with ``struct_size`` set: enabled, ``GPR_HTST_REFINED``, both projections, tolerance and step 1e-3 (ABI 1.20). | none | Returns the struct by value. | Cannot fail. | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_htst_half_from_hessian`` | The half of a caller-supplied Hessian; ``source`` is ``GPR_HTST_SOURCE_MEASURED`` (ABI 1.20). | ``H``: :math:`N^2` row-major; ``x``, ``frequencies_out``: :math:`N`; ``masses``: ``n_masses`` = :math:`N/3` or ``NULL`` | Caller supplies the half and the optional frequencies. | ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer, a bad option, a bad kind, bad masses or a non-finite Hessian. | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_htst_half_from_hessian_checked`` | ``gpr_htst_half_from_hessian`` with buffer lengths (ABI 1.20). | ``H_len`` at least :math:`N^2`; ``x_len``, ``frequencies_len`` at least :math:`N`; ``masses_len`` at least ``n_masses`` | As ``gpr_htst_half_from_hessian``. | As ``gpr_htst_half_from_hessian``, plus the short-buffer rejection. | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_htst_half`` | The half at ``x`` by the options' mode: ``REFINED`` starts from the model's posterior-mean Hessian and measures soft or uncertain directions with the oracle until ``ln_sum`` moves less than the tolerance; ``MEASURED`` central-differences the oracle (:math:`2N` calls); ``SURROGATE`` uses the model alone (ABI 1.20). | as ``gpr_htst_half_from_hessian``; ``measured_out``: :math:`N` flags | Caller supplies the outputs. The oracle and ``user_data`` are used during the call only. | ``GPR_ERR_INVALID_ARG`` as above or for a missing oracle; ``GPR_ERR_NULL_HANDLE``, ``GPR_ERR_NOT_TRAINED`` for the model a mode needs; ``GPR_ERR_ORACLE``. | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_htst_half_checked`` | ``gpr_htst_half`` with buffer lengths (ABI 1.20). | ``x_len``, ``frequencies_len``, ``measured_len`` at least :math:`N` | As ``gpr_htst_half``. | As ``gpr_htst_half``, plus the short-buffer rejection. | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_htst_ln_prefactor`` | :math:`\ln\nu` and its estimated standard deviation from a minimum half and a saddle half (ABI 1.20). The minimum must have exactly one more real mode than the saddle. | ``ln_nu``, ``ln_nu_std`` one value each, ln of the frequency unit; ``ln_nu_std`` may be ``NULL`` | Caller supplies the outputs. | ``GPR_ERR_INVALID_ARG`` unless both halves have the right kind and status ``OK`` or ``NOT_CONVERGED``, the same ``n_coords``, finite ``ln_sum`` and finite non-negative ``ln_sum_std``, ``n_modes`` of the minimum is one more than ``n_modes`` of the saddle, and the result is finite. ``GPR_ERR_UNIT_MISMATCH`` when the halves carry different ``omega_scale``. | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_request_prefactor`` | Opt in this thread's later searches (``gpr_neb_search*``, ``gpr_minimize``) to compute their halves; without this call prefactors are off. ``NULL`` explicitly requests the enabled ``GPR_HTST_SURROGATE`` default. Prefactors add about 2x geometric-mean wall time and up to 12x on some systems, with no additional oracle calls. | ``masses``: ``n_masses`` values or ``NULL`` with 0 | Copies everything. | ``GPR_ERR_INVALID_ARG`` for a bad option or bad masses. | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_search_prefactor`` | The half of this thread's last search at a ``gpr_htst_point_t`` (ABI 1.20). | ``frequencies_out``, ``measured_out``: :math:`N` of the search, or ``NULL`` | Caller supplies the outputs. | ``GPR_ERR_INVALID_ARG`` for a bad point or an ``n_coords`` mismatch; ``GPR_ERR_UNSUPPORTED`` when the search did not opt in or has no half at this point. A stored half with status ``GPR_HTST_UNAVAILABLE`` is a successful read. | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_search_prefactor_checked`` | ``gpr_search_prefactor`` with buffer lengths (ABI 1.20). | ``frequencies_len``, ``measured_len`` at least :math:`N` | As ``gpr_search_prefactor``. | As ``gpr_search_prefactor``, plus the short-buffer rejection. | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_prefactor`` | The half a NEB result holds at a ``gpr_htst_point_t`` (ABI 1.20), including local and periodic bands that opted in. The saddle half reuses the index certificate's measured stencil when the search ran one, at no extra call. | as ``gpr_search_prefactor`` | The result keeps its halves until ``gpr_neb_result_destroy``. | ``GPR_ERR_NULL_HANDLE`` for a result that is not live; otherwise as ``gpr_search_prefactor``. | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_neb_result_prefactor_checked`` | ``gpr_neb_result_prefactor`` with buffer lengths (ABI 1.20). | ``frequencies_len``, ``measured_len`` at least :math:`N` | As ``gpr_neb_result_prefactor``. | As ``gpr_neb_result_prefactor``, plus the short-buffer rejection. | +----------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Analytical test potentials -------------------------- .. table:: +--------------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +================================+==============================================+======================================================================================================================================+=======================================+======================================================================================================+ | ``gpr_potential_lj`` | Lennard-Jones energy and gradient. | ``x``, ``G_out``: 3 times ``n_atoms``; ``epsilon`` is the well depth and ``sigma`` the zero-crossing distance, in the caller's units | Caller supplies the output arrays. | ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer or ``n_atoms`` below 1. | +--------------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+------------------------------------------------------------------------------------------------------+ | ``gpr_potential_muller_brown`` | Muller-Brown energy and gradient. | ``xy`` and ``G_out`` hold 2 values; dimensionless | Caller supplies the output arrays. | ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer. | +--------------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+------------------------------------------------------------------------------------------------------+ | ``gpr_potential_leps`` | LEPS collinear energy and gradient. | ``r`` holds :math:`r_{AB}` and :math:`r_{BC}`; ``G_out`` holds the two derivatives | Caller supplies the output arrays. | ``GPR_ERR_INVALID_ARG`` for a ``NULL`` pointer. | +--------------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+------------------------------------------------------------------------------------------------------+ | ``gpr_oracle_lj`` | ``gpr_oracle_fn`` adapter for Lennard-Jones. | ``user_data`` points to a ``gpr_lj_params_t`` | The caller owns the parameter struct. | Returns nothing; a bad argument writes a non-finite energy, which a search counts as a failed trial. | +--------------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+------------------------------------------------------------------------------------------------------+ | ``gpr_oracle_muller_brown`` | ``gpr_oracle_fn`` adapter for Muller-Brown. | ``user_data`` is ignored; pass ``NULL`` | none | As ``gpr_oracle_lj``. | +--------------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+------------------------------------------------------------------------------------------------------+ | ``gpr_oracle_leps`` | ``gpr_oracle_fn`` adapter for LEPS. | ``user_data`` is ignored; pass ``NULL`` | none | As ``gpr_oracle_lj``. | +--------------------------------+----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+------------------------------------------------------------------------------------------------------+ Runtime configuration, build introspection and timers ----------------------------------------------------- The setters change process-wide state. Call them before a search starts. .. table:: +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | Function | Purpose | Units and extents | Ownership | Failure | +=====================================+===========================================================================================================================================================================================================================================================================================================================================================================================+=====================+====================================================+======================================================================================================================================================+ | ``gpr_set_linalg_mode`` | Select "reproducible" (fixed-order tile kernels) or "library" (ScaLAPACK or SLATE routines) for the distributed factorisation (ABI 1.1). The HS-SVD kernel eigensolve runs Eigen's self-adjoint solver on the host in both modes. Library mode uses cuSOLVER at one rank when a GPU is present, and ScaLAPACK pdsyev from order 1 across ranks when unconstrained reductions are enabled. | none | The library copies the name. | ``GPR_ERR_INVALID_ARG`` for ``NULL`` or another name; the previous mode stays. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_linalg_mode`` | Current mode, "reproducible" or "library". | none | Static string; the caller does not free it. | Never fails; never ``NULL``. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_set_linalg_threads`` | Dense linear-algebra thread count. | threads, at least 1 | none | ``GPR_ERR_INVALID_ARG`` for a count below 1. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_set_library_serial`` | Nonzero selects Eigen's factor and triangular solves for the next train; zero selects the OpenMP panel kernels (ABI 1.4). | flag | none | Returns ``GPR_SUCCESS``. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_set_training_product`` | Select the product the training matrices use: "" or ``NULL`` for the native backend, a "scheme2:" specification, or the path of a product library (ABI 1.1). | none | The library copies the string. | ``GPR_ERR_INVALID_ARG`` for a malformed specification; ``GPR_ERR_UNSUPPORTED`` when a library or provider cannot load. The previous selection stays. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_training_product_configured`` | 1 when a Scheme II engine or a product library is selected. | flag | none | Returns the flag. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_check_model_package`` | Check that an AOTInductor ``.pt2`` package runs on this CPU before anything loads it. | path to a file | The library reads the file during the call. | ``GPR_ERR_INVALID_ARG`` for an empty or unreadable path; ``GPR_ERR_UNSUPPORTED``, naming the missing extensions, when the CPU lacks one. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_backend_name`` | Name of the compiled linear-algebra backend: "slate", "scalapack", "kokkos", "cusolver", "cholmod", "stdpar" or "eigen". | none | Static string; the caller does not free it. | Never fails. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_backend_requires_mpi`` | 1 when the backend needs MPI initialised before any call. | flag | none | Returns the flag. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_mpi_initialized`` | 1 when ``MPI_Init`` has run on this process. | flag | none | Returns the flag; 0 without MPI. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_mpi_world_rank`` | Rank in ``MPI_COMM_WORLD``. | rank | none | Returns the rank; 0 without MPI. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_mpi_world_size`` | Size of ``MPI_COMM_WORLD``. | ranks | none | Returns the size; 1 without MPI. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_omp_max_threads`` | OpenMP thread budget of the process. | threads | none | Returns the count; 1 without OpenMP. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_train_phase_reset`` | Zero the train-phase wall times. | none | none | Returns nothing. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_train_phase_read`` | Read the factor, solve, eigensolve, kernel and Hessian wall times since the last reset (ABI 1.3). | seconds | Caller supplies each pointer; any may be ``NULL``. | Returns nothing. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``gpr_train_phase_read_leaves`` | Read the finer phase times: setup, descriptor, posterior, subset, objective, condition, cache, curvature, energy, schedule (ABI 1.4). | seconds | Caller supplies each pointer; any may be ``NULL``. | Returns nothing. | +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+