gpridge.session

Step-level GP-NEB compute session (overlay entry for ASE / pyeonclient).

Mirrors the pyeonclient composition pattern:

prepare (config + oracle + atoms_config)
compute  (run_ocineb / gp_neb)
apply    (write path back to images / Matter)

without re-implementing path init in pure Python (that lives in nanobind).

Example (ASE):

from gpridge.session import GPNEBSession
from gpridge import GaussianProcess, production_baker_high_level_kwargs

sess = GPNEBSession(images, oracle=calc, gp=gp, **production_baker_high_level_kwargs())
sess.interpolate("idpp")
ok = sess.compute(fmax=0.05, steps=500)
# images updated in place; sess.result holds GPNEBResult / OCINEB accounting

Example (pyeonclient Matter endpoints):

from gpridge.session import GPNEBSession
sess = GPNEBSession.from_matters(initial, final, n_intermediate=8,
                                 oracle=calc, gp=gp, path_method="idpp")
sess.compute(fmax=0.05)

Classes

PreparedGPNEB

Immutable bundle of step inputs for one compute call.

GPNEBSessionResult

Post-compute summary (high-level fields + raw C++ results).

GPNEBSession

Step-level GP-NEB session: interpolate → prepare → compute → apply.

Functions

map_acquisition(name)

Map string acquisition name to AcquisitionType enum.

Module Contents

gpridge.session.map_acquisition(name: str)

Map string acquisition name to AcquisitionType enum.

class gpridge.session.PreparedGPNEB

Immutable bundle of step inputs for one compute call.

oracle: Any
R_initial: numpy.ndarray
R_final: numpy.ndarray
n_intermediate: int
gpneb_config: Any
ocineb_config: Any
gp_params: dict
atoms_config: Any
use_ocineb: bool = True
class gpridge.session.GPNEBSessionResult

Post-compute summary (high-level fields + raw C++ results).

converged: bool
barrier_eV: float
oracle_calls: int
outer_iterations: int
max_energy_image: int
max_force_history: List[float] = []
oracle_calls_endpoints: int = 0
oracle_calls_initial: int = 0
oracle_calls_outer: int = 0
oracle_calls_validation: int = 0
oracle_calls_to_convergence: int = 0
dimer_oracle_calls: int = 0
mmf_bursts: int = 0
certified: bool = False
index: int = 0
n_certificate_calls: int = 0
reverse_barrier_eV: float
stop_reason: str = 'unspecified'
elapsed_s: float
neb_result: Any = None
oci_result: Any = None
class gpridge.session.GPNEBSession(images: Sequence[Any], *, oracle, gp, climb: bool = True, spring_constant: float = 5.0, seed: int = 42, use_idpp: bool = False, verbose: bool = True, acquisition: str = 'tpe', model_profile: Any = None, geometric_spring: bool = False, use_sidpp: bool = True, sidpp_alpha: float = 0.33, use_mmf: bool = False, rg_minmode_dimer: bool = False, rgsaddle_library: str = '', dimer_max_rot_iter: int = 0, dimer_eval_image1: bool = True, dimer_variance_tau_rel: float = 0.0, dimer_variance_tau_abs: float = 0.0, dimer_imspe_soft_threshold: float = 0.0, theta_shift_skip_tol: float = 0.0, theta_shift_skip_auto: bool = False, vibrational_stencil: str = 'full', logfile: Any = None, trajectory: Any = None, init_data=None)

Bases: gpridge._observers.ObservableDriver

Step-level GP-NEB session: interpolate → prepare → compute → apply.

Holds ASE images + oracle calculator + shared GaussianProcess.

Parameters:
  • images (sequence of ase.Atoms) – Reactant, intermediate images and product, at least three images with the same atoms in the same order. The search starts from the geometries in images, so fill the intermediate images first with interpolate() or build the list with from_endpoints(). The relaxed band is written back into these objects.

  • oracle (ase.calculators.calculator.Calculator) – Provider of the true energy (eV) and forces (eV/Angstrom).

  • gp (gpridge.gp.GaussianProcess) – Shared surrogate. It holds the observations after the run, so it can be passed on to a GPDimer.

  • climb (bool, default True) – Let the highest image climb to the saddle point (GPNEBConfig.climbing_image).

  • spring_constant (float, default 5.0) – NEB spring constant in eV/Angstrom^2.

  • seed (int, default 42) – Random seed of the search.

  • use_idpp (bool, default False) – Lets the session seed the band with an IDPP-family path. It applies where the session builds the interior images: interpolate() and from_endpoints or from_matters without an explicit method or path_method use "idpp" when it is True and "linear" when it is False. interpolate() with an explicit method uses that method even when it disagrees with this flag. from_endpoints and from_matters still raise ValueError when an explicit path_method and this flag were both passed and they disagree: an IDPP-family name ("idpp", "idpp_collective", "sidpp" or "sidpp_geodesic") with use_idpp=False, or any other name with use_idpp=True. The constructor takes images as given and searches that band, so prepare sets GPNEBConfig.use_idpp to False whatever this argument says.

  • verbose (bool, default True) – Write the C++ progress report to standard error.

  • acquisition (str, default "tpe") – Rule that picks the next image to measure: "ucb", "max_variance", "max_force", "thompson_sampling", "expected_improvement", "imspe", "tpe" or "psbax". Short forms such as "maxvar", "ts" and "ei" and the names of the AcquisitionType members ("PriorityCascade" among them) are accepted, and an unknown name raises ValueError.

  • model_profile (str or GPModelProfile or None) – GP model profile copied onto GPNEBConfig. None keeps the library profile. Strings are "gprd_zbl", "chemgp" and "extended".

  • vibrational_stencil ({"full", "vibrational"}, default "full") – Coordinates the true-oracle Hessian stencil displaces. "full" measures every Cartesian coordinate and the resolution includes the rigid columns. "vibrational" displaces only the vibrational directions and can call a borderline mode resolved where "full" calls it unresolved.

  • geometric_spring (bool, default False) – Use the geometric (cubic-potential) spring, which keeps dense bands from developing a stiff-spring instability (GPNEBConfig.use_geometric_spring).

  • use_sidpp (bool, default True) – Forwarded to GPNEBConfig.use_sidpp, the sequential-IDPP flag of the C++ path initialisation.

  • sidpp_alpha (float, default 0.33) – Blend parameter of the sequential-IDPP path. It is used by interpolate() and from_endpoints() for the "sidpp" path methods and forwarded to GPNEBConfig.sidpp_alpha.

  • use_mmf (bool, default False) – Run a minimum-mode-following dimer burst on the climbing image (OCINEBConfig.use_mmf, the master switch of the dimer_* options below).

  • rg_minmode_dimer (bool, default False) – Use the RgMinMode dimer for the climbing-image burst instead of AtomicDimer (OCINEBConfig.rg_minmode_dimer).

  • rgsaddle_library (str, default "") – Selection for the index test after convergence (GPNEBConfig.rgsaddle_library). Non-empty text turns the test on. The linked librgsaddle runs it. The empty string leaves the test off.

  • dimer_max_rot_iter (int, default 0) – Passed to OCINEBConfig.dimer_max_rot_iter, the number of surrogate rotations per dimer translation in a climbing-image burst. The C++ default is 10.

  • dimer_eval_image1 (bool, default True) – Evaluate the forward dimer image with the oracle at each dimer phase (OCINEBConfig.dimer_eval_image1).

  • dimer_variance_tau_rel (float, default 0.0) – Relative variance gate for dimer oracle calls. When positive, a dimer phase whose candidate has a posterior variance below this fraction of the GP signal variance uses the GP mean instead of an oracle call. Zero disables it.

  • dimer_variance_tau_abs (float, default 0.0) – Absolute variance gate in eV^2. It takes precedence over dimer_variance_tau_rel when positive.

  • dimer_imspe_soft_threshold (float, default 0.0) – Soft gate on the IMSPE score of a dimer candidate; a score below it suppresses the oracle call. Zero disables it.

  • theta_shift_skip_tol (float, default 0.0) – Skip the hyperparameter optimisation when the scale-free MAP stationarity measure at the current parameters is below this tolerance. Zero disables the gate.

  • theta_shift_skip_auto (bool, default False) – Use the GP optimiser’s displacement tolerance as the stationarity threshold.

  • logfile (str, os.PathLike, file-like or None) – One line per oracle call. A string or path-like object is a file name and "-" is standard output.

  • trajectory (str, os.PathLike, file-like or None) – A file name opens a readcon trajectory with every oracle-evaluated geometry, its energy and its forces, which needs the readcon package. An object with write may be passed instead.

Notes

model_profile is copied onto GPNEBConfig in prepare(). The Baker-24 board configurations use "gprd_zbl".

logfile, trajectory and attach() follow ASE optimizers, with one step per oracle (true potential) call; see gpridge._observers.

images
oracle
gp
init_data = None
climb = True
spring_constant
seed = 42
use_idpp = False
verbose = True
acquisition = ''
model_profile = None
geometric_spring = False
use_sidpp = True
sidpp_alpha
use_mmf = False
rg_minmode_dimer = False
rgsaddle_library = ''
dimer_max_rot_iter = 0
dimer_eval_image1 = True
dimer_variance_tau_rel
dimer_variance_tau_abs
dimer_imspe_soft_threshold
theta_shift_skip_tol
theta_shift_skip_auto = False
vibrational_stencil = ''
prepared: PreparedGPNEB | None = None
result: GPNEBSessionResult | None = None
classmethod from_endpoints(reactant: Any, product: Any, n_intermediate: int, *, oracle, gp, path_method: str | None = None, **kwargs) → GPNEBSession

ASE endpoints + C++ path init → session.

path_method=None seeds with "idpp" when use_idpp=True is among kwargs, and with "linear" otherwise. An explicit path_method is the seed by itself.

classmethod from_matters(initial: Any, final: Any, n_intermediate: int, *, oracle=None, gp, path_method: str | None = None, calculator=None, **kwargs) → GPNEBSession

pyeonclient Matter (or duck-type) endpoints → ASE session.

path_method=None follows use_idpp as in from_endpoints().

oracle or calculator must evaluate the PES. Prefer an ASE Calculator as oracle; Matter-bound pots are converted when possible.

property n_images: int

Number of images, endpoints included.

property n_intermediate: int

Number of images between the two endpoints.

interpolate(method: str | None = None) → None

C++ path-init step into self.images (same as GPNEB.interpolate).

method=None uses "idpp", or "linear" when use_idpp is False. An explicit method is the seed even when it disagrees with use_idpp. from_endpoints still rejects that pair when both were passed to the constructor.

path_matrix() → numpy.ndarray

Positions of all images, shape (n_images, 3 * n_atoms).

prepare(fmax: float = 0.05, steps: int = 200, *, max_inner_iter_gp: int = 0, inner_conv_tol: float = 0.001, lbfgs_max_move: float = 0.1, lbfgs_memory: int = 20, band_engine=None, lbfgs_inverse_curvature: float = 0.01, lbfgs_finite_difference: float = 1e-06, lbfgs_auto_scale: bool = True, lbfgs_angle_reset: bool = True, lbfgs_distance_reset: bool = True, oie_hook_reparam: bool = True, reparam_period: int = 0, reparam_tol: float = -1.0, use_ocineb: bool = True) → PreparedGPNEB

Step: build GPNEBConfig, OCINEBConfig, oracle, atoms_config.

Parameters:
  • fmax (float, default 0.05) – Force tolerance of the band in eV/Angstrom (GPNEBConfig.conv_tol).

  • steps (int, default 200) – Outer-iteration budget (GPNEBConfig.max_outer_iter).

  • max_inner_iter_gp (int, default 0) – Cap on the inner relaxation on the surrogate. Zero or less stops on the inner tolerance only; a positive value adds an explicit iteration cap.

  • inner_conv_tol (float, default 1e-3) – Force tolerance of the inner surrogate relaxation in eV/Angstrom. The C++ default is 0.05.

  • lbfgs_max_move (float, default 0.1) – Largest Cartesian displacement of one atom in one band L-BFGS step, in Angstrom. Values above 0.2 trigger a one-time warning from the C++ side.

  • lbfgs_memory (int, default 20) – Number of stored L-BFGS correction pairs.

  • band_engine (BandEngineKind or None) – Inner band stepper. None keeps the library default (RgLbfgs). InternalLbfgs is the parity harness.

  • lbfgs_inverse_curvature (float, default 0.01) – Initial inverse-Hessian scale of the band L-BFGS.

  • lbfgs_finite_difference (float, default 1e-6) – Step of the curvature probe used by lbfgs_auto_scale.

  • lbfgs_auto_scale (bool, default True) – Scale the initial inverse Hessian from a curvature probe.

  • lbfgs_angle_reset (bool, default True) – Discard the L-BFGS history and take a scaled force step when the quasi-Newton step points more than 90 degrees away from the force.

  • lbfgs_distance_reset (bool, default True) – Discard the L-BFGS history and take a scaled force step when the quasi-Newton step would move an atom by lbfgs_max_move or more.

  • oie_hook_reparam (bool, default True) – Redistribute the band after retained local path motions when the redistributed band already has oracle support.

  • reparam_period (int, default 0) – Legacy periodic reparametrisation control. The search reparametrises only after a retained hook motion changes the band.

  • reparam_tol (float, default -1.0) – Legacy spacing trigger, kept for callers that set it.

  • use_ocineb (bool, default True) – Run the search through run_ocineb, which adds the optional climbing-image dimer burst. False calls gp_neb directly.

Returns:

The oracle, endpoints and configurations that compute() hands to the C++ search. The object is also stored as self.prepared.

Return type:

PreparedGPNEB

compute(fmax: float = 0.05, steps: int = 200, *, prepared: PreparedGPNEB | None = None, apply: bool = True, fit_gp: bool = True, **prepare_kw) → bool

Step: run_ocineb (or gp_neb) then optionally apply to images.

Parameters:
  • fmax – As in prepare().

  • steps – As in prepare().

  • prepared (PreparedGPNEB, optional) – Result of an earlier prepare(). When omitted, compute calls prepare() with fmax, steps and prepare_kw.

  • apply (bool, default True) – Write the relaxed band into images.

  • fit_gp (bool, default True) – Refit the shared GP on its observations after the search.

  • **prepare_kw – Further keyword arguments of prepare().

Returns:

Whether the C++ result reports convergence. The summary is stored as self.result.

Return type:

bool

apply(neb_result: Any = None) → None

Step: write GPNEBResult into self.images.

run(fmax: float = 0.05, steps: int = 200, **kw) → bool

Run prepare(), compute() and apply() in one call.

fmax and steps are the force tolerance in eV/Angstrom and the outer-iteration budget. **kw takes the keyword arguments of prepare(). Returns whether the band converged.

to_gpneb()

Materialize a high-level GPNEB sharing state.