Skip to main content

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deepmd-torchsim 0.1.1
File Size Uploaded
deepmd_torchsim-0.1.1.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for deepmd-torchsim 0.1.1
File Interpreter ABI Platform
deepmd_torchsim-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / deepmd_torchsim-0.1.1.tar.gz

Download URL deepmd_torchsim-0.1.1.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
46a6f4bfca5c5eeba056c69cdaa7de90e44c3f93cbd9982a6c70e30bd7222f97
BLAKE2b-256 checksum
How to use checksums
ef4d93d493c586ad067512b56df64065fb5bfb73b68fa199431b13b508b98efe
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.1-py3-none-any.whl

Download URL deepmd_torchsim-0.1.1-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
90ff397e531025d7b7ee9d3c1c53faba1e16206fc4a99482b10562a680842221
BLAKE2b-256 checksum
How to use checksums
8e54009934d9d6925297bdae0a9a9604863fafeeb38e5b9ff6551267c7cf8a2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page