Skip to main content

rgpot

img

codecov

rgpot is a potential-energy library and Cap'n Proto RPC server for atomistic simulation codes. It gives clients one geometry carrier, one result carrier, and one extensible backend-configuration carrier:

  • ForceInput: positions, atomic numbers, box, and unit strings
  • PotentialResult: energy plus flat force array
  • PotentialConfig: backend setup, with arms such as none, nwchem, and cpmd

The public wire schema lives in CppCore/rgpot/rpc/Potentials.capnp and is shared by the C++ server, Python integration tests, and the Rust core crate. Native rgpot units are eV and Angstrom. RPC clients may request compatible units through ForceInput.lengthUnit and ForceInput.energyUnit.

Python (PyPI)

Install the manylinux wheel (nanobind abi3, Python >= 3.12 for the stable ABI extension; requires-python is >= 3.10 for pure metadata):

pip install rgpot
# Metatomic path (engine libs resolve from these packages at runtime):
pip install 'rgpot[metatomic]'
# or: pip install torch metatomic-torch metatensor-torch metatensor-core vesin

Lennard-Jones needs only numpy. Metatomic uses dlopen of a bundled engine:

  • layout: rgpot/lib/torch-X.Y/libmetatomic_engine.so
  • picker: installed torch major (same multi-ABI idea as metatomic-torch)
  • supported torch majors: 2.7 and newer (wheels ship 2.7–2.13 engines)
  • torch 2.6 and older are not supported for Metatomic dlopen
import numpy as np
import rgpot

print(rgpot.__version__)
print(rgpot.available_metatomic_engine_abis())  # e.g. 2.7 .. 2.13
# energy, forces, variance = rgpot.evaluate_metatomic(
#     positions, atom_types, box, model_path="model.pt")

See https://pypi.org/project/rgpot/.

Build And Test

Meson is the primary build path. Use the rpctest environment when running the RPC integration scripts because they need pycapnp.

pixi shell -e rpctest
meson setup bbdir -Dwith_tests=true -Dwith_rpc=true --buildtype=debug
meson compile -C bbdir
meson test -C bbdir --print-errorlogs
python tests/rpc_integ.py --server-bin ./bbdir/CppCore/potserv

CMake is supported as well:

cmake -B build \
  -DRGPOT_BUILD_TESTS=ON \
  -DRGPOT_BUILD_EXAMPLES=ON \
  -DRGPOT_WITH_RPC=ON
cmake --build build
ctest --test-dir build --output-on-failure

For client-only consumers that only need the Cap'n Proto schema and generated RPC client types:

cmake -B build_client \
  -DRGPOT_RPC_CLIENT_ONLY=ON \
  -DRGPOT_BUILD_TESTS=ON
cmake --build build_client
ctest --test-dir build_client --output-on-failure

Backends

Backend Server selector Build / runtime notes
LJ LJ Built-in 12-6 Lennard-Jones reference potential
CuH2Pot CuH2 Built-in Cu-H EAM potential
XTBPot XTB, GFNFF, GFN0xTB, GFN1xTB Enable with -Dwith_xtb=true; use pixi env xtbbld or tbbld; linked XTBPot + dlopen libxtb_engine.so (see docs/xtb_backends.md)
TBLitePot TBLite, TBLiteGFN1, TBLiteIPEA1 Enable with -Dwith_tblite=true; use pixi env tblitebld or tbbld
MetatomicPot Metatomic:<model_path> Enable with -Dwith_metatomic=true; use pixi env metatomicbld. Pip engines: torch 2.7+
NWChemPot NWChem Frontend always builds; load libnwchemc from the split nwchemc project at runtime
CPMDPot CPMD Frontend always builds; load libcpmdc from the split cpmdc project at runtime

Example server commands:

./bbdir/CppCore/potserv 12345 LJ
./bbdir/CppCore/potserv 12345 Metatomic:CppCore/tests/data/lj38/lennard-jones.pt
CPMDC_LIBRARY=/path/to/libcpmdc.so ./bbdir/CppCore/potserv 12345 CPMD
NWCHEMC_LIBRARY=/path/to/libnwchemc.so ./bbdir/CppCore/potserv 12345 NWChem

CPMD And NWChem Configuration

CPMD and NWChem do not use ad hoc rgpot config files. They use the PotentialConfig union over RPC:

  • PotentialConfig.cpmd carries CPMDParams for CPMDPot
  • PotentialConfig.nwchem carries NWChemParams for NWChemPot
  • geometry still arrives through ForceInput on every calculate() call

For CPMD, tests/cpmd_params.py contains pycapnp helpers for building CPMDParams and PotentialConfig.cpmd messages. The helper covers scalar fields, raw inputBlocks, and every structured CPMDInputSection arm. See CppCore/rgpot/CPMDPot/README.md for the engine lookup order and schema field mapping.

The CPMD runtime path is:

  1. Build libcpmdc.so in the split cpmdc repository (or use the in-tree libcpmdc_fake_engine.so from a -Dwith_tests=true build for CI).
  2. Start potserv <port> CPMD with CPMDC_LIBRARY, RGPOT_CPMDC_ENGINE, or RGPOT_CPMD_ENGINE pointing at that shared library.
  3. Send configure(PotentialConfig.cpmd) once for method setup.
  4. Send ForceInput on each calculate() call for geometry and requested output units.

For NWChem, tests/nwchem_params.py builds NWChemParams / PotentialConfig.nwchem. Engine lookup order is NWCHEMC_LIBRARY, RGPOT_NWCHEMC_ENGINE, RGPOT_NWCHEM_ENGINE, then enginePath on params. See CppCore/rgpot/NWChemPot/README.md. The NWChem runtime path mirrors CPMD:

  1. Build libnwchemc.so in the split nwchemc repository (or libnwchemc_fake_engine.so from a tests build).
  2. Start potserv <port> NWChem with the library env vars above.
  3. configure(PotentialConfig.nwchem) once, then calculate(ForceInput).

potctl drives the same Potential Cap'n Proto RPC against potserv (bridge stress and CI legs pass the potential name such as NWChem or CPMD).

Developer Tasks

Hooks use prek through prek.toml. Common commands:

pixi r prek-install
pixi r prek
pixi r rust-test
pixi r -e rpctest python tests/test_cpmd_params.py
pixi r -e rpctest python tests/test_nwchem_params.py
pixi r -e rpctest python tests/test_rpc_integ_cpmd.py
pixi r -e rpctest python tests/test_rpc_integ_nwchem.py
# Full RPC + C ABI E2E (point env at built fake engines + potserv)
export RGPOT_POTSERV=/path/to/bbdir/CppCore/potserv
export NWCHEMC_LIBRARY=/path/to/bbdir/CppCore/libnwchemc_fake_engine.so
export RGPOT_CPMD_ENGINE=/path/to/bbdir/CppCore/libcpmdc_fake_engine.so
pixi r -e rpctest python tests/test_rpc_e2e_c_abi.py
pixi r -e rpctest python tests/rpc_integ.py \
  --server-bin ./bbdir/CppCore/potserv \
  --nwchem-smoke \
  --cpmd-smoke

The root README is generated from readme_src.org. Project documentation sources live under docs/orgmode/.

License

MIT, with backend-specific notes: some potentials are adapted from eOn under BSD-3-Clause terms. The unit expression parser in CppCore/rgpot/units.cc is derived from metatomic-torch (BSD-3-Clause, metatensor developers).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rgpot-3.0.2.tar.gz (1.8 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rgpot-3.0.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

rgpot-3.0.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

rgpot-3.0.2-cp312-abi3-macosx_14_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.12+macOS 14.0+ ARM64

rgpot-3.0.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

rgpot-3.0.2-cp311-cp311-macosx_14_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

rgpot-3.0.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

rgpot-3.0.2-cp310-cp310-macosx_14_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

Details for the file rgpot-3.0.2.tar.gz.

File metadata

  • Download URL: rgpot-3.0.2.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for rgpot-3.0.2.tar.gz
Algorithm Hash digest
SHA256 a97296d723ad1d5ae311268ceafa6c788e8daa0e73ad1684e9bcec16b074c77e
MD5 dd9ff48ce6c7c846d88b0d8d9a429776
BLAKE2b-256 b16eb79d463b2f19751a44494fc6145f5ccc86c67bf49ef5ec26c0800f86ebad

See more details on using hashes here.

File details

Details for the file rgpot-3.0.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rgpot-3.0.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f2a544dd84eab2c5fd4b84f56c2b7b133279fc8f815a82cef33479fe16dbfb19
MD5 0cf0a0da26c5d9d8c5677cef445c9996
BLAKE2b-256 fc108fc8c1f1c1bed9092dc905f38d4c2eb14dd2341a68f63365495ca0ea1f01

See more details on using hashes here.

File details

Details for the file rgpot-3.0.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rgpot-3.0.2-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 13f99ce563caa51bb476ce43f14cbbff17f1dad2e2b120dcca2e14a05a80ac7a
MD5 10588e6d0d6dae041d1d9687dd1dd54a
BLAKE2b-256 ca68b965cb477442e046d264ac882903dd4c733c6ae75037686d29d6bcc2fdd9

See more details on using hashes here.

File details

Details for the file rgpot-3.0.2-cp312-abi3-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for rgpot-3.0.2-cp312-abi3-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 fa2dabb3e92a98401f46b5101b59c4f018b2ee0220d7df7ac98cf1810f9cf256
MD5 ba57d3803addb75ca9e92b290874de41
BLAKE2b-256 7aebafc84228fd62d962bd76a3b4f7910912a6bc635e7402fd06ea28a0aea90e

See more details on using hashes here.

File details

Details for the file rgpot-3.0.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rgpot-3.0.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2341f6335e7b5ba2a27afe25bca479918f8b7cd8ec217a663e54b346fa2a047c
MD5 49145f7596d9e24435cbced3faaa9569
BLAKE2b-256 0ac58bc14f4e2284e8a598ff29479d405153992b75c1d56dc6fe1561f4801fac

See more details on using hashes here.

File details

Details for the file rgpot-3.0.2-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for rgpot-3.0.2-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c13b3b835213e02e90ebe42057c12981f418df755f30032c71cfb1e190cd5a87
MD5 1f39e825ec08978b9551d7875408d3df
BLAKE2b-256 8a95395911f6015b567c2a8a52f1fe6f0a0e10e7f3d534489d1b00ca5734ec51

See more details on using hashes here.

File details

Details for the file rgpot-3.0.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for rgpot-3.0.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1c39279a63efaf8da9a4eff1dd6d27d53a6da3f40e1ef432c46d838bee5ce06d
MD5 aa536ee4bacab77d1468a79ea3ca4492
BLAKE2b-256 c7b83bb39bc015fa8b147ff423a76708e4992c0b774d82a5f0aedf3ff6cd8347

See more details on using hashes here.

File details

Details for the file rgpot-3.0.2-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for rgpot-3.0.2-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 879fe043ebe7d51387ac0516e79e3701e42bedf16acfbdec8937f3e62ca4ef40
MD5 204c4a0ca1a6864a5ca78989256043b8
BLAKE2b-256 3212f3f6c5b83a9c68d06fd3c08544bcb8fe7c35846b8e5272cdc71a992c7697

See more details on using hashes here.

Release history Release notifications | RSS feed

3.2.0

7 files

3.1.2

7 files

3.1.0

7 files

This release

3.0.2 This release

8 files

2.5.4

1 file

2.5.3

1 file

2.5.2

1 file

2.5.1

2 files

2.4.2

2 files

2.4.1

2 files

2.4.0

2 files

2.3.1

2 files

2.3.0

2 files

2.2.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page