Build, simulate, analyze and visualize atomistic systems in one Python package.
Documentation · Quick tour · Lessons · Examples · Install · Tests · Cite
MDAPY 2.0 is a complete rewrite and is not compatible with MDAPY 1.x. It brings many more features, and we recommend upgrading: From MDAPY 1.x gives the 2.0 way of each common call. The code of 1.x stays on the branch
1.x.
If you like MDAPY, please give it a ⭐ star.
💡 Why MDAPY
- All in one. One package and one
System, from the first structure through the simulation and the analysis to the last picture. MDAPY has its own molecular dynamics engine, potentials and ray tracer, on the processor and on NVIDIA GPUs, so that a study needs no other program. - Light. NumPy and polars are its only requirements. Packages such as matplotlib or ASE are optional, and it carries no other third-party code.
- Robust. Tests cover more than 99 % of the code and compare each feature with analytic results and with mature software. All of them run automatically on Linux, macOS and Windows. Results are the same for any number of threads, and damaged files or impossible inputs give a clear error, not a crash.
- Fast. The heavy parts run in C++, on a parallel engine of MDAPY's own, and molecular dynamics runs whole on an NVIDIA GPU. See the benchmarks.
- Interoperable. It converts systems to and from ASE, OVITO, pymatgen and freud, takes any ASE calculator or LAMMPS interaction, runs its dynamics in LAMMPS when asked, shares a process with PyTorch, and works as one step of high-throughput calculations.
- Predictable. Names say what the code does:
minimize,elastic_constants,CommonNeighborAnalysis. ASystemnever changes in place, every analysis has the formcompute(system)and returns NumPy arrays, and one unit system, Å, eV and ps, runs through everything. - Stable. From 2.0.0 on, nothing is taken away: every function, parameter and result stays until 3.0, a name that moves to another module warns two minor releases before its old import goes, and a result changes only to fix a bug, named in the release notes. See Compatibility.
- Documented. Every feature has its own page, with an example, its parameters, its results and its references, and lessons lead from the first structure on.
⚛️ Molecular dynamics
MDAPY runs molecular dynamics with its own engine, on the processor or entirely on an NVIDIA GPU; the same calls run in LAMMPS too. It is made for materials and machine-learned potentials: metals, alloys, semiconductors, glasses and liquids, with EAM, MEAM, ADP, Tersoff, Stillinger–Weber or NEP, or any model with an ASE calculator. Molecular force fields, with bonds and angles, are not its aim. Its features serve mechanical and thermal simulations:
- Ensembles: NVE, NVT, NPT and NPH, with Nosé–Hoover chains or Langevin dynamics.
- Controls: held, moved and pushed groups of atoms, heat baths, adaptive time steps and switching between potentials.
- Mechanical loading: tension, compression and shear, and indentation.
- Shock: pistons, the Hugoniostat and the multiscale shock technique.
- Heat: thermal conductivity by Green–Kubo, HNEMD and NEMD; free energies, melting points and phase diagrams.
from mdapy.build import build_crystal
from mdapy.calculators import EAM
from mdapy.simulation import MolecularDynamics
from mdapy.simulation.controls import Deform
crystal = build_crystal("fcc", 3.615, elements="Cu", repeat=(6, 6, 6))
copper = EAM.zhou(["Cu"]) # EAM.zhou(["Cu"], device="cuda") runs on the GPU
with MolecularDynamics(crystal, copper, timestep=0.002) as md:
md.velocities(300, seed=1)
md.run(2500, ensemble="npt", temperature=300, pressure=0.0)
md.run(2500, ensemble="nvt", temperature=300, controls=[Deform(xx=0.02)])
stress = md.thermo["stress"] # the stress as copper is stretched along x
See Molecular dynamics for what it can do and where each feature runs.
🧰 What it does
| Area | What is in it |
|---|---|
| Build | Crystals, polycrystals, alloys, defects and dislocations |
| Simulate | Its own molecular dynamics on the processor and NVIDIA GPUs: ensembles, controls, deformation, indentation and shock; energy minimization and minimum energy paths |
| Potentials | Native EAM, MEAM, ADP, Tersoff, Stillinger–Weber, Lennard-Jones, Morse and NEP; interfaces to LAMMPS and ASE |
| Properties | Defect energies, elastic constants, phonons, thermal conductivity, free energies, melting points and phase diagrams |
| Analyze | More than 40 analyses of structure, local order, defects and dynamics |
| MLIP | Training sets from VASP, descriptors, errors of a model, the frames worth computing |
| Visualize | Ray-traced pictures on the processor or the graphics card, movies and plots |
| Exchange | Eight file formats, and systems shared with ASE, OVITO, pymatgen and freud |
🎨 Examples
Click a picture for its example, with the whole code.
More in the documentation, from the quick tour on.
📦 Install
pip install mdapy
pip install "mdapy[cuda12]" # with the GPU part, on Linux with an NVIDIA GPU
MDAPY needs Python 3.11 or newer. Code written for 1.x keeps working with
pip install "mdapy<2", or moves to 2.0 as this guide shows. Installation
describes the other ways to install it, from a source archive or from git, what those need,
and the optional packages.
🧪 Tests
git clone https://github.com/mushroomfire/mdapy.git
cd mdapy
pip install -e ".[dev]"
pytest
Tests that need another program are skipped where it is missing. Contributing lists what a complete run needs.
📖 Citing MDAPY
If MDAPY contributes to a publication, please cite:
Yong-Chao Wu and Jian-Li Shao, mdapy: A flexible and efficient analysis software for molecular dynamics simulations, Computer Physics Communications 290, 108764 (2023). doi:10.1016/j.cpc.2023.108764
Papers citing MDAPY lists, by year, the papers that cite it.
📄 License
Mozilla Public License 2.0, see LICENSE: MDAPY may be used in any software, open or closed, and changes to its own files are shared under the same license.
📜 Code history
MDAPY has been written three times.
| Series | Years | How it was built | Code |
|---|---|---|---|
| 0.x | 2022–2025 | Python, with Taichi for the kernels | Branch mdapy_old, last release 0.11.5 |
| 1.x | 2025–2026 | Rewritten with every kernel in C++, and with NumPy and polars as its only requirements | Branch 1.x, last release 1.0.10, documentation |
| 2.x | 2026– | Rewritten again from scratch, for the reasons below | This branch |
Taichi was no longer updated, which also limited the versions of Python that 0.x could run on. 1.x was rewritten to be easy to update and maintain, and it needs only NumPy and polars, no longer SciPy and Taichi.
2.x goes further: it is easier to maintain, more stable and more consistent, lighter without external code, with many more features and a clearer organization. In particular:
- OpenMP. The OpenMP runtime of 1.x could clash with those of other packages. 2.x runs a thread pool of its own, so it shares a process with PyTorch and LAMMPS.
- Third-party code. 1.x carried ten third-party codes to build and keep working. 2.x carries none.
- The API. In 1.x an analysis was a method that changed the system. In 2.x a
Systemnever changes and every analysis is a class with one form. - Tests. Tests cover more than 99 % of the code and compare each feature with analytic results and with mature software, which makes 2.x more stable.
- Many small calculations. The threads can be limited for each process, so thousands of small calculations side by side do not fight for cores.
- Graphical interfaces. Long computations report their progress, can be cancelled and leave Python running, so a graphical interface is easy to build on 2.x.
Metadata
Release files for mdapy 2.2.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 | Provenance | Actions |
|---|---|---|---|---|
| mdapy-2.2.0.tar.gz | 929.6 kB | With provenance | Details for mdapy-2.2.0.tar.gz |
Built distributions (wheels)
Total release size: 13.7 MB
Release files / mdapy-2.2.0.tar.gz
| Download URL | mdapy-2.2.0.tar.gz |
|---|---|
| Size | 929.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41d79e3e31f987cc034e1db03af8f070f0586151a64809722485d763438b1733
|
|
BLAKE2b-256 checksum How to use checksums |
b2e1df283039d4c35b1ee7a854e949277eb2ec57967a6da5567f7a3280a3f133
|
| 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 22, 2026.
Transparency logRelease files / mdapy-2.2.0-cp312-abi3-win_amd64.whl
| Download URL | mdapy-2.2.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0dee736df9bd05b2c309f722d723c3f3574a2303b1bee17ad03076cfcd36c355
|
|
BLAKE2b-256 checksum How to use checksums |
1db418ea462894bc6adc30eef42cf7fe21cdc328abc1c726d7d334d4afba6853
|
| 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 22, 2026.
Transparency logRelease files / mdapy-2.2.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | mdapy-2.2.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
31955c83cf750a535c3b1e8f2f500a43eeae9ceecc5206e09cba403aba499063
|
|
BLAKE2b-256 checksum How to use checksums |
27e0c41db5d58c166f6c8287e22bae12185ffb831b61a89876e96ff45c8b13b3
|
| 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 22, 2026.
Transparency logRelease files / mdapy-2.2.0-cp312-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
| Download URL | mdapy-2.2.0-cp312-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
fd04f21397e1703bb02199422486347878d53813a3d45b8472883e66fd7ac91c
|
|
BLAKE2b-256 checksum How to use checksums |
2090c4190a9372e0cb7f2e3a5646635422a2b4d7818af713a8b5fa88648960aa
|
| 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 22, 2026.
Transparency logRelease files / mdapy-2.2.0-cp312-abi3-macosx_14_0_arm64.whl
| Download URL | mdapy-2.2.0-cp312-abi3-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.12 abi3 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a52aef8d28fc00e868d2b14a2d0fbfdf2da9699d0ddcd9167ca54e4c6b6394ae
|
|
BLAKE2b-256 checksum How to use checksums |
48bc8b931059dcadeb0330ed550e48b7aa3270a7ae6feeb3868b5f24c9f9cdfc
|
| 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 22, 2026.
Transparency logRelease files / mdapy-2.2.0-cp311-cp311-win_amd64.whl
| Download URL | mdapy-2.2.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e2815b6d9f844a72a90af40172a6f7c667600aa76b1b923f87bd3bc4e0c7e2dd
|
|
BLAKE2b-256 checksum How to use checksums |
9eef878a1cd1331aa41d18de8e982bad12fd0e260d5655c0d9a7ba10ac8c31b1
|
| 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 22, 2026.
Transparency logRelease files / mdapy-2.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | mdapy-2.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
61e73ccf00fd553d89c3f6f6f36849e4726e7acc45651e5b26374cefe6e9ce5d
|
|
BLAKE2b-256 checksum How to use checksums |
0b1ae1cdbb73ce83b07bb2519f8e49eeaedcc6c0ac7efa4c4e756a5479cd6aa7
|
| 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 22, 2026.
Transparency logRelease files / mdapy-2.2.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
| Download URL | mdapy-2.2.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
72ae5664dc35f80c814c24d24557997388293b7b1572ed0e5353e75716db899a
|
|
BLAKE2b-256 checksum How to use checksums |
dc5bcd7f339f51ad3fd705b3c490fd70652e08a72ae50aa39974ad290eec0ff2
|
| 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 22, 2026.
Transparency logRelease files / mdapy-2.2.0-cp311-cp311-macosx_14_0_arm64.whl
| Download URL | mdapy-2.2.0-cp311-cp311-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9a94e7d4debcf0611356578f3faf3f19169e777113a099d10ce81391e9f5ce96
|
|
BLAKE2b-256 checksum How to use checksums |
95f32d6a530bb1feed157183f06b88174b96606cb9c6584c5e34c54ceb7bfeb3
|
| 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 22, 2026.
Transparency logSecurity for mdapy 2.2.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
All 9 files in this release have been uploaded with provenance metadata.
Attestation for mdapy-2.2.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 22, 2026.
Transparency logA 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.