Bayesic Force Fields
Bayesic Force Fields (BFF) learns fixed-charge force-field parameters for GROMACS by Bayesian inference. It runs classical MD for many sampled parameter sets, compares quantities of interest (QoIs) such as RDFs or free energy profiles with a reference simulation, fits Gaussian-process surrogates to them, and samples the posterior distribution of the parameters.
Workflow
Each step is one command with one YAML config:
bff build build and equilibrate the GROMACS systems
│
▼
reference MD outside BFF: AIMD or an MLIP (see below)
│
▼
bff sample-parameters draw parameter sets, run classical MD for each
│
▼
bff build-qoi-datasets compute the QoIs of every sample and of the reference
│
▼
bff fit-lgp fit a Gaussian-process surrogate per QoI
│
▼
bff learn sample the posterior of the parameters (MCMC)
│
▼
bff validate rerun MD with posterior parameters
BFF does not generate the reference data. You run the reference simulation
yourself; we recommend ab initio MD or a machine-learned interatomic potential
(MLIP), ideally a foundation model fine-tuned for your system. For fine-tuning,
the repository provides
scripts/label_structures.py, which labels MD
frames with CP2K on Slurm. It is not installed by pip; download it from the
repository. See
Reference data.
Install
mamba create -n bfflearn python=3.10 pip
mamba activate bfflearn
pip install torch # pick the build for your CPU/GPU: https://pytorch.org/get-started/locally/
pip install bfflearn
The MD stages need GROMACS (with Colvars or PLUMED for biased systems).
Notebook examples need pip install "bfflearn[notebook]".
Quick start
bff examples # copy the examples matching your BFF version
cd examples/acetate # full workflow: aqueous acetate and calcium acetate
Every stage of the example is a directory with its config; run bff <stage> config.yaml inside it. The
acetate walkthrough
explains each step.
Learned parameters
| Parameter | Label in bounds |
|---|---|
| Partial charge | charge O1 O2 |
| Lennard-Jones sigma | sigma OW |
| Lennard-Jones epsilon | epsilon OW |
| Function-9 dihedral force constant | dihedraltype9_3_180 |
Names in one label share one value. Charges can be tied by residue- or system-level charge constraints.
Repository
BayesicForceFields/
├── bff/ the Python package and the `bff` command
│ ├── workflows/ one package per stage
│ ├── qoi/ QoI routines (rdf, hydrogen_bonds, custom) and datasets
│ ├── bayes/, mcmc/ surrogates, likelihoods, posterior sampling
│ └── domain/, io/ data models and file formats
├── examples/
│ ├── acetate/ full MD workflow with an RDF and a PMF
│ ├── arbitrary-data/ notebook: learn from your own tabular data
│ └── neon-mie-lgpmd/ notebook: learn from published RDFs
├── scripts/
│ └── label_structures.py CP2K labeling for MLIP fine-tuning (not installed by pip)
├── docs/ documentation site
└── tests/
Documentation
vojtechkostal.github.io/BayesicForceFields: how BFF works, all settings, examples, and development. See also the changelog, contributing, support, and security.
Citation
Kostal, V.; Shanks, B. L.; Jungwirth, P.; Martinez-Seara, H. Bayesian Learning for Accurate and Robust Biomolecular Force Fields. J. Chem. Theory Comput. 2026, 22 (5), 2652-2663. doi:10.1021/acs.jctc.5c02051
The code used for the paper is archived as
v0.0.1.
License
Metadata
Release files for bfflearn 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bfflearn-0.5.1.tar.gz | 262.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bfflearn-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 414.4 kB
Release files / bfflearn-0.5.1.tar.gz
| Download URL | bfflearn-0.5.1.tar.gz |
|---|---|
| Size | 262.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba8a3243e8140324a63fcd5aaee82d50e6bce6d00943bc99628fdc367e8043bd
|
|
BLAKE2b-256 checksum How to use checksums |
ebe92d58104bb2baf2dae552a2fc77f70f363c0332e215001e166fc90249eaed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 14, 2026.
Transparency logRelease files / bfflearn-0.5.1-py3-none-any.whl
| Download URL | bfflearn-0.5.1-py3-none-any.whl |
|---|---|
| Size | 151.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8191227aa1660743919af829a534a1a3c78062696d1f587cb96c13a7272f5a2
|
|
BLAKE2b-256 checksum How to use checksums |
7a58fb4f9fb9f2ff965ba4f86e06114fc2d5863834dbcae26290ea1f2db6ad85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 14, 2026.
Transparency log