Compute a harmonic rate prefactor

Harmonic transition-state theory gives the rate prefactor in the Vineyard form

\[\nu = \frac{\prod_{i=1}^{3N-6} \nu_i^{\min}}{\prod_{i=1}^{3N-7} \nu_i^{\ddagger}}, \qquad \nu_i = \frac{\omega_i}{2\pi},\]

where \(\omega_i^2\) are the eigenvalues of the mass-weighted Hessian with the rigid translations and rotations projected out, and the saddle product runs over its real modes. gpridge computes \(\ln\nu\) in two halves, one per stationary point: ln_sum is \(\sum_i \ln\nu_i\) over the real modes, and \(\ln\nu =\) ln_sum (minimum) \(-\) ln_sum (saddle).

Status: implemented (C ABI 1.20) in C, C++, Fortran, Python, R, Julia and Rust.

Choose how a half gets its Hessian

Mode

Hessian

Oracle calls

GPR_HTST_SURROGATE

the GP posterior-mean Hessian

none

GPR_HTST_REFINED

the GP Hessian, corrected direction by direction by the oracle

2 per measured direction

GPR_HTST_MEASURED

the full central-difference Hessian of the oracle

\(2N\) for \(N\) coordinates

The refined mode starts from the posterior mean. It measures the oracle Hessian action along the mode whose estimated \(\ln\nu\) spread is largest, and stops when one more direction moves ln_sum by less than tolerance and no unmeasured mode’s spread exceeds it. The spread comes from the GP curvature variance. It is a probabilistic estimate, not a bound. The measured mode is the reference that the refined mode is tested against.

A half reports which Hessian it used (source), whether it converged, its own oracle calls, which directions were measured and its status. A saddle half without exactly one negative mode, or a minimum with one, has status GPR_HTST_WRONG_INDEX. gpr_htst_ln_prefactor refuses such a half with GPR_ERR_INVALID_ARG instead of returning a number. A half that could not be formed is GPR_HTST_UNAVAILABLE. Nothing falls back silently.

Build a prefactor from two halves

gpr_htst_half_from_hessian takes a Hessian the caller already has, for instance from an instanton code, and gpr_htst_half measures or refines one at a point. In Python the same calls are htst_half_from_hessian, htst_half and htst_ln_prefactor:

import math

import numpy as np
from gpridge import HtstKind, HtstOptions, htst_half_from_hessian, htst_ln_prefactor

options = HtstOptions()
options.project_translation = False
options.project_rotation = False
x = np.zeros(3)
minimum = htst_half_from_hessian(np.diag([1.0, 3.0, 5.0]), x, HtstKind.MINIMUM, options)
saddle = htst_half_from_hessian(np.diag([-2.0, 3.0, 5.0]), x, HtstKind.SADDLE, options)
ln_nu, ln_nu_std = htst_ln_prefactor(minimum, saddle)
assert abs(ln_nu - math.log(1.0 / (2.0 * math.pi))) < 1e-12
print(f"ln nu = {ln_nu:.6f}, saddle |nu| = {saddle.imaginary_frequency:.6f}")

After a Python search that called request_prefactor, search_prefactor(HtstPoint.REACTANT) returns the half. gp_neb and run_ocineb store halves only after that call, and they need an atoms_config to fit the surrogate. Without one, or without the request, search_prefactor raises UnsupportedError.

Supply an exact Hessian or HVP callback when conditioning at a fixed point

When an exact Hessian or Hessian-vector-product (HVP) operator is already known at a stationary point, pass it to gpr_model_condition_fixed_hessian (in C) or via hessian / hvp on condition_fixed (in Python, C++, Fortran, R, Julia and Rust). The library validates the shape, finiteness and symmetry of the supplied Hessian or HVP operator before mutating the model: an invalid shape, non-finite entry or asymmetric operator fails immediately with GPR_ERR_INVALID_ARG (InvalidArgumentError in Python) and leaves the model and outputs untouched, with no silent fallback to GP curvature. An HVP callback that raises in Python, R or Julia is an oracle failure instead (OracleError in Python, GPR_ERR_ORACLE in R and Julia) with the same untouched model; Python chains the raised exception as its cause. When valid, a subsequent gpr_htst_half / htst_half at that fixed point uses the exact Hessian in the Vineyard prefactor instead of GP curvature, at zero additional oracle calls (GPR_HTST_SOURCE_CONDITIONED):

import numpy as np
import gpridge
from gpridge import HtstKind, HtstSource, htst_half, htst_half_from_hessian, potential_lj

r_min = 2.0 ** (1.0 / 6.0)
pts = np.array([[0.0, 0.0, 0.0, r_min + 0.03 * (i - 3), 0.01 * i, 0.0] for i in range(7)])
rows = [potential_lj(p, 2) for p in pts]
obs = gpridge.Observation()
obs.R = pts
obs.E = np.array([[e] for e, _ in rows])
obs.G = np.array([g for _, g in rows])

cfg = gpridge.AtomsConfiguration()
cfg.positions = np.zeros((1, 6))
cfg.is_frozen = np.zeros((1, 2), dtype=np.uint8)
cfg.id = np.arange(2, dtype=np.uint32).reshape(1, 2)
cfg.atomic_nrs = np.ones((1, 2), dtype=np.int32)
gpridge.initialize_atoms_config(cfg, np.zeros(2, dtype=np.uint32), cfg.positions.copy(), -1.0, 1)

params = gpridge.default_gpr_parameters()
params["max_iter"] = 25
params["report_level"] = 0
gp = gpridge.GaussianProcessRegression()
gp.initialize(params, cfg)
gp.set_hyperparameters(obs, cfg)
gp.optimize(obs)

x0 = np.array([0.0, 0.0, 0.0, r_min, 0.0, 0.0])
e0, g0 = potential_lj(x0, 2)
added = gpridge.Observation()
added.R = x0[None, :]
added.E = np.array([[e0]])
added.G = g0[None, :]

k = 72.0 / (r_min * r_min)
h_exact = np.zeros((6, 6))
h_exact[0, 0] = h_exact[3, 3] = k
h_exact[0, 3] = h_exact[3, 0] = -k

gp.condition_fixed(obs, added, x0[None, :], hessian=h_exact)
half = htst_half(x0, HtstKind.MINIMUM, model=gp)
ref = htst_half_from_hessian(h_exact, x0, HtstKind.MINIMUM)
assert half.source == HtstSource.CONDITIONED and half.oracle_calls == 0
assert abs(half.ln_sum - ref.ln_sum) < 1e-12

Use the posterior derivatives directly

The halves are built on batched derivatives of a trained model’s posterior, which are available on their own:

Need

C function

Exact posterior-mean Hessians at \(B\) points

gpr_model_mean_hessian_batch

Hessian-vector products

gpr_model_mean_hessian_action_batch

Covariance of \(v^\top H w\)

gpr_model_hessian_bilinear_covariance

Variance of \(\mathrm{tr}(A\,\delta H)\)

gpr_model_hessian_trace_variance

Energy and gradient variance

gpr_model_posterior_variance_batch

Add oracle rows without a refit

gpr_model_condition_fixed, gpr_model_condition_fixed_hessian

They work in the units of the training data, apply no mass weighting and project rigid motions only when project_rigid is set. Set max_energy_std to fail closed outside the training support with GPR_ERR_OUT_OF_SUPPORT. The report then carries the largest posterior standard deviation. Python names the same calls as methods of GaussianProcessRegression (mean_hessian_batch and so on) and raises OutOfSupportError with the report attached.

See also