Accelerated molecular dynamics with large-time-step predictions
Project description
FlashMD: universal long-stride molecular dynamics
This repository contains custom integrators to run MD trajectories with FlashMD models. These models are designed to learn and predict molecular dynamics trajectories using long strides, therefore allowing very large time steps. Before using this method, make sure you are aware of its limitations, which are discussed in this preprint.
The pre-trained models we make available are trained to reproduce ab-initio MD at the r2SCAN level of theory.
Quickstart
You can install the package with
pip install flashmd
After installation, you can run accelerated molecular dynamics with ASE as follows:
import ase.build
import ase.units
from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
import torch
from metatomic.torch.ase_calculator import MetatomicCalculator
from flashmd import get_pretrained
from flashmd.ase.langevin import Langevin
# Choose your time step (go for 10-30x what you would use in normal MD for your system)
time_step = 16 # 16 fs; also available: 1, 2, 4, 8, 32, 64, 128 fs
# Create a structure and initialize velocities
atoms = ase.build.bulk("Al", "fcc", cubic=True)
MaxwellBoltzmannDistribution(atoms, temperature_K=300)
# Load models
device="cuda" if torch.cuda.is_available() else "cpu"
energy_model, flashmd_model = get_pretrained("pet-omatpes", time_step)
calculator = MetatomicCalculator(energy_model, device=device)
atoms.calc = calculator
# Run MD
dyn = Langevin(
atoms=atoms,
timestep=time_step*ase.units.fs,
temperature_K=300,
time_constant=100*ase.units.fs,
model=flashmd_model,
device=device
)
dyn.run(1000)
[The first time you use this code and call the get_pretrained function, the
pre-trained models will be downloaded. This might take a bit.]
Other available integrators:
from flashmd.ase.velocity_verlet import VelocityVerlet
from flashmd.ase.bussi import Bussi
Disclaimer
This is experimental software and should only be used if you know what you're doing. We recommend using the i-PI integrators for any serious work and/or if you need to perform constant-pressure (NPT) molecular dynamics. You can see this cookbook recipe for a usage example. Given that the main issue we observe in direct MD trajectories is loss of equipartition of energy between different degrees of freedom, we recommend using a local Langevin thermostat, and to monitor the temperature of different atomic types or different parts of the simulated system.
Publication
If you found FlashMD useful, you can cite the corresponding article:
@article{FlashMD,
title={FlashMD: long-stride, universal prediction of molecular dynamics},
author={Bigi, Filippo and Chong, Sanggyu and Kristiadi, Agustinus and Ceriotti, Michele},
journal={arXiv preprint arXiv:2505.19350},
year={2025}
}
Reproducing the results in the article is supported with FlashMD v0.1.2:
pip install flashmd==0.1.2 ase==3.24.0 pet-mad==1.4.3
and using the "PET-MAD" models (PBEsol) from https://huggingface.co/lab-cosmo/flashmd. Note that the results were obtained through the i-PI interface.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flashmd-0.2.1.tar.gz.
File metadata
- Download URL: flashmd-0.2.1.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d8c4ca189a9a3a624d3f0ac3cca6890a853480a86b047a257d3c95539ea0ab9
|
|
| MD5 |
1a24c017c279d6c245fa35935273d73e
|
|
| BLAKE2b-256 |
658e18cff194af5955c1f480ba5936ed922bb060fe8bf493d7ce5e697448b724
|
File details
Details for the file flashmd-0.2.1-py3-none-any.whl.
File metadata
- Download URL: flashmd-0.2.1-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdafe1615bb61217a398bcbe79d72426e0194ec41f3c3dcbe873584fe14fc568
|
|
| MD5 |
24d2cb229b651b3406f87f9e226c4205
|
|
| BLAKE2b-256 |
520b52875acf60d2a3cc296c9e7e9251662897eed1f15e39d5115ae651930918
|