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

uma, omol

libuma_engine.so

an AOTInductor model package

-Duse_rgpot_uma=true -Duse_capnp=true

--model PATH.pt2, --task-name, --device, --uma-charge, --uma-spin

cpmd

libcpmd_engine.so

libcpmdc.so, named by CPMDParams.enginePath

-Duse_capnp=true

--cpmd-scf-max-iter, --cpmd-scf-convergence

cp2k

libcp2k_engine.so

libcp2kc_rgpot.so, from CP2KC_LIBRARY or RGPOT_CP2K_ENGINE

-Duse_capnp=true, with an rgpot revision that provides CP2KPot

CP2K_DATA_DIR, --cp2k-max-scf, --cp2k-eps-scf

lammps

liblammps_engine.so

liblammpc.so, from LAMMPC_LIBRARY or RGPOT_LAMMPC_ENGINE

-Duse_lammps=auto (the default) or enabled, with -Duse_capnp=true

--lammps-params FILE

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=true uses 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):

  1. --potential-library PATH names the file.

  2. --engine-dir DIR names the directory. The driver looks only there.

  3. 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;

    • lib and lib64 beside 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/UmaPot for UMA.

  4. 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 engine registry needs Cap'n Proto and the rgpot RPC arm (-Duse_capnp=true ...)

The binary was built without Cap’n Proto and --oracle-path engine was requested

Rebuild with -Duse_capnp=true, or use --oracle-path direct

dlopen <library>: <loader message>; searched <directories>, then the loader's search path (rpath, LD_LIBRARY_PATH)

No directory in the search order holds the library, or the library has an unresolved dependency

Build the plugin, or set --engine-dir, RGPOT_ENGINE_PATH or LD_LIBRARY_PATH; run ldd on the file to find the missing dependency

<library>: engine C ABI incomplete

The file lacks one of rgpot_engine_abi_version, rgpot_engine_create, rgpot_engine_destroy or rgpot_engine_force

Pass the correct file to --potential-library

<library>: engine C ABI version N does not match the host's M

The plugin was built from another tree

Rebuild the plugin with the drivers

potential '<name>' has no shipped engine library; pass --potential-library

The potential has no plugin in the engine table (for example lj)

Drop --oracle-path engine, or name a library with --potential-library

--model is required for 'uma'

UMA needs a model package

Pass --model PATH.pt2

The messages come from gpr/potentials/EngineRegistry.cpp and gpr/potentials/EnginePotential.cpp. None was provoked for this page.