Library / SDK
aiqm/torchani avatar
aiqm/torchani

TorchANI 2.0: training and running ANI-style neural network potentials in PyTorch

TorchANI 2.0 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.

559 stars139 forksPythonMIT

At a glance

What is it?
TorchANI 2.0 is the Roitberg group's MIT-licensed library for building, training and deploying ANI-style neural network interatomic potentials. Its value is a PyTorch-native implementation with optional C++ and CUDA extensions, and its main friction points are the compiled extension build and a GPU-only performance story.
Who is it for?
Adopt TorchANI 2.0 if you are already in the PyTorch ecosystem and need to train or modify ANI-style potentials rather than only consume a frozen model, and if you have a CUDA 13.0-capable GPU plus the matching toolkit to run ani build-extensions. Do not adopt it if your work is CPU-only, AMD-based, or macOS-first: the README states performance degrades without a GPU, ROCm and HIP are untested, and macOS has no CUDA support with MPS untested.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 10 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The gap TorchANI 2.0 fills: ANI potentials as editable PyTorch code

ANI-style potentials are neural networks that predict energies and forces from local atomic environments, and the practical question for a research group is rarely whether the approach works. It is whether the model can be opened, retrained on new chemistry, and wired into an existing training loop. TorchANI 2.0 answers that by being a library rather than a model distribution. The README describes it as supporting training, development and research of ANI-style neural network interatomic potentials, originally developed and currently maintained by the Roitberg group, with the source in Python and the whole thing under MIT. That licence choice matters for anyone embedding it in a commercial or closed workflow, because it removes the copyleft question entirely. The audience is therefore narrower than a general molecular dynamics user. If you want a potential you can call and never touch, you are not the target. If you want to inspect the descriptor computation, swap a loss, or fine-tune on your own quantum chemistry data, you are.

Descriptors, networks and the C++/CUDA extension path

The architecture visible in the material is a two-stage pipeline. Descriptors are computed from atomic coordinates, then a neural network maps those descriptors to energies, and forces come from differentiating that result. The README states that TorchANI 2.0 provides C++ and CUDA extensions for accelerated computation of descriptors and network inference, which tells you where the maintainers found the cost: the descriptor stage and the forward pass, not the training loop itself. Those extensions are not shipped prebuilt in the pip package as far as the README indicates. They are compiled on your machine through the ani command line tool, which is the main structural commitment of the project. Everything runs on PyTorch tensors, so autograd handles gradients, and the model objects expose standard state_dict semantics. The README notes that TorchANI 2.0 is currently tested against PyTorch 2.13 and CUDA 13.0, and that the 2.x line requires PyTorch >= 2.0. Treat those as the tested envelope, not a guarantee that older combinations fail.

Installing TorchANI 2.0 and building the extensions

The README is explicit that pip is the supported route even inside a conda environment, because the conda package is currently not maintained. The recommended sequence pins PyTorch first so the CUDA backend is under your control:

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

Then, with a CUDA Toolkit matching your PyTorch build installed (the README suggests conda install nvidia::cuda-toolkit=13.0 as one option), you build the compiled pieces:

ani build-extensions

By default this targets all detected SMs. To restrict the build, the README gives ani build-extensions --sm 8.0 --sm 8.9. From a GitHub clone the flow is conda env create -f ./environment.yaml, then pip install --no-deps -v -e ., then ani build-extensions again. Optional developer steps include bash ./download-dev-data.sh, sphinx-build docs/src docs/build, and pytest -v . from the tests directory. The environment.yaml carries optional dependencies for the compiled extensions, the docs and the tests, and the README warns it needs modification on macOS. The CLI itself is discoverable with torchani --help.

The extension build is the failure mode to plan for

The single most likely place a TorchANI 2.0 install goes wrong is ani build-extensions. It depends on a CUDA Toolkit that matches your PyTorch version, and the README's conda recipe notes assume the toolkit sits at /usr/local/cuda. If your toolkit is elsewhere or your driver and PyTorch CUDA versions disagree, the build is where you find out. There is no documented prebuilt wheel for the extensions in the material provided, so a fresh machine means a compiler toolchain and a toolkit install before any science happens. The second limitation is hardware. The README states that running on a CUDA-enabled GPU is highly recommended unless you are doing simple debugging or tests, and that without a GPU you should expect degraded performance. It also states TorchANI is untested with AMD GPUs (ROCm or HIP), and that macOS has no CUDA support and is untested with Apple Metal Performance Shaders. For a group whose laptops are Apple silicon, that is a real constraint, not a footnote. A third friction point is the 2.0 transition itself: the README points to a migration guide, says most code should work with minimal modifications, and offers pip install 'torchani==2.2.4' as a pin for anyone who cannot migrate. Old checkpoints require .legacy_state_dict() instead of .state_dict().

Where TorchANI 2.0 sits next to other neural network potential toolkits

The closest comparison in the material is not another library but a sibling project from the same group: the TorchANI-Amber interface, which the README links for running molecular dynamics with sander or pmemd, including ML/MM. The difference in approach is clean. TorchANI 2.0 is the potential itself, a PyTorch library for training and inference. TorchANI-Amber is the coupling layer that lets a classical biomolecular simulation engine call that potential, which is what you need if your goal is a production MD trajectory rather than a trained model. If your work is small-molecule quantum chemistry benchmarking, you may not need the Amber side at all. If your work is solvated proteins with a classical force field plus an ML region, TorchANI 2.0 alone will not get you there. Broadly, the alternative to TorchANI 2.0 is any other ANI-family implementation or a general-purpose ML potential framework, and the honest differentiator here is the PyTorch tensor semantics and the compiled descriptor path. If you are not already writing PyTorch, that advantage evaporates and the extension build becomes pure overhead.

Maintenance, version pinning and the licence position

The release cadence visible in the material is tight: 2.8.5, 2.8.6 and 2.9.0 all landed within roughly two days in early September 2026, and the last push to main is dated 2026-09-06. Frequent patch releases are good for bug turnaround and awkward for anyone who pins loosely, so pin an exact version in your environment file and move deliberately. The project is not archived and the README invites bug reports and feature requests through GitHub issues, which is the maintenance channel you would be relying on. TorchANI 2.0 is MIT licensed, which permits commercial and closed-source use and modification; the README asks that you cite the two JCIM papers if the work is useful, which is a request rather than a licence condition. One practical upgrade cost to budget for is the compiled extension rebuild: a PyTorch or CUDA upgrade means re-running ani build-extensions, and the README's tested pairing (PyTorch 2.13, CUDA 13.0) is the combination least likely to surprise you. None of this is legal advice; read the MIT text yourself if the terms matter to your organisation.

Who should install TorchANI 2.0 and what to check first

TorchANI 2.0 fits a computational chemistry or ML group with CUDA hardware, an existing PyTorch codebase, and a reason to train or modify ANI-style potentials rather than only evaluate them. It does not fit a CPU-only cluster, an AMD GPU allocation, or a macOS-first team, given the stated untested status of ROCm, HIP and MPS and the degraded performance without a GPU. Before you commit, verify three things in this order. First, confirm your CUDA Toolkit version matches the PyTorch build you intend to install, because ani build-extensions is the step that will fail if they disagree. Second, read the migration guide and decide whether your existing code and checkpoints need .legacy_state_dict() or whether pinning torchani==2.2.4 is simpler for now. Third, check whether your actual goal is a trained potential or an MD trajectory, because the latter points at the TorchANI-Amber interface instead. If all three clear, the pip install plus ani build-extensions path is short and the MIT licence is unencumbered.

Editorial conclusion

Adopt TorchANI 2.0 if you are already in the PyTorch ecosystem and need to train or modify ANI-style potentials rather than only consume a frozen model, and if you have a CUDA 13.0-capable GPU plus the matching toolkit to run ani build-extensions. Do not adopt it if your work is CPU-only, AMD-based, or macOS-first: the README states performance degrades without a GPU, ROCm and HIP are untested, and macOS has no CUDA support with MPS untested. Before committing, check the migration guide for the state_dict change and confirm whether your existing checkpoints need .legacy_state_dict().

Official sources

  1. aiqm/torchani on GitHub
  2. License: MIT
  3. Project website
  4. README
  5. Releases
Community notes

Community notes