Skip to main content

fmlip-relay

Persistent ML potential server for Fortran clients

License: MIT Documentation CI


fmlip-relay lets a Fortran code (MD, MC, geometry optimiser) evaluate machine-learned interatomic potentials that only exist as Python packages. The Fortran client spawns a Python server per instance and talks to it over a loopback TCP socket. The model is loaded once at server startup, so every later evaluation costs a socket round trip (about 1 ms) instead of a model reload.

  • A small Fortran module (fmlip_relay_client) with a handful of routines: init, compute, Hessian, ping, finalize
  • Backends for MACE (custom, MP, OFF, POLAR), UMA, NequIP, Allegro, DeepMD, SchNet, OpenMM, and any ASE calculator
  • Up to 16 independent server instances, callable from separate OpenMP threads or MPI ranks
  • A plain binary wire protocol in Å and eV, with no dependencies on the Fortran side beyond a C compiler
┌──────────────────────────────────────────────────────────────┐
│  Fortran driver (MD, MC, geometry optimiser, ...)            │
│  use fmlip_relay_client                                      │
│    mlip_init      → spawn fmlip-relay-server, wait for READY │
│    mlip_compute   → send coords, recv energy/forces/stress   │
│    mlip_ping      → liveness check                           │
│    mlip_finalize  → send QUIT, stop the process              │
└────────────────────────────┬─────────────────────────────────┘
                             │  127.0.0.1:PORT  (binary TCP)
                  ┌──────────┴──────────┐
                  │  fmlip-relay-server │
                  │  server.py          │  ← protocol + event loop
                  │  backends/*.py      │  ← model loaded once at startup
                  └─────────────────────┘

Quick start

Install the Python server and build the Fortran/C client library:

pip install .                 # core: dummy and Lennard-Jones backends
pip install ".[mace]"         # or another backend extra, e.g. uma, nequip, deepmd

cmake -S . -B build -DBUILD_EXAMPLE=ON
cmake --build build
./build/example/run_example lj        # spawns servers, runs a few evaluations, shuts down

Check a backend without any Fortran code:

fmlip-relay-check                                      # which backends work in this environment
fmlip-relay-server --backend mace_mp --test mol.xyz    # one single-point evaluation, then exit

From Fortran, the whole life cycle is three calls:

use fmlip_relay_client

integer  :: ierr, pbc(3), atomic_numbers(64)
real(8)  :: pos(3,64), cell(3,3), energy, forces(3,64), stress(3,3)

!>-- spawn the server, blocks until the model is loaded
call mlip_init(1, 54321, &
    "fmlip-relay-server --port 54321 --backend mace --model /path/model.model", &
    60, ierr)

!>-- evaluate as often as needed (Å in, eV, eV/Å, eV/ų out)
pbc = [1, 1, 1]
call mlip_compute(1, 64, atomic_numbers, pos, cell, pbc, 1, &
                  energy=energy, forces=forces, stress=stress, ierr=ierr)

!>-- shut the server down
call mlip_finalize(1, ierr)

Documentation

The full documentation lives at pprcht.github.io/fmlip-relay:

Page Content
Installation Python package and extras, CMake, Meson, linking into your own code
Fortran client The fmlip_relay_client API, parallel instances with OpenMP and MPI
Server fmlip-relay-server modes and the complete option reference
Backends Supported models, their options and dependencies
Wire protocol Byte layout of requests and responses
Development Adding a backend, running the tests, building the docs
Troubleshooting Common failure modes

The same pages are readable as Markdown in docs/.

License

MIT © Philipp Pracht

Metadata

Release files for fmlip-relay 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fmlip-relay 0.1.0
File Size Uploaded Provenance Actions
fmlip_relay-0.1.0.tar.gz 54.9 kB With provenance Details for fmlip_relay-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fmlip-relay 0.1.0
File Interpreter ABI Platform Actions
fmlip_relay-0.1.0-py3-none-any.whl Python 3 none any Details for fmlip_relay-0.1.0-py3-none-any.whl

Total release size: 106.6 kB

Release files / fmlip_relay-0.1.0.tar.gz

Download URL fmlip_relay-0.1.0.tar.gz
Size 54.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a2acb95bb2d4c0be798e1a0cc2459a7b967fd1d56567ce631da803255e86c79c
BLAKE2b-256 checksum
How to use checksums
63017e5fd2ed10eb2493ae27638185966f881194408da1137c0ecddf166e13a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / fmlip_relay-0.1.0-py3-none-any.whl

Download URL fmlip_relay-0.1.0-py3-none-any.whl
Size 51.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b13592cd0127b2ef6bfe2e712b52a11925383c2f7472e2f5bab723195e8739a
BLAKE2b-256 checksum
How to use checksums
43a8a3740cd90b490f910adf670b2325133a0f630d67a105e8ba1be343d281af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Security for fmlip-relay 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fmlip_relay-0.1.0.tar.gz

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 Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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