flashmd


Nameflashmd JSON
Version 0.2.2 PyPI version JSON
download
home_pageNone
SummaryAccelerated molecular dynamics with large-time-step predictions
upload_time2025-10-24 19:58:09
maintainerNone
docs_urlNone
authorflashmd developers
requires_python>=3.9
licenseApache-2.0
keywords machine learning molecular modeling molecular dynamics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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](http://arxiv.org/abs/2505.19350).

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

```bash
  pip install flashmd
```

After installation, you can run accelerated molecular dynamics with ASE as follows:

```py
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)
atoms.set_velocities(atoms.get_velocities() - atoms.get_velocities().mean(axis=0))

# 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:

```py
  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](https://atomistic-cookbook.org/examples/flashmd/flashmd-demo.html) 
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:

```bash
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.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "flashmd",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "machine learning, molecular modeling, molecular dynamics",
    "author": "flashmd developers",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/e6/60/bc8fbc67ddac62803f09cb031dda7c1c8668b3cd323859f86d443a123c9d/flashmd-0.2.2.tar.gz",
    "platform": null,
    "description": "FlashMD: universal long-stride molecular dynamics\n=================================================\n\nThis repository contains custom integrators to run MD trajectories with FlashMD models. These models are\ndesigned to learn and predict molecular dynamics trajectories using long strides, therefore allowing\nvery large time steps. Before using this method, make sure you are aware of its limitations, which are\ndiscussed in [this preprint](http://arxiv.org/abs/2505.19350).\n\nThe pre-trained models we make available are trained to reproduce ab-initio MD at the r2SCAN level of theory.\n\nQuickstart\n----------\n\nYou can install the package with\n\n```bash\n  pip install flashmd\n```\n\nAfter installation, you can run accelerated molecular dynamics with ASE as follows:\n\n```py\nimport ase.build\nimport ase.units\nfrom ase.md.velocitydistribution import MaxwellBoltzmannDistribution\nimport torch\nfrom metatomic.torch.ase_calculator import MetatomicCalculator\n\nfrom flashmd import get_pretrained\nfrom flashmd.ase.langevin import Langevin\n\n\n# Choose your time step (go for 10-30x what you would use in normal MD for your system)\ntime_step = 16  # 16 fs; also available: 1, 2, 4, 8, 32, 64, 128 fs\n\n# Create a structure and initialize velocities\natoms = ase.build.bulk(\"Al\", \"fcc\", cubic=True)\nMaxwellBoltzmannDistribution(atoms, temperature_K=300)\natoms.set_velocities(atoms.get_velocities() - atoms.get_velocities().mean(axis=0))\n\n# Load models\ndevice=\"cuda\" if torch.cuda.is_available() else \"cpu\"\nenergy_model, flashmd_model = get_pretrained(\"pet-omatpes\", time_step)  \n\ncalculator = MetatomicCalculator(energy_model, device=device)\natoms.calc = calculator\n\n# Run MD\ndyn = Langevin(\n    atoms=atoms,\n    timestep=time_step*ase.units.fs,\n    temperature_K=300,\n    time_constant=100*ase.units.fs,\n    model=flashmd_model,\n    device=device\n)\ndyn.run(1000)\n```\n\n[The first time you use this code and call the `get_pretrained` function, the\npre-trained models will be downloaded. This might take a bit.]\n\nOther available integrators:\n\n```py\n  from flashmd.ase.velocity_verlet import VelocityVerlet\n  from flashmd.ase.bussi import Bussi\n```\n\nDisclaimer\n----------\n\nThis is experimental software and should only be used if you know what you're doing.\nWe recommend using the i-PI integrators for any serious work and/or if you need to perform\nconstant-pressure (NPT) molecular dynamics. You can see\n[this cookbook recipe](https://atomistic-cookbook.org/examples/flashmd/flashmd-demo.html) \nfor a usage example.\nGiven that the main issue we observe in direct MD trajectories is loss of equipartition\nof energy between different degrees of freedom, we recommend using a local Langevin\nthermostat, and to monitor the temperature of different atomic types or different\nparts of the simulated system. \n\n\nPublication\n-----------\n\nIf you found FlashMD useful, you can cite the corresponding article:\n\n```\n@article{FlashMD,\n  title={FlashMD: long-stride, universal prediction of molecular dynamics},\n  author={Bigi, Filippo and Chong, Sanggyu and Kristiadi, Agustinus and Ceriotti, Michele},\n  journal={arXiv preprint arXiv:2505.19350},\n  year={2025}\n}\n```\n\nReproducing the results in the article is supported with FlashMD v0.1.2:\n\n```bash\npip install flashmd==0.1.2 ase==3.24.0 pet-mad==1.4.3\n```\n\nand using the \"PET-MAD\" models (PBEsol) from https://huggingface.co/lab-cosmo/flashmd.\nNote that the results were obtained through the i-PI interface.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Accelerated molecular dynamics with large-time-step predictions",
    "version": "0.2.2",
    "project_urls": null,
    "split_keywords": [
        "machine learning",
        " molecular modeling",
        " molecular dynamics"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e0a7bb8302ca306f4a3fd6edeb4c5290ee1e1302ca1abc67f6a28b1e4786e082",
                "md5": "41bbcdd020ea214a1f27d4c0fc91cdca",
                "sha256": "9e4e8c7a550c3c91c554c0fe06f6a1c1fa0205646605ee45833c3f416bd577af"
            },
            "downloads": -1,
            "filename": "flashmd-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "41bbcdd020ea214a1f27d4c0fc91cdca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 16800,
            "upload_time": "2025-10-24T19:58:08",
            "upload_time_iso_8601": "2025-10-24T19:58:08.110013Z",
            "url": "https://files.pythonhosted.org/packages/e0/a7/bb8302ca306f4a3fd6edeb4c5290ee1e1302ca1abc67f6a28b1e4786e082/flashmd-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e660bc8fbc67ddac62803f09cb031dda7c1c8668b3cd323859f86d443a123c9d",
                "md5": "c7f47ee9156384a45b5d1b2db135b2f7",
                "sha256": "647c7e253399d96972f40b73e50774d9cc5c4e4984d4da42737ae1a85dbb744e"
            },
            "downloads": -1,
            "filename": "flashmd-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c7f47ee9156384a45b5d1b2db135b2f7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 15622,
            "upload_time": "2025-10-24T19:58:09",
            "upload_time_iso_8601": "2025-10-24T19:58:09.576847Z",
            "url": "https://files.pythonhosted.org/packages/e6/60/bc8fbc67ddac62803f09cb031dda7c1c8668b3cd323859f86d443a123c9d/flashmd-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-24 19:58:09",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "flashmd"
}
        
Elapsed time: 0.97938s