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

GPDimer

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.ObservableDriver

GP-accelerated dimer search for a first-order saddle point.

The search runs in C++ (AtomicDimer) on the Gaussian-process surrogate held by gp. The oracle calculator is called only to measure the true energy and forces, and oracle_calls counts those calls. The constructor copies atoms; the result is in atoms after run().

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. Only ase.constraints.FixAtoms is supported: any other constraint raises ValueError, 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 from seed and scaled to norm 0.01.

  • seed (int, default 42) – Seed of the random generator that draws the default orientation.

  • verbose (bool, default True) – Selects the C++ report level, 1 for True and 0 for False. The report goes to standard error, and level 0 writes none of it. The one-shot diagnostics that the library prints with fprintf (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 that fmax is compared with. The default None keeps 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. A ConvergenceNorm member is accepted too.

  • model_profile (str or GPModelProfile or None) – Forwarded to the dimer’s GP with set_model_profile. The default None keeps the library profile. "gprd_zbl" is the profile the Baker-24 board runs use.

  • logfile (str, os.PathLike, file-like or None) – 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 with write is used as is.

  • trajectory (str, os.PathLike, file-like or None) – A file name opens a readcon trajectory that receives every oracle-evaluated geometry with its energy and forces, which needs the readcon package. An object with a write method 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_eV is therefore relative to that level, not an absolute energy.

attach() registers observers that run every interval oracle calls. The dimer loop runs in C++, so an oracle evaluation is the step unit; see gpridge._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 fmax and the index stencil measured there found exactly one negative mode. A force stop the stencil does not certify reports False with termination_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.

oracle_calls = 0

Evaluations of the true potential made by run(). The surrogate is not counted.

outer_iterations = 0

Outer relaxation phases that run() completed.

energy_eV

Energy of the final midpoint in eV, relative to the energy at the first oracle call. nan until run() has finished.

elapsed_s

Wall-clock time of the C++ search in seconds. nan until run() 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" before run().

property warm_started: bool

True when the GP is fitted at the time of the call.

A GP that a GPNEB run has fitted gives True before run(). 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++ AtomicDimer through 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 into atoms, fills the result attributes and refits gp.

Parameters:
  • fmax (float, default 0.05) – Force criterion in eV/Angstrom: the search stops as converged when the norm of the force on the dimer midpoint, the L2 norm unless convergence_force_norm selects another, is below it.

  • steps (int, default 200) – 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, so oracle_calls never ends above it.

Returns:

converged – True when 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, and termination_reason names the cause; a zero-force point that is not a saddle reports "uncertified_force_stop".

Return type:

bool