mlipcpp
WARNING: Pre-alpha software This project is in early development. APIs may change without notice, and there may be bugs or incomplete features. Not recommended for production use.
Standalone C++ implementation of Machine Learning Interatomic Potentials (MLIPs) using ggml.
Currently supports PET/uPET models (energy, forces, stresses).
Quick start (Python)
# Install the package
pip install .
# Download and convert a model to GGUF
uv run scripts/convert_models.py --models pet-mad-s
import numpy as np
import mlipcpp
# Load a model
model = mlipcpp.Predictor("gguf/pet-mad-s.gguf")
print(f"Model type: {model.model_type}, cutoff: {model.cutoff} A")
# Water molecule
positions = np.array([
[0.000, 0.000, 0.000], # O
[0.757, 0.586, 0.000], # H
[-0.757, 0.586, 0.000], # H
], dtype=np.float32)
atomic_numbers = np.array([8, 1, 1], dtype=np.int32)
# Predict energy
result = model.predict(positions, atomic_numbers, compute_forces=False)
print(f"Energy: {result.energy:.4f} eV")
# => Energy: -14.3693 eV
# Predict energy + forces
result = model.predict(positions, atomic_numbers, compute_forces=True)
print(f"Energy: {result.energy:.4f} eV")
forces = np.array(result.forces).reshape(-1, 3)
print(f"Forces (eV/A):\n{forces}")
ASE integration
from ase.io import read
from mlipcpp.ase import MLIPCalculator
atoms = read("structure.xyz")
atoms.calc = MLIPCalculator("gguf/pet-mad-s.gguf")
print(f"Energy: {atoms.get_potential_energy():.4f} eV")
Converting models
Download and convert uPET models from HuggingFace to GGUF format:
# Convert all available models
uv run scripts/convert_models.py
# Convert a specific model
uv run scripts/convert_models.py --models pet-mad-s
# List available models
uv run scripts/convert_models.py --list
Default models: pet-mad-s, pet-oam-l, pet-omad-xs, pet-omad-s, pet-omat-xs, pet-omat-s, pet-spice-s
Use --all to also convert larger variants: pet-oam-xl, pet-omad-l, pet-omat-m, pet-omat-l, pet-omat-xl, pet-omatpes-l, pet-spice-l
Building from source
Dependencies
- ggml - Tensor library (fetched automatically via CMake)
- fmt - Formatting library (fetched automatically)
Note: This project uses a modified fork of ggml with additional backpropagation support for CONCAT and CLAMP operations, required for force/stress computation.
Build
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -j
C++ CLI
# Energy only
./build/bin/graph_inference gguf/pet-mad-s.gguf structure.xyz
# With forces
./build/bin/graph_inference gguf/pet-mad-s.gguf structure.xyz --forces
# With forces and stress (periodic systems)
./build/bin/graph_inference gguf/pet-mad-s.gguf structure.xyz --forces --stress
API
C, C++, Fortran, and Python APIs are provided. See examples/ for usage.
License
BSD 3-Clause
Metadata
Release files for mlipcpp 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mlipcpp-0.1.2.tar.gz | 396.9 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mlipcpp-0.1.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| mlipcpp-0.1.2-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 2.6 MB
Release files / mlipcpp-0.1.2.tar.gz
| Download URL | mlipcpp-0.1.2.tar.gz |
|---|---|
| Size | 396.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5c78b764a014589d33bfbe5f310b65bdf63e3ab21056f13b33326adec871de7
|
|
BLAKE2b-256 checksum How to use checksums |
7ad38321c545d000dba066d888529c347520bdfff1a18d8342ea8283247f2907
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.
Transparency logRelease files / mlipcpp-0.1.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | mlipcpp-0.1.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
aa6e08b4b183a6d5f9a62eb174587a8be00ceeec45c81e90c99fb4811574a1e2
|
|
BLAKE2b-256 checksum How to use checksums |
5229a7915f28f33b8bff69e320b0542833b8d6e4df50570a5daa50f342af480d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.
Transparency logRelease files / mlipcpp-0.1.2-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | mlipcpp-0.1.2-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 995.2 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7ddb7b7bdc968e454dc379de5459c843f84b42ae8c81939168fa045b8b4a1508
|
|
BLAKE2b-256 checksum How to use checksums |
2ac3042ed56f5dc771bc6582fa08e07a7f436483f41643ad95a086398cad6ff0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.
Transparency log