Skip to main content

Bayesic Force Fields

BFF logo

Docs Paper Release License

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

GNU GPL v3

Metadata

Release files for bfflearn 0.5.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 bfflearn 0.5.0
File Size Uploaded
bfflearn-0.5.0.tar.gz 261.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bfflearn 0.5.0
File Interpreter ABI Platform
bfflearn-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 412.3 kB

Release files / bfflearn-0.5.0.tar.gz

Download URL bfflearn-0.5.0.tar.gz
Size 261.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0d995338d85f32ee5c5426b8907ada20d01f8529535530c19c7eebb8359f8ae2
BLAKE2b-256 checksum
How to use checksums
87b736ba59dc8198fea25c8c9f3ac610802b3aedadc078eb58b55b7570323203
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 9, 2026.

Transparency log

Release files / bfflearn-0.5.0-py3-none-any.whl

Download URL bfflearn-0.5.0-py3-none-any.whl
Size 151.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c6d840b1ac187f44e66255ddfb821fcc807e0264ce595fc21714aeb59974cd5
BLAKE2b-256 checksum
How to use checksums
b73b3f8a39fce2a807b5b76995eb3b6fa77964e8cbe7b6d9be9dc5b10fde7752
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 9, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.1

2 release files

This release

0.5.0 This release

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release 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