Unified InputParameters schema

Status: implemented for gprn, not for gprd. schema/params.capnp is the configuration of the NEB driver: gprn --config run.toml (or a binary Cap’n Proto message) is read through managers/io/UnifiedConfigMessage and managers/io/TomlConfigLoader.cpp. The dimer driver gprd still reads the older schema/gprd_params.capnp through managers/io/CapnProtoManager.cpp, and both files stay in the tree. The schema is not the only source of run-time options. Command-line-only flags and a set of GPR_* environment variables remain (see “What is still outside the schema” below). For the key tables of the TOML file see the key reference. For the versioning rules and the binary format see the Cap’n Proto reference.

The file id of params.capnp is @0xcb672719fc31b8e4. currentSchemaVersion is 7.

Why one schema

Before this schema, configuration was split over three mechanisms that did not know about each other:

Mechanism

Scope

Discoverability

schema/gprd_params.capnp

the dimer driver (main.cpp)

typed, schema

hand-written strcmp CLI flags

the NEB driver (main_neb.cpp)

source only

getenv("GPR_*")

deep in the GP library

invisible

The dimer had a typed schema. The NEB driver had its own parser, and a few behaviours, among them length-scale priors, block leave-one-out and length-scale tracing, could be switched on only by an environment variable read in the middle of a GP fit. A new option could land in any of the three, so no single place listed everything that can be configured.

The rule that follows is that a new option is a field of this schema, with a comment that names the flag it matches, not a new getenv call and not a new bare strcmp branch. The four variables in the migration table below (GPR_LS_PRIOR, GPR_PC, GPR_BLOCK_LOO, GPR_TRACE_LS) are gone from the code. The rule has exceptions that exist today, listed next.

What is still outside the schema

  • main_neb.cpp still parses the command line with a flag table (kFlagDocs) and 19 std::strcmp calls. Many flags have no schema field and are available only on the command line.

  • gprd does not read params.capnp.

  • The library reads GPR_* environment variables for debugging and for kernel-path switches. List the names that a source search finds:

cd "${GPRIDGE_ROOT:-.}"
grep -rhoE --include='*.h' --include='*.cpp' --include='*.cu' --include='*.inl' \
    'getenv\("GPR_[A-Z0-9_]+"' gpr managers python main.cpp main_neb.cpp \
    | sed 's/getenv("//; s/"//' | sort -u

Twenty names were found when this page was written. The configuration page Configuration documents a subset of them.

Struct layout

The schema reads from top to bottom as reusable enums, reusable building-block structs, the shared blocks, the method-specific parameter sets and the top-level InputParameters. The authoritative list of enums, structs and fields is the file itself; the lists in the earlier draft of this page had fallen behind it.

The top-level InputParameters holds the run setup (potential, model, reactant, product, configFile, output, conOutput, cellDimensions, seed, device), the shared blocks and a method union:

Field

Type

Role

gpr

GprModel

GP model settings

optimizer

HyperparameterOptimization

hyperparameter fit, objective, length-scale priors

hsSvd

HsSvd

HS-SVD stable-basis solver options

linearAlgebra

LinearAlgebra

linear algebra mode, threads, ScaLAPACK layout

uncertainty

Uncertainty

uncertainty mode and variance arm

trace

Trace

what to record

pruning, debug, earlyStopping, runSelector

their own structs

ancillary controls

metatomic, potentialConfig

MetatomicConfig, Rgpot.PotentialConfig

potential-provider settings

gpInitializationFields

list of GpInitializationField

marks GP initial values set explicitly, so an explicit zero differs from omission

schemaVersion

UInt16

revision the writer used

method.dimer, method.neb

DimerParams, NebParams

method-specific parameters

The method union means a run is either a dimer search or a NEB, never both. Every shared block applies to whichever method is selected. The GP-OIE setup in main_neb.cpp (makeGpSetup) uses the same GprModel and HyperparameterOptimization fields as the dimer, so the defaults exist once. NebParams has the sub-blocks NebLbfgs, NebTrust and NebMmf.

The enum and struct names that params.capnp shares with gprd_params.capnp are DimerOptimizer, HyperparameterOptimizer, ScgCurvatureMode, DistanceMetric, ConvergenceForceNorm, ConvergenceCriteria, IterationControl, TranslationParams, InitialRotationControl, RelaxationControl, GprModel, HyperparameterOptimization, LinearAlgebra, Pruning, Debug, RunSelector and EarlyStopping. DimerParams holds the dimer-specific fields of the old InputParameters.problem group.

Enums that this schema adds include HyperparameterObjective (nlml, loo, blockLoo), UncertaintyMode and VarianceArm. blockLoo leaves out the energy and all gradient rows of one geometry together. VarianceArm replaces the three booleans --use-psis-laplace, --use-psis-deterministic and --use-delta-method, whose legal combinations were implicit, with one choice. NebMode and AcquisitionType are typed mirrors of gpr::neb::NEBMode and gpr::neb::AcquisitionType. List all enums with:

cd "${GPRIDGE_ROOT:-.}"
grep -n '^enum ' schema/params.capnp

Migration table

Each removed flag or environment variable maps to one field. The comment on the field in params.capnp records the same mapping.

Old flag or variable

Field

GPR_LS_PRIOR

optimizer.lengthScalePriors.lengthScalePrior

GPR_PC

optimizer.lengthScalePriors.pcPrior

GPR_BLOCK_LOO

optimizer.objective = blockLoo

--hyperparameter-objective

optimizer.objective

GPR_TRACE_LS

trace.hyperparameters

(h5 con-v2 geometry store)

trace.geometriesConV2

--uncertainty-mode

uncertainty.mode

--use-psis-laplace, --use-psis-deterministic

uncertainty.varianceArm

--use-delta-method

uncertainty.varianceArm = deltaMethod

--rff-features

uncertainty.rffFeatures

--variance-accept-tau, --variance-accept-tau-relative

uncertainty.acceptTau, uncertainty.acceptTauRelative

--inner-unc-relative

uncertainty.innerUncRelative

--gp-hssvd*

hsSvd.*

--gp-no-output-norm

gpr.disableOutputNormalization

--gp-zbl-prior-mean

gpr.useZblPriorMean

--scalapack-block-size, --scalapack-nprow

linearAlgebra.scalapackBlockSize, linearAlgebra.scalapackNprow

--profile-predict-mean and related

gpr.profilePredictMean and related

--hyperparameter-mode

optimizer.algorithm (the C++ enum is chosen from it)

--nebmode

method.neb.mode

--acquisition

method.neb.acquisition

--nimages and the other scalar NEB flags

method.neb.*

--neb-lbfgs-*

method.neb.lbfgs.*

--trust-*, --use-adaptive-trust

method.neb.trust.*

--use-mmf, --mmf-*

method.neb.mmf.*

--potential, --model, --device

potential, model, device

--reactant, --product

reactant, product

--output, --write-con

output, conOutput

--seed

seed

The --hyperparameter-mode values scg, inla and map_lbfgs map onto the C++ enum gpr::HyperparameterOptimizationMode. The schema exposes the choice through HyperparameterOptimizer and the SCG/Adam union.

How to extend

The files to touch for a new option are listed once, in the Contributing guide: Add a TOML configuration key. The schema rules behind those steps are:

  1. Put the field in the sub-struct that owns it: shared GP settings in GprModel, a NEB-only knob in NebParams or one of NebLbfgs, NebTrust and NebMmf, a new uncertainty arm in Uncertainty with the UncertaintyMode or VarianceArm enums. A new method is a new arm of the method union, not a top-level field.

  2. Give the field the next free @n ordinal of its struct, never reuse or reorder an ordinal, and give it a default that reproduces the behaviour without it. Add a new enum value at the end of its enum.

  3. Raise currentSchemaVersion by one.

  4. Record the addition in schema/params.capnp.ordinals. The meson test test_capnp_evolution_params fails on a renumbered, retyped or removed member and on a member that the record lacks:

python scripts/check_capnp_evolution.py --write schema/params.capnp schema/params.capnp.ordinals
git diff schema/params.capnp.ordinals
  1. Add the key to managers/io/TomlConfigLoader.cpp with a setIfPresent call, and carry it through CapnProtoNebLoader.cpp and main_neb.cpp as the Contributing guide describes.

  2. Check that the schema compiles. The schema imports /capnp/c++.capnp and the rgpot Potentials.capnp, so capnp compile needs both include directories:

cd "${GPRIDGE_ROOT:-.}"
capnp compile -I "$(dirname "$(command -v capnp)")/../include" \
    -I subprojects/rgpot/CppCore -o- schema/params.capnp > /dev/null

A meson build with -Duse_capnp=true (the default is false) compiles the schema as well.