Name | torch-sim-atomistic JSON |
Version |
0.3.0
JSON |
| download |
home_page | None |
Summary | A pytorch toolkit for calculating material properties using MLIPs |
upload_time | 2025-08-13 22:10:48 |
maintainer | None |
docs_url | None |
author | Abhijeet Gangan, Janosh Riebesell, Orion Cohen, Radical AI |
requires_python | >=3.11 |
license | The MIT License (MIT) Copyright 2025 Radical AI Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
chemistry
interatomic-potentials
machine-learning
materials-science
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# TorchSim
[](https://github.com/radical-ai/torch-sim/actions/workflows/test.yml)
[](https://codecov.io/gh/radical-ai/torch-sim)
[](https://python.org/downloads)
[](https://pypi.org/project/torch_sim_atomistic)
[][zenodo]
[zenodo]: https://zenodo.org/records/15127004
<!-- help docs find start of prose in readme, DO NOT REMOVE -->
TorchSim is a next-generation open-source atomistic simulation engine for the MLIP
era. By rewriting the core primitives of atomistic simulation in Pytorch, it allows
orders of magnitude acceleration of popular machine learning potentials.
* Automatic batching and GPU memory management allowing significant simulation speedup
* Support for MACE, Fairchem, SevenNet, ORB, MatterSim, graph-pes, and metatomic MLIP models
* Support for classical lennard jones, morse, and soft-sphere potentials
* Molecular dynamics integration schemes like NVE, NVT Langevin, and NPT Langevin
* Relaxation of atomic positions and cell with gradient descent and FIRE
* Swap monte carlo and hybrid swap monte carlo algorithm
* An extensible binary trajectory writing format with support for arbitrary properties
* A simple and intuitive high-level API for new users
* Integration with ASE, Pymatgen, and Phonopy
* and more: differentiable simulation, elastic properties, custom workflows...
## Quick Start
Here is a quick demonstration of many of the core features of TorchSim:
native support for GPUs, MLIP models, ASE integration, simple API,
autobatching, and trajectory reporting, all in under 40 lines of code.
### Running batched MD
<!-- tested in tests/test_runners::test_readme_example, update as needed -->
```py
import torch
import torch_sim as ts
# run natively on gpus
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# easily load the model from mace-mp
from mace.calculators.foundations_models import mace_mp
from torch_sim.models.mace import MaceModel
mace = mace_mp(model="small", return_raw_model=True)
mace_model = MaceModel(model=mace, device=device)
from ase.build import bulk
cu_atoms = bulk("Cu", "fcc", a=3.58, cubic=True).repeat((2, 2, 2))
many_cu_atoms = [cu_atoms] * 50
trajectory_files = [f"Cu_traj_{i}.h5md" for i in range(len(many_cu_atoms))]
# run them all simultaneously with batching
final_state = ts.integrate(
system=many_cu_atoms,
model=mace_model,
n_steps=50,
timestep=0.002,
temperature=1000,
integrator=ts.integrators.nvt_langevin,
trajectory_reporter=dict(filenames=trajectory_files, state_frequency=10),
)
final_atoms_list = final_state.to_atoms()
# extract the final energy from the trajectory file
final_energies = []
for filename in trajectory_files:
with ts.TorchSimTrajectory(filename) as traj:
final_energies.append(traj.get_array("potential_energy")[-1])
print(final_energies)
```
### Running batched relaxation
To then relax those structures with FIRE is just a few more lines.
```py
# relax all of the high temperature states
relaxed_state = ts.optimize(
system=final_state,
model=mace_model,
optimizer=ts.frechet_cell_fire,
autobatcher=True,
)
print(relaxed_state.energy)
```
## Speedup
TorchSim achieves up to 100x speedup compared to ASE with popular MLIPs.
<img src="/docs/_static/speedup_plot.svg" alt="Speedup comparison" width="100%">
This figure compares the time per atom of ASE and `torch_sim`. Time per atom is defined
as the number of atoms / total time. While ASE can only run a single system of `n_atoms`
(on the $x$ axis), `torch_sim` can run as many systems as will fit in memory. On an H100 80 GB card,
the max atoms that could fit in memory was ~8,000 for [EGIP](https://github.com/FAIR-Chem/fairchem),
~10,000 for [MACE-MPA-0](https://github.com/ACEsuit/mace), ~22,000 for [Mattersim V1 1M](https://github.com/microsoft/mattersim),
~2,500 for [SevenNet](https://github.com/MDIL-SNU/SevenNet), and ~9000 for [PET-MAD](https://github.com/lab-cosmo/pet-mad).
This metric describes model performance by capturing speed and memory usage simultaneously.
## Installation
### PyPI Installation
```sh
pip install torch-sim-atomistic
```
### Installing from source
```sh
git clone https://github.com/radical-ai/torch-sim
cd torch-sim
pip install .
```
## Examples
To understand how TorchSim works, start with the [comprehensive tutorials](https://radical-ai.github.io/torch-sim/user/overview.html) in the documentation.
## Core Modules
TorchSim's package structure is summarized in the [API reference](https://radical-ai.github.io/torch-sim/reference/index.html) documentation and drawn as a treemap below.

## License
TorchSim is released under an [MIT license](LICENSE).
## Citation
A manuscript is in preparation. Meanwhile, if you use TorchSim in your research, please [cite the Zenodo archive][zenodo].
Raw data
{
"_id": null,
"home_page": null,
"name": "torch-sim-atomistic",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "chemistry, interatomic-potentials, machine-learning, materials-science",
"author": "Abhijeet Gangan, Janosh Riebesell, Orion Cohen, Radical AI",
"author_email": "Abhijeet Gangan <abhijeetgangan@g.ucla.edu>, Janosh Riebesell <jriebesell@radical-ai.com>, Orion Cohen <orion@radical-ai.com>, Radical AI <info@radical.ai>",
"download_url": "https://files.pythonhosted.org/packages/e1/fb/80066336988abee3a299ae61c2aace3b8118b8f69b78e46029a20cc19a5c/torch_sim_atomistic-0.3.0.tar.gz",
"platform": null,
"description": "# TorchSim\n\n[](https://github.com/radical-ai/torch-sim/actions/workflows/test.yml)\n[](https://codecov.io/gh/radical-ai/torch-sim)\n[](https://python.org/downloads)\n[](https://pypi.org/project/torch_sim_atomistic)\n[][zenodo]\n\n[zenodo]: https://zenodo.org/records/15127004\n\n<!-- help docs find start of prose in readme, DO NOT REMOVE -->\nTorchSim is a next-generation open-source atomistic simulation engine for the MLIP\nera. By rewriting the core primitives of atomistic simulation in Pytorch, it allows\norders of magnitude acceleration of popular machine learning potentials.\n\n* Automatic batching and GPU memory management allowing significant simulation speedup\n* Support for MACE, Fairchem, SevenNet, ORB, MatterSim, graph-pes, and metatomic MLIP models\n* Support for classical lennard jones, morse, and soft-sphere potentials\n* Molecular dynamics integration schemes like NVE, NVT Langevin, and NPT Langevin\n* Relaxation of atomic positions and cell with gradient descent and FIRE\n* Swap monte carlo and hybrid swap monte carlo algorithm\n* An extensible binary trajectory writing format with support for arbitrary properties\n* A simple and intuitive high-level API for new users\n* Integration with ASE, Pymatgen, and Phonopy\n* and more: differentiable simulation, elastic properties, custom workflows...\n\n## Quick Start\n\nHere is a quick demonstration of many of the core features of TorchSim:\nnative support for GPUs, MLIP models, ASE integration, simple API,\nautobatching, and trajectory reporting, all in under 40 lines of code.\n\n### Running batched MD\n<!-- tested in tests/test_runners::test_readme_example, update as needed -->\n\n```py\nimport torch\nimport torch_sim as ts\n\n# run natively on gpus\ndevice = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n\n# easily load the model from mace-mp\nfrom mace.calculators.foundations_models import mace_mp\nfrom torch_sim.models.mace import MaceModel\nmace = mace_mp(model=\"small\", return_raw_model=True)\nmace_model = MaceModel(model=mace, device=device)\n\nfrom ase.build import bulk\ncu_atoms = bulk(\"Cu\", \"fcc\", a=3.58, cubic=True).repeat((2, 2, 2))\nmany_cu_atoms = [cu_atoms] * 50\ntrajectory_files = [f\"Cu_traj_{i}.h5md\" for i in range(len(many_cu_atoms))]\n\n# run them all simultaneously with batching\nfinal_state = ts.integrate(\n system=many_cu_atoms,\n model=mace_model,\n n_steps=50,\n timestep=0.002,\n temperature=1000,\n integrator=ts.integrators.nvt_langevin,\n trajectory_reporter=dict(filenames=trajectory_files, state_frequency=10),\n)\nfinal_atoms_list = final_state.to_atoms()\n\n# extract the final energy from the trajectory file\nfinal_energies = []\nfor filename in trajectory_files:\n with ts.TorchSimTrajectory(filename) as traj:\n final_energies.append(traj.get_array(\"potential_energy\")[-1])\n\nprint(final_energies)\n```\n\n### Running batched relaxation\n\nTo then relax those structures with FIRE is just a few more lines.\n\n```py\n# relax all of the high temperature states\nrelaxed_state = ts.optimize(\n system=final_state,\n model=mace_model,\n optimizer=ts.frechet_cell_fire,\n autobatcher=True,\n)\n\nprint(relaxed_state.energy)\n```\n\n## Speedup\n\nTorchSim achieves up to 100x speedup compared to ASE with popular MLIPs.\n\n<img src=\"/docs/_static/speedup_plot.svg\" alt=\"Speedup comparison\" width=\"100%\">\n\nThis figure compares the time per atom of ASE and `torch_sim`. Time per atom is defined\nas the number of atoms / total time. While ASE can only run a single system of `n_atoms`\n(on the $x$ axis), `torch_sim` can run as many systems as will fit in memory. On an H100 80 GB card,\nthe max atoms that could fit in memory was ~8,000 for [EGIP](https://github.com/FAIR-Chem/fairchem),\n~10,000 for [MACE-MPA-0](https://github.com/ACEsuit/mace), ~22,000 for [Mattersim V1 1M](https://github.com/microsoft/mattersim),\n~2,500 for [SevenNet](https://github.com/MDIL-SNU/SevenNet), and ~9000 for [PET-MAD](https://github.com/lab-cosmo/pet-mad).\nThis metric describes model performance by capturing speed and memory usage simultaneously.\n\n## Installation\n\n### PyPI Installation\n\n```sh\npip install torch-sim-atomistic\n```\n\n### Installing from source\n\n```sh\ngit clone https://github.com/radical-ai/torch-sim\ncd torch-sim\npip install .\n```\n\n## Examples\n\nTo understand how TorchSim works, start with the [comprehensive tutorials](https://radical-ai.github.io/torch-sim/user/overview.html) in the documentation.\n\n## Core Modules\n\nTorchSim's package structure is summarized in the [API reference](https://radical-ai.github.io/torch-sim/reference/index.html) documentation and drawn as a treemap below.\n\n\n\n## License\n\nTorchSim is released under an [MIT license](LICENSE).\n\n## Citation\n\nA manuscript is in preparation. Meanwhile, if you use TorchSim in your research, please [cite the Zenodo archive][zenodo].\n",
"bugtrack_url": null,
"license": "The MIT License (MIT) Copyright 2025 Radical AI Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u201cSoftware\u201d), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"summary": "A pytorch toolkit for calculating material properties using MLIPs",
"version": "0.3.0",
"project_urls": {
"Repo": "https://github.com/radical-ai/torch-sim"
},
"split_keywords": [
"chemistry",
" interatomic-potentials",
" machine-learning",
" materials-science"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "39fe44ca64f7433fe1fb85868761c80098c85898990e94fee9a2b4836d771173",
"md5": "966b514c1cd099c1a6f7f49964411f8e",
"sha256": "8cd1b0eaed28b400d6a368c5862f23af456bea3b332cb08a8e02b1131a5560e0"
},
"downloads": -1,
"filename": "torch_sim_atomistic-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "966b514c1cd099c1a6f7f49964411f8e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 184343,
"upload_time": "2025-08-13T22:10:47",
"upload_time_iso_8601": "2025-08-13T22:10:47.588454Z",
"url": "https://files.pythonhosted.org/packages/39/fe/44ca64f7433fe1fb85868761c80098c85898990e94fee9a2b4836d771173/torch_sim_atomistic-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e1fb80066336988abee3a299ae61c2aace3b8118b8f69b78e46029a20cc19a5c",
"md5": "e056afa5e5bc73371608211f384439dd",
"sha256": "20d5d9bf950392b1da40e0618d79e7d117a37cdd5e4312b3d03fd5f1f25d3e0a"
},
"downloads": -1,
"filename": "torch_sim_atomistic-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "e056afa5e5bc73371608211f384439dd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 158017,
"upload_time": "2025-08-13T22:10:48",
"upload_time_iso_8601": "2025-08-13T22:10:48.847435Z",
"url": "https://files.pythonhosted.org/packages/e1/fb/80066336988abee3a299ae61c2aace3b8118b8f69b78e46029a20cc19a5c/torch_sim_atomistic-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-13 22:10:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "radical-ai",
"github_project": "torch-sim",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "torch-sim-atomistic"
}