Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

MDAPY

Fast building, analysis, simulation and visualization of atomistic systems, in Python.

Tests Coverage Python 3.11 or newer Linux, macOS, Windows License: MPL-2.0 Paper: Comput. Phys. Commun. 290, 108764

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. The code of 1.x stays on the branch 1.x.

If you like MDAPY, please give it a ⭐ star.

💡 Why MDAPY

  • 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. See the benchmarks.
  • Predictable. Names say what the code does: minimize, elastic_constants, CommonNeighborAnalysis. A System never changes in place, every analysis has the form compute(system) and returns NumPy arrays, and one unit system, Å, eV and ps, runs through everything.
  • Integrated. One package and one System, from the first structure to the last picture. It converts systems to and from ASE, OVITO, pymatgen and freud, takes any ASE calculator or LAMMPS interaction, shares a process with PyTorch, and works as one step of high-throughput calculations.
  • 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.

🧰 What it does

Area What is in it
Build Crystals, polycrystals, alloys, defects and dislocations
Analyze More than 40 analyses of structure, local order, defects and dynamics
Simulate Native EAM and NEP, interfaces to LAMMPS and ASE; relaxation and dynamics; elastic constants, phonons, free energies, melting points and phase diagrams
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

One copper polycrystal, from nothing to a movie.

BuildGrains, 81,734 atoms
import mdapy as mp
from mdapy.build import build_crystal, build_polycrystal
from mdapy.visualization import render

copper = build_crystal("fcc", 3.615, elements="Cu")
grains = build_polycrystal(copper, mp.Box(100.0), 8, seed=1)
render(grains, "grains.png", color="grain")
A polycrystal colored by grain
AnalyzeThe atoms that are not fcc
from mdapy.identify import CommonNeighborAnalysis

structures = CommonNeighborAnalysis().compute(grains)
structures.counts()  # {'other': 21043, 'fcc': 60682, ...}
boundaries = structures.structure != 1  # not fcc
render(grains, "boundaries.png", atoms=boundaries, color=structures)
The grain boundaries of the polycrystal
SimulatePhonons of copper
from mdapy.calculators import EAM
from mdapy.lattice_dynamics import phonons, primitive_cell
from mdapy.simulation import minimize
from mdapy.visualization import plot

eam = EAM.zhou(["Cu"])
relaxed = minimize(copper, eam, cell="full", max_stress=1e-4)
cell = primitive_cell(relaxed.system)
bands = phonons(cell, eam).band_structure("fcc")
with plot.style():
    fig, ax = plot.figure()
    plot.band_structure(bands, ax=ax)
    plot.save(fig, "phonons", formats=("png",))
The phonon dispersion of copper
MLIPThe 20 frames most worth a DFT calculation
from mdapy import mlip

crystal = build_crystal("fcc", 3.615, elements="Cu", repeat=(3, 3, 3))
frames = mlip.perturb(crystal, 200, displacement=0.1, seed=1)
points = mlip.structure_descriptors(frames, mlip.SOAP(["Cu"]))
chosen = mlip.farthest_point_sampling(points, 20)

xy = mlip.principal_components(points).transform(points)
with plot.style():
    fig, ax = plot.figure()
    ax.scatter(*xy.T, s=4, color="0.7", label="all frames")
    ax.scatter(*xy[chosen].T, s=12, label="chosen")
    ax.set_xlabel("principal component 1")
    ax.set_ylabel("principal component 2")
    ax.legend()
    plot.save(fig, "frames", formats=("png",))
Frames on the map of their descriptors, with those chosen

Make a movie

A movie that flies through a copper polycrystal

See A movie that flies through a crystal for the whole script.

📦 Install

pip install --pre mdapy

The first release of 2.0 is a preview, and --pre asks pip for it: without it, pip installs 1.x. MDAPY needs Python 3.11 or newer. 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

📄 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 System never 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.0.0a1

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

Source distribution (sdist)

Source distribution for mdapy 2.0.0a1
File Size Uploaded Provenance Actions
mdapy-2.0.0a1.tar.gz 649.0 kB With provenance Details for mdapy-2.0.0a1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for mdapy 2.0.0a1
File Actions
mdapy-2.0.0a1-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for mdapy-2.0.0a1-cp312-abi3-win_amd64.whl
mdapy-2.0.0a1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for mdapy-2.0.0a1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
mdapy-2.0.0a1-cp312-abi3-macosx_14_0_arm64.whl CPython 3.12 abi3 macOS 14.0+ ARM64 Details for mdapy-2.0.0a1-cp312-abi3-macosx_14_0_arm64.whl
mdapy-2.0.0a1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for mdapy-2.0.0a1-cp311-cp311-win_amd64.whl
mdapy-2.0.0a1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for mdapy-2.0.0a1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
mdapy-2.0.0a1-cp311-cp311-macosx_14_0_arm64.whl CPython 3.11 CPython 3.11 macOS 14.0+ ARM64 Details for mdapy-2.0.0a1-cp311-cp311-macosx_14_0_arm64.whl

Total release size: 8.2 MB

Release files / mdapy-2.0.0a1.tar.gz

Download URL mdapy-2.0.0a1.tar.gz
Size 649.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4047491f4521359bb48390a36a20103307d5c37a3d43e02491b377766a3e48e5
BLAKE2b-256 checksum
How to use checksums
7745856bbb5485aebcebb9a6581d027228ced497e74ff1fc2da0b9c67a51e748
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 4, 2026.

Transparency log

Release files / mdapy-2.0.0a1-cp312-abi3-win_amd64.whl

Download URL mdapy-2.0.0a1-cp312-abi3-win_amd64.whl
Size 1.3 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2d305cf9f0c02153880720bf11d75a91fae43431c61cb2a615ed742fac0d2c6a
BLAKE2b-256 checksum
How to use checksums
86720b496f296cba18afd75cd32d259c9d874b3b2dbd2f325564c2b1572a57a7
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 4, 2026.

Transparency log

Release files / mdapy-2.0.0a1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL mdapy-2.0.0a1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.4 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
c45c08402a4d92797a63582781ac8fca59211a05863431b037ddfa72c29e7068
BLAKE2b-256 checksum
How to use checksums
c38b7bdcc32cd508e781e2cef653a182b1ff0063e85d877635081f9043129dd4
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 4, 2026.

Transparency log

Release files / mdapy-2.0.0a1-cp312-abi3-macosx_14_0_arm64.whl

Download URL mdapy-2.0.0a1-cp312-abi3-macosx_14_0_arm64.whl
Size 1.1 MB
Tags CPython 3.12 abi3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
535fa0578ca48a3a45e4ecffac8c058431f0a164ed04a5a99ed57711fe4b38bf
BLAKE2b-256 checksum
How to use checksums
9c9116295177359b904145529121744a7fd5812c55156406ec92053722aec5d0
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 4, 2026.

Transparency log

Release files / mdapy-2.0.0a1-cp311-cp311-win_amd64.whl

Download URL mdapy-2.0.0a1-cp311-cp311-win_amd64.whl
Size 1.3 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
e202566c09724cbfef87cd3ca49b463523f2bc80c36061c2d2f8ddc2005c6575
BLAKE2b-256 checksum
How to use checksums
fd2843dcd26da1a009d55477d21b53f416f5ab5739d1430fff8d2215e29191f8
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 4, 2026.

Transparency log

Release files / mdapy-2.0.0a1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL mdapy-2.0.0a1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
452b1b3f1fdf56ea80e9d3fd33341b1c919182e5940430ff86d435ab2bf64f45
BLAKE2b-256 checksum
How to use checksums
172be4a2699f57d0f666d4e709596aeb50da5cc987f83f2be890be16e50bb6a5
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 4, 2026.

Transparency log

Release files / mdapy-2.0.0a1-cp311-cp311-macosx_14_0_arm64.whl

Download URL mdapy-2.0.0a1-cp311-cp311-macosx_14_0_arm64.whl
Size 1.1 MB
Tags CPython 3.11 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
edbf496aa44cd1884713d4034b2394d5ab120e851ce3ec34619100cbd46a1e4f
BLAKE2b-256 checksum
How to use checksums
a2155dfa9ae004c1123af46b60d66746c1d937d87e9839c2119efbccc563e38a
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 4, 2026.

Transparency log

Security for mdapy 2.0.0a1

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 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for mdapy-2.0.0a1.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 4, 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
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