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¶
GP-accelerated NEB chain driver (ASE images + calculator + GP). |
|
Periodic band with fixed atoms, relaxed with the local band mode. |
Functions¶
|
Run the local band, the Python binding of |
|
Run the periodic local band, the Python binding of |
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.ObservableDriverGP-accelerated NEB chain driver (ASE images + calculator + GP).
Prefer
GPNEBSessionwhen composing steps (interpolate / prepare / compute / apply) or overlaying pyeonclient Matter endpoints viaGPNEBSession.from_matters.- 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_endpointsstill raisesValueErrorwhen 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".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 forwarded to the session and then ontoGPNEBConfig. The Baker-24 board runs pass"gprd_zbl"andacquisition="max_variance";gpridge.baker_board.production_baker_high_level_kwargs()returns those settings as a dictionary.Like an ASE optimizer, the driver takes
logfileandtrajectoryand offersattach(). 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.
-1before the run.
- barrier_eV¶
Forward barrier in eV, the energy of the highest image minus the energy of the reactant.
nanbefore the run.
- reverse_barrier_eV¶
Reverse barrier in eV, the energy of the highest image minus the energy of the product.
nanbefore 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.
- 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.
- interpolate(method: str | None = None) None¶
C++ path-init step (nanobind free functions).
method=Noneuses"idpp", or"linear"whenuse_idppisFalse. An explicit method is the seed even when it disagrees withuse_idpp. The constructor still rejects that pair when bothpath_methodanduse_idppwere 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,applyandfit_gpare described inGPNEBSession.compute, and the remaining parameters inGPNEBSession.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().fmaxis the force tolerance of the band in eV/Angstrom andstepsthe outer-iteration budget. The other parameters are described inGPNEBSession.prepare.runalways usesrun_ocineb. Returns whether the band converged; the results are onconverged,barrier_eVand the oracle-count attributes.
- 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
Atomswith the same atoms in the same order and the same cell. An atom is held fixed when aFixAtomsconstraint holds it in both endpoints.product – ASE
Atomswith the same atoms in the same order and the same cell. An atom is held fixed when aFixAtomsconstraint holds it in both endpoints.calculator – ASE calculator of the true potential (the oracle).
n_images – Number of images between the endpoints.
Noneselectsgpridge._core.periodic_band_defaults().spring_constant – Spring constant in eV/A^2; the springs are uniform.
Noneselects the shared default.climb – Let the highest image climb to the saddle.
Noneselects the shared default.max_move – Largest displacement of an atom in one band step, in A.
Noneselects 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.
Noneselects the shared default.verbose – Write the C++ progress report to standard error.
Noneselects 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.
Nonefollows the endpoints’pbc.from_con()reads.conendpoints with readcon, which keeps the file’s cell, periodicity and fixed atoms; ASE’s eOn reader leavespbcFalse for the same file.options – Further
GPNEBConfigfields by name, for examplegp_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, afterrun(). Empty before.
- energies: numpy.ndarray | None = None¶
Energy of every image in eV, endpoints included.
Nonebeforerun().
- 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=Trueis 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_callsand not inresult.oracle_calls_to_convergence.
- barrier: float | None = None¶
Forward barrier in eV, the energy of the highest image minus the energy of the reactant.
Nonebeforerun().
- max_energy_image: int | None = None¶
Index of the highest-energy image, counting the reactant as 0.
Nonebeforerun().
- result: Any = None¶
The raw
GPNEBResultof the last run.
- classmethod from_con(reactant: Any, product: Any, calculator: Any, **kwargs: Any) GPLocalBand¶
Band between two
.confiles read with readcon.The first frame of each file is the endpoint; the fixed-atom flags become
FixAtomsconstraints and the cell is periodic along its nonzero vectors.
- config(fmax: float, steps: int, norm: str | None) Any¶
The
GPNEBConfigof a run; fields inoptionsare 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).stepsbounds the rounds, each of which measures one image.normselects the norm of the band force thatfmaxbounds ("l2"over the moving atoms,"linf", or"max_force_on_atom");Nonekeeps the library’s choice.fmaxandstepsdefault to the shared periodic-band record. Returns whether the band converged.