Run a GP-NEB band¶
This page shows how to run a nudged elastic band (NEB) between two minima
with gprn, how to choose its mode, acquisition rule, trust controls and
model profile, and how to run the same search from Python. A complete first
run, with endpoints and checks, is the
first gprn band tutorial.
The method behind the modes is in How GPRidge finds a saddle. Option defaults
below are those printed by gprn --help; the full list is the
gprn reference.
The C++ interface, the local-band design notes, the Baker-24 board and the dimer index checks have their own pages:
For the C API see C API.
Choose a mode¶
--nebmode takes one of six values. The default is gp_oie. An unknown value
exits with an error.
|
Description |
|---|---|
|
All images are evaluated every iteration, with no GP |
|
All images are evaluated on the true potential (the legacy AIE scheme) |
|
One image is evaluated per outer iteration |
|
The band is relaxed on a GP, then the oracle evaluates every interior image |
|
The band is relaxed on a GP, then the oracle evaluates the one image the acquisition rule selects |
|
The band is relaxed on a pair-additive baseline plus a Cartesian GP residual over the atoms that carry the path motion, and one image is measured per round |
The descriptions are the comments on NEBMode in gpr/neb/GPNEB.h and on
gpr_neb_mode_t in gpr/capi/gpridge_c.h. The
design notes describe the gp_local
driver.
In one run on the Lennard-Jones pentamer of the tutorial (seven images,
--potential lj), standard converged and oie stopped at its iteration
limit with Certified: no. The GP modes are the ones meant for an expensive oracle.
Run a band with gprn¶
The endpoints are two .con files with the atoms in the same order.
--nimages counts the images between them and defaults to 8, so the band
has ten. --climbing-image (default true) and --converged-force
(default 0.05 eV/Angstrom) are the other settings most runs touch.
gprn --reactant reactant.con --product product.con \
--potential lj --nimages 7 --nebmode gp_oie \
--output gp/neb.h5 --write-con gp/band.con
--potential names the oracle (default lj); gprn --list-potentials lists
the backends this binary has. --output names the HDF5 file (default
gpr_neb_out.h5; the GP trace, or the whole band with --full-h5 true),
and --write-con writes the final band as a multi-frame .con file with the
energy and forces of each image and the run summary on the first frame. The
log reports Oracle calls:, GP trace written to: and Certified: yes or
Certified: no. By default every oracle evaluation is also stored in an observation archive in a directory
beside the output; without a readcon-db build, gprn exits with status 2
unless you pass --gp-observation-archive off.
A molecule stored in a vacuum box can be treated as an isolated system
with --gp-nonperiodic true (default false), which uses an isolated
molecular GP and band independently of the .con vacuum box and excludes
rigid rotations in dimer searches. --molecular-rigid-motion true removes whole-molecule
translation and rotation from the band tangents, spring lengths, forces and
trial steps. It applies only to an isolated band in which every atom is free,
and its default is false.
Choose an acquisition rule¶
The OIE modes select the next image to measure. --acquisition takes one of
the values below; the default is tpe, and an unknown value exits with
unknown --acquisition value.
Value |
Selects |
|---|---|
|
The image with the highest posterior force variance |
|
By force magnitude plus kappa times the perpendicular standard deviation; |
|
A sample from the GP posterior, then the maximum force magnitude |
|
The chain integrated mean squared prediction error (Sacks 1989) |
|
Expected improvement for the highest-energy image |
|
The cascade selector of the GP-OIE outer loop |
|
The interior-image index chosen by |
|
The chain PS-BAX rule (Cheng et al., NeurIPS 2024; InfoBAX, Neiswanger et al., ICML 2021) |
The one-line descriptions are the comments on AcquisitionType in
gpr/neb/AcquisitionStrategy.h. The Python GPNEB also accepts max_force
(the image with the highest NEB force), which --acquisition rejects. The
Baker-24 board runs use max_variance; see the board page.
Set the trust controls¶
gp_oie and gp_aie relax the interior images on the GP mean surface
between oracle calls. The trust set is built from the geometries the oracle
has evaluated, and a relaxation step is accepted only while every interior
image stays inside it. The default is the fixed radius --trust-radius on the
emd metric.
Option |
Default |
Meaning |
|---|---|---|
|
|
|
|
0.5 |
The fixed radius, used unless adaptive trust is on |
|
|
Replace the fixed radius with the adaptive schedule |
|
0.15 |
Adaptive schedule: starting radius |
|
0.35 |
Adaptive schedule: growth added as data accumulates |
|
50 |
Adaptive schedule: number of training rows at which half the growth is reached |
|
1.3 |
Adaptive schedule: constant of the cap A / sqrt(n_atoms) |
|
0.25 |
Adaptive schedule: lower bound of that cap |
With --use-adaptive-trust true the radius is
where \(t_{\min}\), \(\Delta\), \(h\), \(A\) and \(f\) are the five options
above and \(n\) is the number of training rows (gpOieTrustThreshold in
gpr/neb/GPNEB.cpp). The help text of --trust-half-life says “outer
iterations”, but the code passes the number of training rows. With
--trust-metric max1dlog the threshold is \(|\ln r|\), where \(r\) is
--trust-ratio-at-limit (default 0.4).
The adaptive schedule is off by default. The header comment says it can
throttle the inner relaxation before the surrogate reaches a useful band
optimum, and that the calibrated fixed radius is the certificate
(GPNEBConfig::use_adaptive_trust).
gprn --reactant reactant.con --product product.con \
--nimages 7 --potential lj --nebmode gp_oie \
--trust-metric emd --use-adaptive-trust true \
--trust-t-min 0.15 --trust-delta-explore 0.35 --trust-half-life 50
The atomic dimer has its own switch for the same idea:
es_use_adaptive_threshold in gpr_dimer_config_t (gpr/capi/gpridge_c.h,
default 0) selects the fixed EMD threshold es_threshold (default 1.2) or the
adaptive one, whose half-life es_half_life counts observations.
Choose a GP model profile¶
--gp-model-profile selects a bundle of prior, fitting and target settings.
chemgp and gprd_zbl (also written zbl) are two names for the same
classic model. Any other value selects extended, the default.
Value |
Model |
|---|---|
|
Solver, objective, normalization and prior stay under their own options; per-image local GPs run beside the global GP ( |
|
Joint energy-force inverse-distance GP, raw targets, NLML objective and SCG solver by default, Sexpat priors |
|
The same classic settings, named for the dimer reference |
The classic profiles use the Sexpat prior: PriorSqrtt on the signal
variance and PriorGaussian on the length scales
(structures/Structures.h). The profile name does not select a benchmark
dataset or a search algorithm, and it does not turn on the ZBL prior mean;
--gp-zbl-prior-mean is a separate option (default false).
Under the classic profiles the per-image local tier is off unless you pass
--gp-local-tier true (default false): each interior image then predicts
from its own model of its k nearest rows, and the global model becomes a
random-feature regulariser once every interior image is local.
An option named on the command line wins over the profile. When
--hyperparameter-mode is absent, the classic profiles use SCG and every
other profile uses rgmin L-BFGS
(main_neb.cpp). --hyperparameter-objective (default nlml when unset)
and --hyperparameter-mode choose the objective and the solver explicitly.
--gp-lognormal-magn-prior (default false) replaces the magnitude prior
with a log-normal prior on the signal variance. --gp-opt-tol (default
1e-3) is the SCG function and solution tolerance, whatever the profile.
Run a local band¶
--nebmode gp_local relaxes the band on a pair-additive baseline fitted to
every measured force, with a Cartesian GP residual over the atoms that carry
the path motion. Its options start with --gp-local-. The ones that set the
baseline are --gp-local-pair-cutoff (default 9.5 Angstrom; 0 disables the
baseline), --gp-local-pair-split (default 7 Angstrom) and
--gp-local-grow-radius (default 3 Angstrom). The potential comes from
--potential, or from a TOML file given with --config; the
Pt(111) tutorial shows that file for a Morse
oracle and runs the band from Python. The
design notes explain each setting.
Run from Python¶
The Python drivers take ASE atoms and an ASE calculator as the oracle.
GaussianProcess is the surrogate; one object can serve the band and a
dimer refinement afterwards. The Python GPNEB takes acquisition”ucb”=
by default, not the CLI default tpe, so pass the rule you want.
from ase.io import read
from gpridge.gp import GaussianProcess
from gpridge.neb import GPNEB
from gpridge.dimer import GPDimer
reactant = read("reactant.con", format="readcon-con")
product = read("product.con", format="readcon-con")
gp = GaussianProcess(uncertainty="laplace", rff_features=512,
hyperparameters="inla")
neb = GPNEB.from_endpoints(reactant, product, 7,
oracle=expensive_calculator, gp=gp,
acquisition="max_variance")
converged = neb.run(fmax=0.05, steps=500)
print(converged, neb.barrier_eV, neb.oracle_calls)
saddle = neb.images[neb.max_energy_image]
dimer = GPDimer(saddle, oracle=expensive_calculator, gp=gp)
dimer.run(fmax=0.01)
expensive_calculator is any ASE calculator that returns energy in eV and
forces in eV/Angstrom. GPNEB.from_endpoints builds the band with seven
intermediate images and a linear interpolation; pass path_method to change the
interpolation. To start from your own band, call GPNEB(images, oracle…, gp=…)=
with at least three images and fill the intermediate ones with
interpolate; with use_idpp=True, interpolate() builds an IDPP path, and
with the default use_idpp=False it builds a linear one.
interpolate("idpp") builds an IDPP path either way.
run returns whether the band converged. The result is on converged,
barrier_eV, oracle_calls, oracle_calls_to_convergence and
max_energy_image. The values in the GaussianProcess call are ones the
constructor accepts, not a recommendation; the signatures are in
python/gpridge/neb/_driver.py, python/gpridge/dimer/_driver.py and
python/gpridge/gp/_model.py.
After a fit the GP is also an ASE calculator, and
predict_with_uncertainty returns a Prediction with energy, forces,
energy_variance and force_variance:
test_atoms = saddle.copy()
test_atoms.calc = gp
energy = test_atoms.get_potential_energy()
forces = test_atoms.get_forces()
prediction = gp.predict_with_uncertainty(test_atoms)
The band driver for gp_local is gpridge.neb.GPLocalBand, built with
GPLocalBand.from_con; the Pt(111) tutorial
runs it.
Check the defaults against your build¶
The defaults quoted on this page come from gprn --help. The block below
reads them from the gprn on your path and reports any option whose default
differs.
fail=0
help=$(gprn --help) || { echo "gprn --help failed"; exit 1; }
while IFS='|' read -r flag text; do
lines=$(printf '%s\n' "$help" | grep -E -- "^ +$flag " || true)
printf '%s\n' "$lines" | grep -- "$text" >/dev/null || { echo "mismatch: $flag"; fail=1; }
done <<'EOF'
--nebmode|Default gp_oie.
--acquisition|Default tpe.
--nimages|Default 8
--climbing-image|Default true.
--converged-force|Default 0.05.
--trust-metric|Default emd
--trust-radius|Default 0.5.
--use-adaptive-trust|Default false.
--trust-t-min|Default 0.15.
--trust-delta-explore|Default 0.35.
--trust-half-life|Default 50.
--trust-adaptive-A|Default 1.3.
--trust-adaptive-floor|Default 0.25.
--trust-ratio-at-limit|Default 0.4.
--gp-model-profile|Default extended.
--gp-zbl-prior-mean|Default false.
--gp-lognormal-magn-prior|Default false.
--gp-opt-tol|Default 1e-3.
--gp-nonperiodic|Default false.
--molecular-rigid-motion|Default false.
--gp-local-tier|Default false.
--output|Default gpr_neb_out.h5.
--potential|Default lj.
EOF
test "$fail" = 0 && echo ok