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¶
Immutable bundle of step inputs for one compute call. |
|
Post-compute summary (high-level fields + raw C++ results). |
|
Step-level GP-NEB session: interpolate → prepare → compute → apply. |
Functions¶
|
Map string acquisition name to |
Module Contents¶
- gpridge.session.map_acquisition(name: str)¶
Map string acquisition name to
AcquisitionTypeenum.
- class gpridge.session.PreparedGPNEB¶
Immutable bundle of step inputs for one compute call.
- oracle: Any¶
- R_initial: numpy.ndarray¶
- R_final: numpy.ndarray¶
- gpneb_config: Any¶
- ocineb_config: Any¶
- atoms_config: Any¶
- class gpridge.session.GPNEBSessionResult¶
Post-compute summary (high-level fields + raw C++ results).
- 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.ObservableDriverStep-level GP-NEB session: interpolate → prepare → compute → apply.
Holds ASE images + oracle calculator + shared GaussianProcess.
- Parameters:
images (
sequenceofase.Atoms) – Reactant, intermediate images and product, at least three images with the same atoms in the same order. The search starts from the geometries inimages, so fill the intermediate images first withinterpolate()or build the list withfrom_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 aGPDimer.climb (
bool, defaultTrue) – Let the highest image climb to the saddle point (GPNEBConfig.climbing_image).spring_constant (
float, default5.0) – NEB spring constant in eV/Angstrom^2.seed (
int, default42) – Random seed of the search.use_idpp (
bool, defaultFalse) – Lets the session seed the band with an IDPP-family path. It applies where the session builds the interior images:interpolate()andfrom_endpointsorfrom_matterswithout an explicitmethodorpath_methoduse"idpp"when it isTrueand"linear"when it isFalse.interpolate()with an explicit method uses that method even when it disagrees with this flag.from_endpointsandfrom_mattersstill raiseValueErrorwhen an explicitpath_methodand this flag were both passed and they disagree: an IDPP-family name ("idpp","idpp_collective","sidpp"or"sidpp_geodesic") withuse_idpp=False, or any other name withuse_idpp=True. The constructor takesimagesas given and searches that band, sopreparesetsGPNEBConfig.use_idpptoFalsewhatever this argument says.verbose (
bool, defaultTrue) – 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 theAcquisitionTypemembers ("PriorityCascade"among them) are accepted, and an unknown name raisesValueError.model_profile (
strorGPModelProfileorNone) – GP model profile copied ontoGPNEBConfig.Nonekeeps 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, defaultFalse) – Use the geometric (cubic-potential) spring, which keeps dense bands from developing a stiff-spring instability (GPNEBConfig.use_geometric_spring).use_sidpp (
bool, defaultTrue) – Forwarded toGPNEBConfig.use_sidpp, the sequential-IDPP flag of the C++ path initialisation.sidpp_alpha (
float, default0.33) – Blend parameter of the sequential-IDPP path. It is used byinterpolate()andfrom_endpoints()for the"sidpp"path methods and forwarded toGPNEBConfig.sidpp_alpha.use_mmf (
bool, defaultFalse) – Run a minimum-mode-following dimer burst on the climbing image (OCINEBConfig.use_mmf, the master switch of thedimer_*options below).rg_minmode_dimer (
bool, defaultFalse) – Use the RgMinMode dimer for the climbing-image burst instead ofAtomicDimer(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, default0) – Passed toOCINEBConfig.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, defaultTrue) – Evaluate the forward dimer image with the oracle at each dimer phase (OCINEBConfig.dimer_eval_image1).dimer_variance_tau_rel (
float, default0.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, default0.0) – Absolute variance gate in eV^2. It takes precedence overdimer_variance_tau_relwhen positive.dimer_imspe_soft_threshold (
float, default0.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, default0.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, defaultFalse) – Use the GP optimiser’s displacement tolerance as the stationarity threshold.logfile (
str,os.PathLike,file-likeorNone) – One line per oracle call. A string or path-like object is a file name and"-"is standard output.trajectory (
str,os.PathLike,file-likeorNone) – A file name opens a readcon trajectory with every oracle-evaluated geometry, its energy and its forces, which needs thereadconpackage. An object withwritemay be passed instead.
Notes
model_profileis copied ontoGPNEBConfiginprepare(). The Baker-24 board configurations use"gprd_zbl".logfile,trajectoryandattach()follow ASE optimizers, with one step per oracle (true potential) call; seegpridge._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=Noneseeds with"idpp"whenuse_idpp=Trueis among kwargs, and with"linear"otherwise. An explicitpath_methodis 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=Nonefollowsuse_idppas infrom_endpoints().oracle or calculator must evaluate the PES. Prefer an ASE Calculator as oracle; Matter-bound pots are converted when possible.
- interpolate(method: str | None = None) None¶
C++ path-init step into
self.images(same as GPNEB.interpolate).method=Noneuses"idpp", or"linear"whenuse_idppisFalse. An explicit method is the seed even when it disagrees withuse_idpp.from_endpointsstill 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, default0.05) – Force tolerance of the band in eV/Angstrom (GPNEBConfig.conv_tol).steps (
int, default200) – Outer-iteration budget (GPNEBConfig.max_outer_iter).max_inner_iter_gp (
int, default0) – 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, default1e-3) – Force tolerance of the inner surrogate relaxation in eV/Angstrom. The C++ default is 0.05.lbfgs_max_move (
float, default0.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, default20) – Number of stored L-BFGS correction pairs.band_engine (
BandEngineKindorNone) – Inner band stepper.Nonekeeps the library default (RgLbfgs).InternalLbfgsis the parity harness.lbfgs_inverse_curvature (
float, default0.01) – Initial inverse-Hessian scale of the band L-BFGS.lbfgs_finite_difference (
float, default1e-6) – Step of the curvature probe used bylbfgs_auto_scale.lbfgs_auto_scale (
bool, defaultTrue) – Scale the initial inverse Hessian from a curvature probe.lbfgs_angle_reset (
bool, defaultTrue) – 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, defaultTrue) – Discard the L-BFGS history and take a scaled force step when the quasi-Newton step would move an atom bylbfgs_max_moveor more.oie_hook_reparam (
bool, defaultTrue) – Redistribute the band after retained local path motions when the redistributed band already has oracle support.reparam_period (
int, default0) – 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, defaultTrue) – Run the search throughrun_ocineb, which adds the optional climbing-image dimer burst.Falsecallsgp_nebdirectly.
- Returns:
The oracle, endpoints and configurations that
compute()hands to the C++ search. The object is also stored asself.prepared.- Return type:
- 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 earlierprepare(). When omitted,computecallsprepare()withfmax,stepsandprepare_kw.apply (
bool, defaultTrue) – Write the relaxed band intoimages.fit_gp (
bool, defaultTrue) – 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: