TorchMD
A molecular-dynamics engine written in PyTorch, for coupling simulation with machine learning.
Tool 034 of 100 in the MolForge directory of open-source tools. Every fact below was read from the repository's host on 2026-11-28.

What TorchMD is
TorchMD is a molecular dynamics engine written entirely in PyTorch, the deep-learning framework. Every quantity, from bonded energies to the Langevin integrator, is a tensor operation. This makes the simulation differentiable: gradients of a trajectory or an energy with respect to force-field parameters can be computed by automatic differentiation, so parameters can be fitted by the same optimisation used to train neural networks. It is a research tool for coupling simulation and machine learning rather than a production code.
A simulation is configured in a YAML file or Python code. Topologies and parameters come from AMBER prmtop or CHARMM psf files read through moleculekit and parmed, and the classical terms (bonds, angles, dihedrals, Lennard-Jones, electrostatics) are evaluated in PyTorch. External forces can be added, which is how neural network potentials from torchmd-net are plugged in, either alone or on top of a classical prior. Trajectories are written in XTC or NumPy format. Sister projects torchmd-net, torchmd-cg and torchmd-protein-thermodynamics cover model training and coarse-grained protein studies.
TorchMD is not meant for long all-atom simulations of large systems; OpenMM or GROMACS remain the engines for that.
Features
- Bonded, Lennard-Jones and electrostatic terms implemented as PyTorch tensor operations
- End-to-end differentiable with respect to parameters and coordinates
- Reads AMBER prmtop and CHARMM psf topologies through moleculekit
- External force interface for torchmd-net neural network potentials
- Langevin integrator, multiple replicas run in parallel on one GPU
- YAML configuration and XTC trajectory output
What it is for
- Train coarse-grained protein models by combining simulation with machine learning
- Run dynamics with a neural network potential inside a PyTorch workflow
- Fit force-field parameters by back-propagation through a simulation
- Teach how a molecular dynamics engine works, line by line
Verified facts
| Family | Classical molecular dynamics |
|---|---|
| Language or basis | Differentiable |
| Repository | https://github.com/torchmd/torchmd (GitHub) |
| Licence | MIT (SPDX identifier as declared in the repository) |
| Main language on GitHub | Python |
| Last commit | 2026-04-21 |
| Latest release | v1.1.2 (2026-01-07) |
| Stars | 724 on 2026-11-28 |
| Open issues and pull requests | 10 on 2026-11-28 |
| Repository created | 2020-02-12 |
| Verified | 2026-11-28 by MolForge's checking script, against the host's API |
Where TorchMD fits
Force-field simulation engines for biomolecules, materials and soft matter. AMBER is commercial (AmberTools is free) and NAMD is free under its own licence.
Questions people ask
- How is TorchMD different from OpenMM?
- OpenMM is a mature engine with compiled kernels, many integrators and broad file support. TorchMD is a compact engine in pure PyTorch whose point is differentiability and tight coupling with neural networks. Researchers use TorchMD to develop and train models, and often move finished potentials into OpenMM through OpenMM-Torch for production runs.
- What is torchmd-net and how does it relate to TorchMD?
- torchmd-net is a separate package from the same group for training neural network potentials such as TorchMD-Net equivariant transformer and tensor-network models. TorchMD is the dynamics engine that can call those trained models as external forces. The two are installed independently and are frequently used together.
- What input does TorchMD need?
- A topology with parameters in AMBER prmtop or CHARMM psf format, a coordinate file, and a YAML or Python configuration giving temperature, time step, number of steps, cut-offs and output settings. Coarse-grained systems can be set up directly from the bead definitions and a trained potential.
- Is TorchMD open source?
- Yes. The repository declares the MIT licence (SPDX identifier read from the host on 2026-11-28). Read the licence text in the repository before redistributing or embedding it.
- Where is the TorchMD source code?
- At https://github.com/torchmd/torchmd (GitHub). This is the address the host reported on the day of verification; renamed repositories are followed to their new home.
- Is TorchMD still maintained?
- The last commit was pushed on 2026-04-21 and the latest tagged release is v1.1.2 from 2026-01-07; the repository had 10 open issues and pull requests on 2026-11-28.
- Does MolForge use TorchMD?
- No. MolForge runs nine of the hundred tools in this directory (RDKit, OpenMM, AutoDock Vina, Open Babel, MDTraj, pymbar and NGL, plus PySCF and xTB in MFsig); TorchMD is listed because of its place in classical molecular dynamics, not because we run it.
Our comments on TorchMD
MolForge does not run TorchMD in production. This page is a verified pointer, not a review: the facts above come from the repository on the date shown, the description is ours, and we make no claim about accuracy or speed that we have not measured. If you maintain TorchMD and something here is wrong or out of date, write to hello@molforge.ai and we will correct the source file.
Test status
Not tested by MolForge. To check TorchMD yourself: clone the repository, follow the installation section of its README, and run the test suite the project ships before trusting a result; the last-commit date and the open issue count above tell you how alive the project is.