Skip to main content
TorchANI 2 logo

License: MIT PyPI PyPI - Downloads CI Code style: black

TorchANI 2 is an open-source library that supports training, development, and research of ANI-style neural network interatomic potentials. It was originally developed and is currently maintained by the Roitberg group. For information and examples, please see the comprehensive documentation.

⚠️ Important: If you were using a previous version of TorchANI and your code does not work with TorchANI 2 check out the migration guide, there are very few breaking changes, most code should work with minimal modifications. If you can't figure something out please open a GitHub issue, we are here to help! In the meantime, you can pin torchani to version 2.2.4 (pip install 'torchani==2.2.4'), which does not have breaking changes. If you require the old state dicts of ANI models you can access them by calling .legacy_state_dict() instead of .state_dict()

If you find a bug in TorchANI 2, or have a feature request, also feel free to open a GitHub issue. TorchANI 2 is currently tested against PyTorch 2.13 and CUDA 13.0

If you find this work useful please cite the following articles:

To run molecular dynamics (full ML or ML/MM) with Amber (sander or pmemd) check out the TorchANI-Amber interface, and the relevant publications:

Installation

We recommend installing torchani inside a conda|mamba environment, or a venv.

⚠️ Important: We recommend you install torchani with pip``uvyou want the latest version, even if using a conda env. The torchani conda package may be out of date.

We also recommend you first install a specific torch version, with a specific CUDA toolkit backend, for example:

pip install torch==2.13 --index-url https://download.pytorch.org/whl/cu130

for the version with CUDA 13.0. This is not strictly required, but is easier if you want to control these versions. TorchANI 2 requires PyTorch >= 2.0. Afterwards run:

pip install torchani

TorchANI 2 provides C++ and CUDA extensions for accelerated computation of descriptors and network inference. In order to build the extensions, first install the CUDA Toolkit appropriate for your PyTorch version. You can follow the instructions in the official documentation for your system. Alternatively, if you are using a conda environment, you can install the toolkit with conda install nvidia::cuda-toolkit=13.0

After this, run:

ani build-extensions

By default the extensions are built for all detected SMs. If you want to build the extensions for specific SMs run for instance:

ani build-extensions --sm 8.0 --sm 8.9 

From source (GitHub repo)

To build and install TorchANI 2 directly from the GitHub repo do the following:

# Clone the repo and cd to the directory
git clone https://github.com/aiqm/torchani.git
cd ./torchani

# Create a conda (or mamba) environment
# environment.yaml contains optional dependencies
# for building the extensions and documentation, and running tests and tools.
# You can comment these out if you are not planning to do that
conda env create -f ./environment.yaml

Instead of using a conda environment you can use a python venv, and install the torchani optional dependencies running pip install -r dev_requirements.txt.

pip install --no-deps -v -e .

Afterwards you can build and install the extensions (highly recommended) with:

ani build-extensions

After this you can perform some optional steps if you installed the required dev dependencies:

# Download files needed for testing and building the docs (optional)
bash ./download-dev-data.sh

# Build the documentation (optional)
sphinx-build docs/src docs/build

# Manually run unit tests (optional)
cd ./tests
pytest -v .

This process works for most use cases, for more details regarding building the CUDA and C++ extensions refer to TorchANI 2 CSRC.

From source in macOS

There is no CUDA support on macOS and TorchANI 2 is untested with Apple Metal Performance Shaders (MPS). The environment.yaml file needs slight modifications if installing on macOS. Please consult the corresponding file and modify it before creating the conda environment.

GPU support

TorchANI 2 can be run in CUDA-enabled GPUs. This is highly recommended unless doing simple debugging or tests. If you don't run TorchANI 2 on a GPU, expect degraded performance. TorchANI 2 is untested with AMD GPUs (ROCm | HIP).

Command Line Interface

TorchANI 2 provides an executable script, ani, with some utilities. Check usage by calling ani --help.

Metadata

Release files for torchani 2.14.0

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

Source distribution (sdist)

Source distribution for torchani 2.14.0
File Size Uploaded Provenance Actions
torchani-2.14.0.tar.gz 5.1 MB With provenance Details for torchani-2.14.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for torchani 2.14.0
File Interpreter ABI Platform Actions
torchani-2.14.0-py3-none-any.whl Python 3 none any Details for torchani-2.14.0-py3-none-any.whl

Total release size: 5.7 MB

Release files / torchani-2.14.0.tar.gz

Download URL torchani-2.14.0.tar.gz
Size 5.1 MB
Tags Source
SHA-256 checksum
How to use checksums
0b0d17797cd5ce303bb1b007401599cd195c96121672b8d3ca3d463daab7846e
BLAKE2b-256 checksum
How to use checksums
5a7d2ec5867b5f82d32f3fa426e2346907e4b5b86d506e2820a84e95c7b25ada
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / torchani-2.14.0-py3-none-any.whl

Download URL torchani-2.14.0-py3-none-any.whl
Size 542.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b41b42a9f6ae25a1ba3c605446c18789aa514e3d2c24fc42ede493dbd9d1e24
BLAKE2b-256 checksum
How to use checksums
290068a346d0ea11afa4611216f22a991f19e02cd9907c167c0705e31d12f490
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for torchani 2.14.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for torchani-2.14.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.14.0 This release

2 release files Full provenance

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