deepmd-torchsim
A torch-sim ModelInterface implementation
for DeePMD-kit's PyTorch backend.
Install
The package (DeepmdModel, torch-sim ModelInterface wrapper) can be installed with either pip and uv:
# from PyPI (once published) or a local checkout
pip install deepmd-torchsim
uv pip install deepmd-torchsim
uv add deepmd-torchsim
# editable, from a local checkout
pip install -e .
uv pip install -e .
Getting a working deepmd-kit backend
pip install "deepmd-torchsim[deepmd]"
uv pip install "deepmd-torchsim[deepmd]"
The deepmd extra pins an working deepmd-kit==3.1.3, with torch==2.10.0.
Usage
import torch
from deepmd_torchsim import DeepmdModel
import torch_sim as ts
from ase.build import molecule
model = DeepmdModel(
model_path="frozen_model.pth",
device=torch.device("cuda" if torch.cuda.is_available() else "cpu"),
compute_forces=True,
compute_stress=True,
)
state = ts.io.atoms_to_state([molecule("H2O")], model.device, model.dtype)
results = model(state)
print(results["energy"]) # [n_systems]
print(results["forces"]) # [n_atoms, 3]
print(results["stress"]) # [n_systems, 3, 3]
For multitask/multi-domain foundation checkpoints (e.g. DPA-3), pass head=
to select which trained domain to evaluate with:
model = DeepmdModel(model_path="DPA-3.1-3M.pt", head="Omat24")
Tests
pytest tests/
License
This project is licensed under the MIT License.
Author
Rahul Verma
Email: rverma7@ncsu.edu
Metadata
Release files for deepmd-torchsim 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| deepmd_torchsim-0.1.0.tar.gz | 9.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| deepmd_torchsim-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.8 kB
Release files / deepmd_torchsim-0.1.0.tar.gz
| Download URL | deepmd_torchsim-0.1.0.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
663118dd32f98bcb36300ef57ba21bbac59dc4a32d76efbb1a51deb154ef84d2
|
|
BLAKE2b-256 checksum How to use checksums |
a72dc3f400c94776e99a3e5e941f4724be7954b7b04e92aaa65e2e29a3a3e9e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / deepmd_torchsim-0.1.0-py3-none-any.whl
| Download URL | deepmd_torchsim-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1aefa222fbd1391d51f78373508e5200fb5e6d355ad5affa7000d221277071b8
|
|
BLAKE2b-256 checksum How to use checksums |
f686769e1817b92a5f5e76955a746dcf700fac5d8d4a4d0ed41c3b7642310935
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|