gpridge.neb

GPNEB driver. Uses a GaussianProcess (does not own it).

Pattern matches ase.mep.NEB(images, ...): takes a list of Atoms, exposes .run(fmax, steps), and surfaces the relaxed chain on .images. The GP it consumes carries the layered-chain config; the driver itself just runs the outer loop and passes new observations back into the GP for warm-start handoff to a downstream Dimer refinement.

Classes

GPNEB

GP-accelerated NEB chain driver (ASE images + calculator + GP).

GPLocalBand

Periodic band with fixed atoms, relaxed with the local band mode.

Functions

search_local(oracle, initial, final[, n_images, fmax, ...])

Run the local band, the Python binding of gpr_neb_search_local.

search_periodic(oracle, initial, final[, n_images, ...])

Run the periodic local band, the Python binding of gpr_neb_search_periodic.

Package Contents

class gpridge.neb.GPNEB(images: Sequence, *, 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, logfile: Any = None, trajectory: Any = None, init_data=None)

Bases: gpridge._observers.ObservableDriver

GP-accelerated NEB chain driver (ASE images + calculator + GP).

Prefer GPNEBSession when composing steps (interpolate / prepare / compute / apply) or overlaying pyeonclient Matter endpoints via GPNEBSession.from_matters.

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 still raises 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".

  • 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 forwarded to the session and then onto GPNEBConfig. The Baker-24 board runs pass "gprd_zbl" and acquisition="max_variance"; gpridge.baker_board.production_baker_high_level_kwargs() returns those settings as a dictionary.

Like an ASE optimizer, the driver takes logfile and trajectory and offers attach(). A step is one oracle (true potential) evaluation, because the outer loop runs in C++. Every evaluated geometry, energy and force set reaches the log, the trajectory and the attached observers:

with GPNEB(images, oracle=calc, gp=gp, logfile="-",
           trajectory="oracle.con") as neb:
    neb.attach(lambda: print(neb.last_atoms.get_potential_energy()))
    neb.run(fmax=0.05)
images
oracle
gp
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
converged = False

True when the band met the force criterion fmax.

dimer_oracle_calls = 0

Oracle calls spent in climbing-image dimer bursts.

mmf_bursts = 0

Number of minimum-mode-following bursts that ran.

oracle_calls = 0

All oracle calls of the run. They cover the endpoints, the initial design, the outer iterations and the final validation pass.

oracle_calls_endpoints = 0

Oracle calls that measured the two endpoints.

oracle_calls_initial = 0

Oracle calls of the initial design.

oracle_calls_outer = 0

Oracle calls made by the outer loop. An iteration can measure more than one geometry.

oracle_calls_validation = 0

Oracle calls of the post-convergence validation. They re-evaluate the band and run the index certificate when it is on, and are not part of oracle_calls_to_convergence.

oracle_calls_to_convergence = 0

Oracle calls of the search itself. They cover the endpoints, the initial design and the outer iterations, without the validation pass.

outer_iterations = 0

Outer iterations that the run completed.

max_energy_image = -1

Index of the highest-energy image, counting the reactant as 0. -1 before the run.

barrier_eV

Forward barrier in eV, the energy of the highest image minus the energy of the reactant. nan before the run.

reverse_barrier_eV

Reverse barrier in eV, the energy of the highest image minus the energy of the product. nan before the run.

certified = False

True when the band index certificate holds.

index = 0

Negative-mode count of the band index certificate.

n_certificate_calls = 0

True oracle evaluations spent by the band index certificate.

stop_reason = 'not_run'

Terminal stop reason of the NEB search.

max_force_history: List[float] = []

Largest band force after each outer iteration, in eV/Angstrom.

elapsed_s

Wall-clock time of the C++ search in seconds.

classmethod from_matters(initial, final, n_intermediate: int, **kwargs)

Construct from pyeonclient Matter endpoints.

classmethod from_endpoints(reactant, product, n_intermediate: int, **kwargs)

Construct from ASE endpoints + C++ path init.

property observers

The session’s OracleObservers.

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 (nanobind free functions).

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

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)

Step: build config + oracle.

The parameters are those of GPNEBSession.prepare.

compute(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, prepared=None, apply: bool = True, fit_gp: bool = True) → bool

Step: run_ocineb and apply results (pyeonclient-style compute).

prepared, apply and fit_gp are described in GPNEBSession.compute, and the remaining parameters in GPNEBSession.prepare. Returns whether the band converged.

run(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) → bool

Run the GP-NEB outer loop; alias of compute().

fmax is the force tolerance of the band in eV/Angstrom and steps the outer-iteration budget. The other parameters are described in GPNEBSession.prepare. run always uses run_ocineb. Returns whether the band converged; the results are on converged, barrier_eV and the oracle-count attributes.

write_con(path) → None

Write the relaxed chain as CON frames without evaluating a calculator.

class gpridge.neb.GPLocalBand(reactant: Any, product: Any, calculator: Any, *, n_images: int | None = None, spring_constant: float | None = None, climb: bool | None = None, max_move: float | None = None, initial: str = 'linear', periodic: bool | None = None, seed: int | None = None, verbose: bool | None = None, **options: Any)

Periodic band with fixed atoms, relaxed with the local band mode.

Parameters:
  • reactant – ASE Atoms with the same atoms in the same order and the same cell. An atom is held fixed when a FixAtoms constraint holds it in both endpoints.

  • product – ASE Atoms with the same atoms in the same order and the same cell. An atom is held fixed when a FixAtoms constraint holds it in both endpoints.

  • calculator – ASE calculator of the true potential (the oracle).

  • n_images – Number of images between the endpoints. None selects gpridge._core.periodic_band_defaults().

  • spring_constant – Spring constant in eV/A^2; the springs are uniform. None selects the shared default.

  • climb – Let the highest image climb to the saddle. None selects the shared default.

  • max_move – Largest displacement of an atom in one band step, in A. None selects the shared default.

  • initial – "linear" interpolates between the endpoints; "idpp" and "sidpp" start from the image-dependent pair potential path.

  • seed – Random seed of the search. None selects the shared default.

  • verbose – Write the C++ progress report to standard error. None selects the shared default, which is off.

  • periodic – Apply the minimum image in the endpoints’ cell, in the band and in every geometry handed to the calculator. None follows the endpoints’ pbc. from_con() reads .con endpoints with readcon, which keeps the file’s cell, periodicity and fixed atoms; ASE’s eOn reader leaves pbc False for the same file.

  • options – Further GPNEBConfig fields by name, for example gp_local_pair_cutoff.

calculator
n_images = 0
spring_constant
climb = False
max_move
initial = 'linear'
periodic
seed = 0
verbose = False
options
images: List[Any] = []

The relaxed band as ASE Atoms, endpoints included, after run(). Empty before.

energies: numpy.ndarray | None = None

Energy of every image in eV, endpoints included. None before run().

converged = False

True when the band met the force criterion.

oracle_calls = 0

All oracle calls of the run. They cover the endpoints, the initial design, the outer iterations and the final validation, which includes the index certificate when it runs.

certified = False

True when the band index certificate holds. The certificate is off unless force_stop_certificate=True is passed as an option.

index = 0

Negative-mode count of the band index certificate; 0 when no certificate was stored.

n_certificate_calls = 0

True oracle evaluations that the index certificate spent. They are included in oracle_calls and not in result.oracle_calls_to_convergence.

barrier: float | None = None

Forward barrier in eV, the energy of the highest image minus the energy of the reactant. None before run().

max_energy_image: int | None = None

Index of the highest-energy image, counting the reactant as 0. None before run().

result: Any = None

The raw GPNEBResult of the last run.

classmethod from_con(reactant: Any, product: Any, calculator: Any, **kwargs: Any) → GPLocalBand

Band between two .con files read with readcon.

The first frame of each file is the endpoint; the fixed-atom flags become FixAtoms constraints and the cell is periodic along its nonzero vectors.

config(fmax: float, steps: int, norm: str | None) → Any

The GPNEBConfig of a run; fields in options are set last.

run(fmax: float | None = None, steps: int | None = None, norm: str | None = None) → bool

Relax the band until every image meets fmax (eV/A).

steps bounds the rounds, each of which measures one image. norm selects the norm of the band force that fmax bounds ("l2" over the moving atoms, "linf", or "max_force_on_atom"); None keeps the library’s choice. fmax and steps default to the shared periodic-band record. Returns whether the band converged.

gpridge.neb.search_local(oracle, initial, final, n_images: int = 8, *, fmax: float = 0.05, steps: int = 50, atoms_config=None, box=None, config=None, local_config=None, gp=None, init_data=None)

Run the local band, the Python binding of gpr_neb_search_local.

gpridge.neb.search_periodic(oracle, initial, final, n_images: int = 8, *, atoms_config=None, box=None, periodic_config=None, local_config=None, gp=None, init_data=None)

Run the periodic local band, the Python binding of gpr_neb_search_periodic.