Use an rgpot engine plugin¶
gprn and gprd reach four potentials through a plugin library that they
load at run time with dlopen: UMA (uma and omol), CPMD, CP2K and LAMMPS.
This page shows how to make a build produce the plugin, how the drivers find
it, how to point them at a specific file, and how to read the start-up lines
that say which route a run used. It does not repeat the UMA setup; the
UMA band tutorial and the UMA dimer tutorial run a model end to end.
Which potentials use a plugin¶
Potential |
Plugin library |
The plugin loads in turn |
Build switches |
Run-time inputs |
|---|---|---|---|---|
|
|
an AOTInductor model package |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The table comes from the engine table in gpr/potentials/EngineRegistry.cpp,
the plugin targets in meson.build, and the option text in meson_options.txt.
The CPMD, CP2K and LAMMPS plugins do not link their programs. Each one opens a
calculator library when the potential is created, so that library must be on
the loader path or named by the variable in the table.
Every other potential, including the analytic ones, keeps the backend compiled
into the binary. gprn --list-potentials prints what the binary has:
gprn --list-potentials
Potential Direct backend Aliases / requirements
...
lammps engine plugin liblammps_engine.so, --lammps-params
UMA, CPMD, CP2K and LAMMPS use the engine path by default; --oracle-path direct selects the compiled backend.
Compiled frontends can require external libraries or model files.
The real output separates the columns with tabs, and the block above shows
them as spaces. The Direct backend column says whether the backend is
compiled into the binary. It does not say whether the plugin library exists;
the lookup below finds that out.
Choose the route¶
--oracle-path engine loads the plugin. --oracle-path direct uses the
backend compiled into the binary. Without the flag the drivers choose:
A binary built with
-Duse_capnp=trueuses the plugin for the four potentials above and the compiled backend for the rest.A binary built without Cap’n Proto uses the compiled backend for everything.
An explicit --oracle-path is always honoured. When engine is requested and
the library is missing, the run stops with an error. It does not fall back to
the compiled backend. The choice and its reason are in the start-up line shown
below.
Point the driver at the library¶
The drivers resolve the plugin file in this order, and stop at the first rule
that applies (resolveEngine and engineSearchDirectories in
gpr/potentials/EngineRegistry.cpp):
--potential-library PATHnames the file.--engine-dir DIRnames the directory. The driver looks only there.Otherwise the driver searches these directories and takes the first one that holds the library:
each directory of
$RGPOT_ENGINE_PATH, a colon-separated list;libandlib64beside the directory of the executable (../lib,../lib64);the directory of the executable;
the build tree’s plugin directory below the executable, for example
subprojects/rgpot/CppCore/rgpot/UmaPotfor UMA.
If no directory holds the file, the bare library name goes to the dynamic loader, which uses the rpath and
LD_LIBRARY_PATH.
meson install copies libcpmd_engine.so, libcp2k_engine.so and
liblammps_engine.so to the library directory when the build produced them
(scripts/install_built_engines.py). It does not copy libuma_engine.so: the
rgpot subproject declares that library with install: not meson.is_subproject().
For UMA, point RGPOT_ENGINE_PATH or --engine-dir at the build tree
directory. This was read from the build files; no install was run with UMA.
The following command runs a band search through a LAMMPS plugin that sits in an unusual directory. It needs a LAMMPS calculator library and a parameter file, so the documentation test does not run it:
export LAMMPC_LIBRARY=/path/to/liblammpc.so
gprn --reactant reactant.con --product product.con \
--potential lammps --lammps-params lammps.params \
--engine-dir /path/to/gpridge/builddir \
--oracle-path engine
The directory in --engine-dir must contain liblammps_engine.so. The
lammps.params file holds one directive per line. The reader in
gpr/potentials/EngineRegistry.cpp accepts units, atom_style,
pair_style, pair_coeff, type, mass, boundary, newton_pair, extra
and suffix, and rejects any other key.
Load a plugin that has no table entry¶
Any rgpot engine library loads from configuration alone. The run names the
library and a file holding the parameters message the engine is created from.
The driver passes the bytes of that file to rgpot_engine_create unread, so it
needs no table entry, no factory code and no schema arm for the backend. In a
TOML --config the [oracle.plugin] table does this, for gprn and gprd
alike:
[oracle]
potential = "orca"
[oracle.plugin]
plugin_name = "orca"
library_path = "/path/to/liborca_engine.so"
params_path = "orca.params"
--potential-library and --potential-params FILE are the command-line
equivalents and win over the file. With parameters given the engine path is the
default for any potential name; --oracle-path direct is still honoured. A
bare library_path is searched like a table name. A named engine such as
uma keeps its table library when only the parameters are given. The start-up
line reports the params arm as plugin:<plugin_name>. The message is whatever
the engine reads: capnp encode of its own parameters struct, for example.
The keys follow the plugin arm of the rgconf PotentialConfig
(pluginName, libraryPath, paramsPath, opaquePayload), and a binary
configuration carries them in InputParameters.oraclePlugin.
Read what a run used¶
Each run prints a [startup] oracle line before the search. A run on the
engine route prints a [startup] engine line as well. The quickstart run of
gprn with --potential lj on a default build of this tree printed this
line (2026-11-17):
[startup] oracle path=direct potential=lj reason="default: this binary has no Cap'n Proto"
A run on the engine route prints these two lines. The angle brackets mark the values that depend on the run:
[startup] oracle path=engine potential=<name> reason="<reason>"
[startup] engine library=<resolved path> abi=1 arm=<params struct>
The first line gives the route (engine or direct), the potential and the
reason: default: <potential> has a generic engine,
default: <potential> has no generic engine,
default: this binary has no Cap'n Proto, --oracle-path engine or
--oracle-path direct. The second line gives the file the loader mapped, the
engine ABI version and the Cap’n Proto parameter struct the plugin read
(UmaParams, CPMDParams, CP2KParams or LammpsParams). For UMA it adds
model and the SHA-256 digest of the model file. When an MLflow run is active,
the same values are logged under oracle.path, engine.library,
engine.abi_version, engine.params, engine.model_path and
engine.model_sha256. The format comes from formatOraclePath and
formatEngineReport in gpr/potentials/EngineRegistry.cpp. No run of this
page used a plugin, so the engine line is not shown with values.
Failure messages¶
Message |
Cause |
Fix |
|---|---|---|
|
The binary was built without Cap’n Proto and |
Rebuild with |
|
No directory in the search order holds the library, or the library has an unresolved dependency |
Build the plugin, or set |
|
The file lacks one of |
Pass the correct file to |
|
The plugin was built from another tree |
Rebuild the plugin with the drivers |
|
The potential has no plugin in the engine table (for example |
Drop |
|
UMA needs a model package |
Pass |
The messages come from gpr/potentials/EngineRegistry.cpp and
gpr/potentials/EnginePotential.cpp. None was provoked for this page.