gpridge.dimer¶
GPDimer driver: atoms + oracle + a GP.
Symmetric to GPNEB: the GP is supplied (not constructed) so it can be shared / warm-started across the NEB->Dimer pipeline.
Classes¶
GP-accelerated dimer search for a first-order saddle point. |
Package Contents¶
- class gpridge.dimer.GPDimer(atoms, *, oracle, gp, orient: numpy.ndarray | None = None, seed: int = 42, verbose: bool = True, model_profile: Any = None, logfile: Any = None, trajectory: Any = None, convergence_force_norm: Any = None, init_data=None, vibrational_stencil: str = 'full')¶
Bases:
gpridge._observers.ObservableDriverGP-accelerated dimer search for a first-order saddle point.
The search runs in C++ (
AtomicDimer) on the Gaussian-process surrogate held bygp. Theoraclecalculator is called only to measure the true energy and forces, andoracle_callscounts those calls. The constructor copiesatoms; the result is inatomsafterrun().- Parameters:
atoms (
ase.Atoms) – Start geometry. A cold start can be any structure near the saddle point. A warm start from a GP-NEB run passes the climbing image. Onlyase.constraints.FixAtomsis supported: any other constraint raisesValueError, and so does a start in which every atom is fixed. Fixed atoms keep their input coordinates exactly.oracle (
ase.calculators.calculator.Calculator) – Provider of the true energy (eV) and forces (eV/Angstrom).gp (
gpridge.gp.GaussianProcess) – Shared surrogate. If it is already fit (for example after a GPNEB run), the dimer skips the cold-start fit and starts from its observations and hyperparameters.orient (
numpy.ndarray, optional) – Initial dimer orientation, shape(n_atoms, 3). Rows of fixed atoms are ignored. The default is a random direction over the moving atoms, drawn fromseedand scaled to norm 0.01.seed (
int, default42) – Seed of the random generator that draws the default orientation.verbose (
bool, defaultTrue) – Selects the C++ report level, 1 forTrueand 0 forFalse. The report goes to standard error, and level 0 writes none of it. The one-shot diagnostics that the library prints withfprintf(the[hssvd]conditioning line) are not part of that report.vibrational_stencil (
{"full", "vibrational"}, default"full") – Coordinates the force-stop stencil displaces."full"measures every Cartesian coordinate."vibrational"measures only the vibrational directions and can call a borderline mode resolved where"full"calls it unresolved. A lone atom is measured in every coordinate either way.convergence_force_norm (
{"l2", "linf", "max_force_on_atom"}, optional) – Norm of the midpoint force thatfmaxis compared with. The defaultNonekeeps the L2 norm of the whole force vector."linf"is the largest absolute component and"max_force_on_atom"the largest per-atom force magnitude. AConvergenceNormmember is accepted too.model_profile (
strorGPModelProfileorNone) – Forwarded to the dimer’s GP withset_model_profile. The defaultNonekeeps the library profile."gprd_zbl"is the profile the Baker-24 board runs use.logfile (
str,os.PathLike,file-likeorNone) – One line per oracle call, as an ASE optimizer logs its steps. A string or path-like object is a file name and"-"is standard output. An object withwriteis used as is.trajectory (
str,os.PathLike,file-likeorNone) – A file name opens a readcon trajectory that receives every oracle-evaluated geometry with its energy and forces, which needs thereadconpackage. An object with awritemethod may be passed instead.
Notes
Energies inside the search are measured from the energy at the first oracle call, which is the start geometry.
energy_eVis therefore relative to that level, not an absolute energy.attach()registers observers that run everyintervaloracle calls. The dimer loop runs in C++, so an oracle evaluation is the step unit; seegpridge._observers.- atoms¶
Working copy of the start geometry. After
run()it holds the final midpoint geometry, without a calculator.
- oracle¶
The calculator that measures the true energy and forces.
- gp¶
The shared
GaussianProcess.run()adds the oracle observations to it and refits it.
- seed = 42¶
- verbose = True¶
- model_profile = None¶
- convergence_force_norm = None¶
- init_data = None¶
- vibrational_stencil = ''¶
- orient¶
Initial orientation, shape
(n_atoms, 3).
- converged = False¶
True when the true force at the final midpoint met
fmaxand the index stencil measured there found exactly one negative mode. A force stop the stencil does not certify reports False withtermination_reason"uncertified_force_stop".
- certified = False¶
True when the index stencil at the force stop certified one negative mode.
- n_certificate_calls = 0¶
True potential evaluations spent by the force-stop index stencil.
- energy_eV¶
Energy of the final midpoint in eV, relative to the energy at the first oracle call.
nanuntilrun()has finished.
- termination_reason = 'not_run'¶
Why the last search stopped, as a short name such as
"force_converged","iteration_budget"or"oracle_budget"."not_run"beforerun().
- property warm_started: bool¶
True when the GP is fitted at the time of the call.
A GP that a
GPNEBrun has fitted gives True beforerun(). Read it before the search:run()fits the GP, so the value is True afterwards for every GP.
- run(fmax: float = 0.05, steps: int = 200, max_oracle_calls: int | None = None, max_wall_seconds: float | None = None) bool¶
Run the dimer search until it converges or a limit is reached.
The driver invokes the C++
AtomicDimerthrough the nanobind binding, seeds it with the observations of the shared GP, and applies the GP’s layered-chain configuration to the dimer’s internal model. After the search it writes the final midpoint intoatoms, fills the result attributes and refitsgp.- Parameters:
fmax (
float, default0.05) – Force criterion in eV/Angstrom: the search stops as converged when the norm of the force on the dimer midpoint, the L2 norm unlessconvergence_force_normselects another, is below it.steps (
int, default200) – Limit on the outer relaxation phases, the alternations between the surrogate and the oracle.max_oracle_calls (
int, optional) – Limit on evaluations of the true potential, the index stencil included. The search stops before a call that would exceed it, sooracle_callsnever ends above it.
- Returns:
converged –
Truewhen the true force criterion was met and the index stencil at that midpoint measured one negative mode. Otherwise the search hit a limit or another stopping rule, andtermination_reasonnames the cause; a zero-force point that is not a saddle reports"uncertified_force_stop".- Return type: