A standalone library implementation of the GFN-FF method by S. Spicher and S. Grimme,
adapted from the xtb code (most recently at commit
6d44803 and validated against that version's results).
It is meant to be linked into other Fortran, C, and C++ projects, and it also ships Python bindings.
From this point forward, development may diverge from the upstream xtb implementation.
As of version v0.3.0 of this repository divergence is the case in order to add analytical Hessians and other features.
GFN-FF (Geometries, Frequencies, Non-covalent interactions Force-Field) is a completely automated, topology-based force field for fast structure optimisations and non-covalent interaction energies. The topology and parametrisation are derived entirely from the input geometry, without user-defined atom types or connectivity.
Quick start
pip install "gfnff[ase]"
from ase.build import molecule
from gfnff import GFNFF
atoms = molecule("caffeine")
atoms.calc = GFNFF()
energy = atoms.get_potential_energy() # eV
forces = atoms.get_forces() # eV / Å
The same install provides a command-line tool:
gfnff molecule.xyz --opt --alpb h2o
Documentation
The documentation is hosted at https://pprcht.github.io/gfnff/. It contains the guides listed below and a Python API reference generated from the docstrings.
| Topic | Page |
|---|---|
| Fortran, C and C++ interfaces, periodic systems, use as a CMake or Meson subproject | docs/library.md |
Python: installation, command-line tool, GFNFFCalculator, ASE calculator, Hessians |
docs/python.md |
Force-field versions, conformer2020, custom parameter files, user-supplied molecular graphs |
docs/parametrisation.md |
| Benchmarks and choice of BLAS backend | docs/performance.md |
| TOML parameter file format | param/README.md |
| Python API reference | pprcht.github.io/gfnff |
Building from source
The library requires a Fortran and C compiler (e.g. gfortran/gcc),
LAPACK/BLAS (e.g. OpenBLAS), and optionally OpenMP.
Both CMake (≥ 3.21) and Meson (≥ 0.59) are supported.
| CMake | Meson | |
|---|---|---|
| Build | cmake -B _buildcmake --build _build |
meson setup _buildninja -C _build |
| Test | cmake -B _build -DWITH_TESTS=ONcmake --build _buildctest --test-dir _build |
meson setup _build -Dtests=trueninja -C _build test |
The compiled library (libgfnff.a by default) is placed in the build directory
and can be linked into any downstream project.
Using the library
Initialise a calculator once (topology setup, the expensive step), then call the singlepoint routine as often as needed:
use gfnff_interface
type(gfnff_data) :: calc
call calc%init(nat, at, xyz, ichrg=ichrg, iostat=io)
call calc%singlepoint(nat, at, xyz, energy, gradient, iostat=io, sigma=sigma)
call calc%deallocate()
Coordinates are in Bohr, energies in Hartree, gradients in Eh/Bohr.
The C/C++ header include/gfnff_interface_c.h mirrors these calls;
see docs/library.md.
Performance
Caffeine clusters from 24 to 1536 atoms on 8 cores. Energy and gradient are 1.2–1.6x faster than the pre-refactor code from 192 atoms upwards, and the analytic Hessian is 28x (24 atoms) to 59x (768 atoms) faster than finite differences. Hessian speed depends mainly on the BLAS backend; details are in docs/performance.md.
References
- Molecular GFN-FF, a generic, partially polarisable force field covering organic, organometallic, and biochemical systems: S. Spicher, S. Grimme, Angew. Chem. Int. Ed. 2020, 59, 15665. doi:10.1002/anie.202004239
- Periodic boundary conditions and molecular crystals, with adjusted non-covalent interactions for lattice energies and unit-cell optimisations: S. Grimme, T. Rose, Z. Naturforsch. B 2024, 79, 191. doi:10.1515/znb-2023-0088
- Lanthanide and actinide extension, a reparametrised f-element treatment: T. Rose, M. Bursch, J.-M. Mewes, S. Grimme, Inorg. Chem. 2024. doi:10.1021/acs.inorgchem.4c03215
License
This project is licensed (as the original xtb code) under the GNU Lesser General Public License v3 or later.
See LICENSE for details.
Metadata
Release files for gfnff 0.3.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 | Provenance | Actions |
|---|---|---|---|---|
| gfnff-0.3.1.tar.gz | 935.5 kB | With provenance | Details for gfnff-0.3.1.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gfnff-0.3.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details for gfnff-0.3.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
| gfnff-0.3.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.27+ ARM64, Linux glibc 2.28+ ARM64 | Details for gfnff-0.3.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
| gfnff-0.3.1-py3-none-macosx_14_0_arm64.whl | Python 3 | none | macOS 14.0+ ARM64 | Details for gfnff-0.3.1-py3-none-macosx_14_0_arm64.whl |
Total release size: 36.1 MB
Release files / gfnff-0.3.1.tar.gz
| Download URL | gfnff-0.3.1.tar.gz |
|---|---|
| Size | 935.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a542e17e1de49bec6a7940ee168ac8bd45e930733d2f59ececea8d324978aec
|
|
BLAKE2b-256 checksum How to use checksums |
fa043cdec879566b04ea5274c9560b86dbfb070189dc6642816c13b89e566354
|
| 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 / gfnff-0.3.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | gfnff-0.3.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 17.8 MB |
| Tags | Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
fa5834e42d82bc2cf5586447e8a01bac9d3238901c138a848b90cb53106680f2
|
|
BLAKE2b-256 checksum How to use checksums |
ec25ab5c7032ef60fcdf05110c12126b030f9b16929c3723676b8254869574be
|
| 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 / gfnff-0.3.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
| Download URL | gfnff-0.3.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 10.6 MB |
| Tags | Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
c295857186331fff415cbc6d758bb09afed435faabe304922094e3ea9118ae59
|
|
BLAKE2b-256 checksum How to use checksums |
4bb760dfea0c8b28c9d6ff1a1b30d4f23b78ff8ef7d9ed11c4a6dc570fde7811
|
| 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 / gfnff-0.3.1-py3-none-macosx_14_0_arm64.whl
| Download URL | gfnff-0.3.1-py3-none-macosx_14_0_arm64.whl |
|---|---|
| Size | 6.7 MB |
| Tags | Python 3 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
92f295deb63de7558c02941339db91235379b68c331fa2e6a6c9f657ac0ceb87
|
|
BLAKE2b-256 checksum How to use checksums |
33ec85aaafe51ec37879ca9d8fa72b275340c6d9d11ba269b700570040de3f5e
|
| 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 logSecurity for gfnff 0.3.1
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
All 4 files in this release have been uploaded with provenance metadata.
Attestation for gfnff-0.3.1.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 Oct 14, 2026.
Transparency logA 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.