Skip to main content

Franken fine-tuning scheme for ML potentials

Project description

Franken

Test status Docs status

Introduction

Franken is an open-source library that can be used to enhance the accuracy of atomistic foundation models. It can be used for molecular dynamics simulations, and has a focus on computational efficiency.

franken features include:

  • Supports fine-tuning for a variety of foundation models (MACE, SevenNet, SchNet)
  • Automatic hyperparameter tuning simplifies the adaptation procedure, for an out-of-the-box user experience.
  • Several random-feature approximations to common kernels (e.g. Gaussian, polynomial) are available to flexibly fine-tune any foundation model.
  • Support for running within LAMMPS molecular dynamics, as well as with ASE.
Franken diagram

For detailed information and benchmarks please check our paper Fast and Fourier Features for Transfer Learning of Interatomic Potentials.

Documentation

A full documentation including several examples is available: https://franken.readthedocs.io/index.html. The paper also contains a comprehensive description of the methods behind franken.

Install

To install the latest release of franken, you can simply do:

pip install franken

Several optional dependencies can be specified, to install packages required for certain operations:

  • cuda includes packages which speed up training on GPUs (note that franken will work on GPUs even without these dependencies thanks to pytorch).
  • fairchem, mace, sevenn install the necessary dependencies to use a specific backbone. Note that Fairchem v2 introduced breaking changes, so use v1 for SchNet support.
  • docs and develop are only needed if you wish to build the documentation, or work on extending the library.

They can be installed for example by running

pip install franken[mace,cuda]

For more details read the relevant documentation page

Quickstart

Train

You can directly run franken.autotune to get started with the franken library.

franken.autotune \
    --train-path train.xyz \
    --val-path val.xyz \
    --backbone=mace --mace.path-or-id "mace_mp/small" --mace.interaction-block 2 \
    --rf=ms-gaussian --ms-gaussian.num-rf 4096 --ms-gaussian.length-scale-num 5\
    --ms-gaussian.length-scale-low 1  --ms-gaussian.length-scale-high 32 \
    --force-weight=0.99 \
    --l2-penalty="(-10, -6, 5, log)" \
    --metrics energy_MAE forces_MAE \
    --jac-chunk-size "auto"

For more details you can check out the autotune tutorial or the getting started notebook.

Inference/MD

The trained model can be used as a ASE (Atomistic Simulations Environment) calculator for easy inference.

from franken.calculators import FrankenCalculator
calc = FrankenCalculator('best_model.ckpt', device='cuda:0')
atoms.calc = calc

See the MD tutorial for a complete example about running molecular dynamics, while for deploying it to LAMMPS see the dedicated page.

Citing

If you find this library useful, please cite our work using the folowing bibtex entry:

@article{novelli2025fast,
  title={Fast and Fourier features for transfer learning of interatomic potentials},
  author={Novelli, Pietro and Meanti, Giacomo and Buigues, Pedro J and Rosasco, Lorenzo and Parrinello, Michele and Pontil, Massimiliano and Bonati, Luigi},
  journal={npj Computational Materials},
  volume={11},
  number={1},
  pages={293},
  year={2025},
  publisher={Nature Publishing Group UK London}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

franken-0.5.0.tar.gz (114.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

franken-0.5.0-py3-none-any.whl (120.1 kB view details)

Uploaded Python 3

File details

Details for the file franken-0.5.0.tar.gz.

File metadata

  • Download URL: franken-0.5.0.tar.gz
  • Upload date:
  • Size: 114.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for franken-0.5.0.tar.gz
Algorithm Hash digest
SHA256 d5942af17fc56174e56e7f40223dc2ecd1903481816e461537c8b80e993b9e83
MD5 32d5d0d80300e853d9911748c063e548
BLAKE2b-256 656894f141f57401c7c64e840a2e735b414027944c649e41888dd69e1f5024d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for franken-0.5.0.tar.gz:

Publisher: CI.yaml on CSML-IIT-UCL/franken

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file franken-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: franken-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 120.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for franken-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a9eff18451444276ef6cda6caa37897ed07d18a70c4baf21ae4a533e35def6e
MD5 1252465a52a1740b9e213454f3558f9c
BLAKE2b-256 25f7b3d8975783203105e58852fcf5021cf017f2805413f4107ecbdd1030b06e

See more details on using hashes here.

Provenance

The following attestation bundles were made for franken-0.5.0-py3-none-any.whl:

Publisher: CI.yaml on CSML-IIT-UCL/franken

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page