Choose GP settings¶
The Gaussian-process surrogate has many settings and the defaults are tuned for molecular searches, so most runs change few of them. This page says where each setting lives (command-line flag, TOML key, Python keyword), what it changes, and which settings the paper’s molecular runs changed. The model itself is described in the method explanation.
Where a setting lives¶
Command line.
gprnandgprdtake the flags in the table below. The full list is in the command-line reference.gprd --helpdoes not print defaults for most of these flags. The defaults on this page are thegprndefaults printed bygprn --help.TOML.
gprn --config run.tomlreads a subset of the settings, and explicit command-line flags override it. The option needs a build with-Duse_capnp=true, which is off by default. The keys are in the TOML key reference. Most GP settings have no TOML key.Python.
gpridge.GaussianProcesstakes the keywordsuncertainty,use_delta,psis,psis_deterministic,rff_featuresandhyperparameters, or achain(Python reference). Anything else goes throughgpr_params, a dict that starts fromgpridge.default_gpr_parameters().
Settings at a glance¶
Setting |
Flag (drivers) |
TOML key |
Python keyword |
Default ( |
|---|---|---|---|---|
Model profile |
|
none |
none |
|
Uncertainty arm |
|
|
|
|
PSIS correction |
|
|
|
false |
Deterministic PSIS |
|
|
|
true |
Delta-method variance |
|
|
|
false |
Reported variance |
|
none |
none |
|
Random Fourier Features |
|
|
|
0 (off) |
Hyperparameter optimizer |
|
|
|
|
Hyperparameter objective |
|
|
none |
|
Optimizer tolerance |
|
|
|
1e-3 ( |
Rows used by the fit |
|
none |
none |
10 |
Refit cadence |
|
none |
none |
5 |
Learned noise |
|
none |
none |
false |
Noise variance and jitter |
none |
|
|
1e-4 for each |
Diagonal nugget |
|
|
none |
true, 0 |
Robust rows |
|
none |
none |
0 (Gaussian likelihood) |
Length-scale prior |
|
|
none |
true |
ZBL prior mean |
|
|
none |
false |
Rigid-null deflation |
|
|
|
false |
Prior-mean statistic |
|
none |
none |
|
Adaptive pruning |
|
none |
none |
true |
Training-set ceiling |
|
none |
none |
0 (unbounded) |
Resolution deduplication |
|
none |
none |
true |
Endpoint-symmetry rows |
|
none |
none |
false |
Isolated molecule |
|
none |
none |
false |
The Python defaults for the optimizer tolerance and the noise terms come
from gpridge.default_gpr_parameters() and match the gprn
numbers. Print that dict to see them. In Python, uncertainty”laplace”=
selects the Laplace-slice arm with PSIS on, which is what
--uncertainty-mode laplace-slice --use-psis-laplace true does on the
command line.
When use_rigid_null_deflation is enabled on free systems with uniform
per-row gradient noise, each geometry’s 6 (5 linear, 4 for 1D-periodic MIC,
3 for 2D/3D-periodic MIC) zero-covariance rigid-motion modes are projected out
before factorization and accounted for in closed form in the NLML objective. Because removing those
null modes eliminates ~4e-11 rounding drift at step 0, rgmin marginal-likelihood
line searches can take a different number of iterations (for example shifting
a free 2-atom Lennard-Jones fit from 28 to 33 iterations, or 38 to 49 across
a max_iter=15 restart), and sub-floor noise training (e.g. sigma2=1e-28,
jitter_sigma2=0) becomes strictly positive definite and certifies where the
undeflated frame fails. Keeping the knob opt-in (false by default) preserves
the baseline optimization trajectories.
Rigid-null deflation cannot be combined with principled_nugget=true (the CLI
and TOML default): Marchildon-Zingg’s diagonal nugget eta * diag(K) is
orientation-dependent, so B^T diag(K) R ! 0= and the rigid and internal
subspaces no longer decouple. Enabling use_rigid_null_deflation while
principled_nugget is enabled is rejected with an error; pass
--principled-nugget false (or [gp] principled_nugget = false) explicitly.
The ScaLAPACK distributed backend does not implement rigid-null deflation and
likewise rejects use_rigid_null_deflation=true with an error rather than
falling back silently.
Settings of the paper’s molecular runs¶
The argument list of the paper’s band runs is in
bench/uma/canonical_argv. These are the GP flags in it that differ from
the defaults above:
Flag |
Value |
|---|---|
|
|
|
|
|
|
|
|
|
128 |
|
|
|
|
|
|
--gp-active-posterior belongs to the dimer and minimum-mode path and is
left out of the run below. The run uses every other flag in the table on
a Lennard-Jones cluster.
Compare settings on a Lennard-Jones cluster¶
Copy the endpoints of the five-atom pentamer from the gprn tutorial.
examples="$GPRIDGE_ROOT/examples/lj-pentamer"
cp "$examples/reactant.con" "$examples/product.con" .
Five runs share one base command. --gp-nonperiodic true treats the
cluster as an isolated molecule, --gp-hssvd false turns off the HS-SVD
stable-basis solver and --gp-observation-archive off skips the archive. The runs
differ in the GP settings only:
classicuses thegprd_zblprofile.defaultuses the defaultextendedprofile.publishedadds the other settings of the table above.classic_rff8adds--rff-features 8toclassic.extended_rff8adds--rff-features 8todefaultand caps the run at 40 outer iterations.
BASE="--potential lj --nimages 7 --gp-nonperiodic true --gp-hssvd false --gp-observation-archive off"
run() {
local name=$1; shift
mkdir -p "$name"
local status=0
(cd "$name" && gprn --reactant ../reactant.con --product ../product.con $BASE \
--output neb.h5 --write-con band.con "$@" > gprn.log 2>&1) || status=$?
echo "$status" > "$name/exit_status"
}
summary() {
local calls barrier converged
calls=$(sed -n 's/^Oracle calls (to convergence): \([0-9]*\).*/\1/p' "$1/gprn.log")
barrier=$(sed -n 's/^Barrier energy (eV): \([-0-9.e+]*\).*/\1/p' "$1/gprn.log")
converged=$(sed -n 's/^Converged: //p' "$1/gprn.log")
printf '%-13s exit=%s calls=%-4s barrier=%s eV converged=%s\n' \
"$1" "$(cat "$1/exit_status")" "$calls" "$barrier" "$converged"
}
run classic --gp-model-profile gprd_zbl
run default
run published --gp-model-profile gprd_zbl --gp-zbl-prior-mean true \
--gp-prior-mean-statistic max --gp-adaptive-prune-max 128
run classic_rff8 --gp-model-profile gprd_zbl --rff-features 8
run extended_rff8 --rff-features 8 --max-iterations 40
for name in classic default published classic_rff8 extended_rff8; do summary "$name"; done
classic exit=0 calls=17 barrier=0.623237 eV converged=yes
default exit=0 calls=41 barrier=0.623256 eV converged=yes
published exit=0 calls=17 barrier=0.623237 eV converged=yes
classic_rff8 exit=0 calls=17 barrier=0.623237 eV converged=yes
extended_rff8 exit=2 calls=49 barrier=1.72107 eV converged=no
The default row prints 41 oracle calls and a barrier of 0.623256 eV. Classic and published both print a barrier of 0.623237 eV and write the same band. The default profile converges within 2e-5 eV of that barrier and takes more oracle calls. The block below pins the default call count and barrier, checks that classic and published agree to 1e-10, checks that the default barrier is within 2e-5 eV of classic, and checks the two RFF results discussed below.
read_barrier() { sed -n 's/^Barrier energy (eV): \([-0-9.e+]*\).*/\1/p' "$1/gprn.log"; }
read_calls() { sed -n 's/^Oracle calls (to convergence): \([0-9]*\).*/\1/p' "$1/gprn.log"; }
for name in classic default published; do
grep -q '^Converged: yes' "$name/gprn.log"
test "$(cat "$name/exit_status")" = 0
done
test "$(read_calls default)" = 41
test "$(read_barrier default)" = 0.623256
awk -v a="$(read_barrier classic)" -v b="$(read_barrier default)" -v c="$(read_barrier published)" \
'BEGIN { exit !((a-b)^2 < 4e-10 && (a-c)^2 < 1e-10) }'
cmp classic/band.con classic_rff8/band.con
grep -q '^Converged: no' extended_rff8/gprn.log
test "$(cat extended_rff8/exit_status)" = 2
echo "profiles agree; rff ignored under gprd_zbl; rff 8 fails under extended"
profiles agree; rff ignored under gprd_zbl; rff 8 fails under extended
Two rules follow from the last two runs.
The classic profiles
chemgpandgprd_zblreset the RFF count to 0, so--rff-featuresdoes nothing under them.classic_rff8wrote the sameband.conasclassic. The driver prints no warning. Use--gp-model-profile extendedfor RFF.A feature count that is too small gives a wrong surrogate, not a slow one.
extended_rff8stopped after 40 iterations with a barrier of 1.72 eV where the converged runs give 0.623 eV. The driver exits with status 2 when a band does not converge (runGprninmain_neb.cpp). The next section says how many features to use.
Use Random Fourier Features for a large training set¶
Random Fourier Features (RFF) replace the exact kernel solve by a
Bayesian linear regression in a feature space of D_rff functions
(--rff-features D_rff). The cost of a prediction then does not grow
with the number of training rows. The price is accuracy.
The RFF model is built only when the design has at least twice as many rows as features:
where \(n_{\mathrm{obs}}\) is the number of training configurations and
\(D\) the number of Cartesian coordinates of one configuration, three
per atom (Optimize.cpp, n_design > 2 * D_rff=). Below that threshold the exact
path runs and the result is bit-identical to a run without RFF. The
GPU how-to covers the GPU backend of the RFF solve. The block below
checks the threshold rule and the accuracy cost on two argon atoms with the Lennard-Jones potential of
ASE (\(\epsilon = 1\) eV, \(\sigma = 1\) Angstrom), using 30 training
configurations at random separations between 1.0 and 1.8 Angstrom and a
held-out configuration at 1.3 Angstrom. In Python, rff_features needs
uncertainty”laplace”; with the default arm the constructor raises =ValueError.
import numpy as np
from ase import Atoms
from ase.calculators.lj import LennardJones
from gpridge.gp import GaussianProcess
rng = np.random.default_rng(0)
calc = LennardJones(sigma=1.0, epsilon=1.0)
def pair(d, angle=0.0, axis=(0, 0, 1)):
atoms = Atoms("Ar2", positions=[[0, 0, 0], [d, 0, 0]], cell=[20, 20, 20], pbc=False)
atoms.rotate(angle, axis)
atoms.calc = calc
return atoms
train = []
for _ in range(30):
axis = rng.normal(size=3)
train.append(pair(rng.uniform(1.0, 1.8), rng.uniform(0, 360), axis / np.linalg.norm(axis)))
query = pair(1.3, 10.0)
e_true, f_true = query.get_potential_energy(), query.get_forces()
def predict(**options):
gp = GaussianProcess(template_atoms=train[0], **options)
for atoms in train:
gp.observe(atoms)
gp.fit()
return gp.predict_with_uncertainty(query)
n_design = len(train) * (1 + 3 * len(train[0]))
exact = predict(uncertainty="laplace")
for label, options in [("exact", {}), ("rff 64", {"rff_features": 64}), ("rff 512", {"rff_features": 512})]:
pred = predict(uncertainty="laplace", **options)
print(f"{label:8s} energy error {abs(pred.energy - e_true) * 1e3:7.3f} meV"
f" force error {np.abs(pred.forces - f_true).max() * 1e3:7.3f} meV/A")
if "rff_features" in options:
built = n_design >= 2 * options["rff_features"]
assert built == (abs(pred.energy - exact.energy) > 1e-9), label
if built:
assert abs(pred.energy - e_true) > abs(exact.energy - e_true)
exact energy error 0.353 meV force error 0.885 meV/A
rff 64 energy error 3.108 meV force error 28.395 meV/A
rff 512 energy error 0.353 meV force error 0.885 meV/A
With 30 configurations of two atoms the design has 210 rows. 64 features
pass the threshold (128) and the prediction changes. 512 features do not
(1024), so rff 512 equals the exact result. The assertions fail if a
build changes either behaviour.
Let the run choose the feature count¶
--rff-features auto (Python: rff_features”auto”= in GaussianProcess, or
Surrogate.rff("auto")) selects the count against the exact posterior. A
uniform error bound on this kernel does not give a usable count: pull request
223 measured the mixed-second sufficient count at 2.5250e19 on an
811-geometry, 135-coordinate gradient GP, where the full Gram matrix is 90.64
GiB. The selection therefore tests candidates on held-out geometries. The
same pull request compared the random-feature posterior with the exact GP on
a four-geometry subsample of that surface, under the same separate energy
and gradient noise. D=512 gave an energy difference of 1.90314e-4 eV and a
force difference of 0.0362025 eV/A. D=2048 gave 3.80218e-6 eV and
0.00250762 eV/A, and D=8192 gave 1.60674e-6 eV and 0.00142925 eV/A. The
acceptance test is the posterior difference, not a kernel sample: the kernel
derivative errors at the same seed were much larger.
The rule is deterministic:
The count doubles from 1 while the design stays at least twice overdetermined, so it is a power of two.
Geometries are ordered by farthest-point sampling. The order starts at geometry 0 and then takes the unused geometry with the largest squared Euclidean distance from the chosen set. A tie keeps the smaller index. The order uses no random generator, and the random-feature frequencies use the fixed seed 42.
When the full joint Gram matrix fits in 256 MiB, the hold-out is the last quarter of that order, and at least one geometry. When it does not, the fit is the longest prefix whose Gram matrix fits and every remaining geometry is held out. The cap bounds the validation Gram matrix and the feature normal matrix. It is a memory limit, not an accuracy setting.
A candidate is accepted when the random-feature posterior differs from the exact posterior by no more than the energy and force tolerances. If the cap cannot hold one overdetermined fit geometry, or no count on the ladder meets the tolerance, the run reports the measured errors and refuses the count. It does not install a smaller one. With fewer than two geometries the run keeps the exact posterior and defers the selection.
The force tolerance is a fraction of the band force tolerance, 0.0514221
eV/A. The default fraction is the standard deviation of the gradient noise
divided by that tolerance. At a gradient noise floor of 1e-4 the standard
deviation is 0.01 eV/A and the fraction is 0.194467, so the allowed force
error is one gradient-noise standard deviation. The energy tolerance scales
the standard deviation of the energy noise by the same force-tolerance-to-
gradient-noise ratio (sigma_e * force_tolerance / sigma_g, which equals
sigma_e at the default fraction).
--rff-force-tol-fraction (Python: rff_force_tol_fraction of
GaussianProcess, or the second argument of Surrogate.rff) overrides the
fraction. It must lie in [0, 1), and 0 keeps
the derived value. A fraction of 1 or more can flip a convergence decision
and is rejected. The log records the chosen count, the differences between
the two posteriors, and the error of both posteriors against the held-out
observations.
The default stays 0. A run that does not ask for automatic selection keeps the exact posterior byte for byte.
Pick the uncertainty arm¶
The uncertainty arm decides how the posterior variance is computed. The variance feeds the acquisition and the trust checks of the band (surrogate loop).
map(default) uses the point estimate of the hyperparameters. It is the cheapest arm.laplace-slicesamples the hyperparameter posterior with doubling slice sampling (Neal, 2003) on the same likelihood target. The source comment (structures/Structures.h) puts the cost at about 100 Cholesky factorizations per fit and \(O(M n^2)\) per prediction, with no new factorization.laplaceis the Rue et al. (2009) central-composite mixture over the hyperparameter posterior.bma,ebandsvgdare other estimators. The source callsbmaa reference-timing arm that is rarely used in production.--use-psis-laplace trueadds Pareto-smoothed importance sampling to the Laplace arm.--use-psis-deterministic true(default) draws on a fixed axial grid instead of random samples, so every MPI rank computes the same samples (gpr/ml/gp/LaplaceSlice.cpp).--use-delta-method trueadds the analytical delta-method variance. In TOML one key,[uncertainty] variance_arm, replaces the three flags.
--gp-variance-convention chooses what the reported variance contains.
latent (default) excludes the nugget. predictive includes it, as the
original MATLAB get_variance.m did.
Control hyperparameter fitting¶
The fit is the expensive step of an outer iteration. The help text of
--gp-refit-cadence puts it at about 91 % of an outer iteration and
notes it is cubic in the kernel order, which is the number of training
rows times \(1 + 3 N_{\mathrm{atoms}}\).
--gp-refit-cadence Nrefits after every N appended rows (default 5). A larger N saves wall time and uses staler hyperparameters. No observation is dropped.--gp-fps-history Nfits on the farthest-point subset of N rows plus the latest points once the training set is larger than N (default 10). 0 fits on every row.--hyperparameter-modeselects the optimizer:scg,map_lbfgs,inla,rgmin_scgorrgmin:<method>. The default isscgunder the classic profiles andrgmin:lbfgsotherwise.--hyperparameter-objectiveselectsnlml(default),looorlocal-loo.--gp-learn-noise truelearns the likelihood noise, and only undernlml.--gp-opt-tolsets thescgfunction and solution tolerance.
Handle conditioning, noise and bad rows¶
The likelihood noise variance and the relative jitter have no command-line flag.
gprnsetsgp_sigma2,jitter_sigma2andsigma2to 1e-4 each (main_neb.cpp). The source comment gives the reason for the noise floor: a smaller noise variance let the posterior variance collapse as the training set grew. The TOML keys[gp] gp_sigma2,noise_sigma2andjitter_sigma2override them in builds with Cap’n Proto.gpridge.default_gpr_parameters()uses the same 1e-4 values, so command-line and Python runs start with the same noise level. Unless--gp-learn-noise trueis set, the optimizer keeps the noise fixed.--principled-nugget true(default) adds a diagonal nugget chosen so the kernel matrix stays below a condition-number cap.--kappa-max Ksets the cap; 0 selects the built-in default.--principled-nugget falseremoves both.--gp-robust-nu NUwith NU above 0 treats each training configuration as a Gaussian scale mixture with Student-t degrees of freedom NU. A row the model cannot explain, such as an oracle wall or hole or a clashing seed, then carries the extra noise its own leave-one-geometry-out misfit implies. 0 keeps the Gaussian likelihood. The Student-t process how-to covers the separate library-only model.--ls-prior true(default) puts a chemistry-centred log-Gaussian prior on the length scales.--gp-zbl-prior-mean trueadds a switched Ziegler-Biersack-Littmark residual prior mean, which keeps the surrogate repulsive at pair distances the data never reached (theory page).--gp-prior-mean-statistic maxmakes the surrogate revert to the maximum residual energy away from its data, not the mean. Withmean, a relaxation on the surrogate can find lower energy along every coordinate the rows never varied. Withmaxthat extrapolation goes uphill, so the band relaxes where the data supports it.
Bound the training set¶
The kernel order is the row count times \(1 + 3 N_{\mathrm{atoms}}\), and the solve is cubic in it.
--gp-adaptive-prune true(default) drops rows whose removal moves neither the band energy nor a Cartesian force by one likelihood standard deviation.--gp-adaptive-prune-max Nis a hard ceiling on the number of rows, enforced at prune points. 0 (default) leaves it unbounded. Rows within one kernel length of the live band are kept. The paper’s runs use 128.--gp-resolution-dedup true(default) admits an acquisition as a training row only if it lies farther from every row than the model can resolve. Every acquisition still reaches the observation archive.--gp-endpoint-symmetry trueadds, for a degenerate rearrangement, the symmetry image of every oracle row. It raises the row count, up to twice, for no oracle call.
Check a change against the oracle¶
A changed setting is judged by the oracle, not by the surrogate. Compare the converged barrier, the oracle-call count and the certificate of the same endpoints with and without the change, as the runs above do. For the Python surrogate, compare a held-out prediction with the calculator, as the RFF block does. A smaller variance from a new setting is not evidence that the surrogate is better.
Where to read more¶
The method and the surrogate loop for what the surrogate does in a search.
Command-line reference and TOML key reference for every flag and key.
Run-to-run determinism for the settings that decide whether two runs agree.