MDANSE (Molecular Dynamics Analysis for Neutron Scattering Experiments) is a free and open-source Python software package for analysing molecular dynamics (MD) trajectories and computing observables that can be compared directly with neutron scattering experiments. It is the successor of nMOLDYN, developed from 1995 to 2022.
History
MOLDYN (1983) MOLDYN is a FORTRAN 77 program by D. J. Craik, S. Kumar, and D. E. Levy, published in 1983, for computing NMR spin-relaxation parameters from molecular dynamics models. Its core operation — evaluating time correlation functions from MD trajectories and comparing them with spectroscopic data — established the template that nMOLDYN and MDANSE later applied to neutron scattering.
nMOLDYN (1995–2022) nMOLDYN was created by Gérald Kneller, Volker Keiner, Meinhard Kneller, and Matthias Schiller at the CNRS Centre de Biophysique Moléculaire in Orléans, France, and first published in 1995. The name adds the prefix "n" (for neutron) to MOLDYN. The program provided an interactive shell for computing neutron scattering-oriented time correlation functions from MD trajectories, using FFT algorithms throughout. In 2003, Tomasz Róg, Krzysztof Murzyn, Konrad Hinsen, and Gérald Kneller rewrote nMOLDYN in Python, extending its scope and adding a graphical user interface (GUI). This version relied on Hinsen's Molecular Modelling Toolkit (MMTK) for trajectory handling and stored data in NetCDF format. In 2012, Hinsen, Éric Pellegrini, Sławomir Stachura, and Kneller released nMoldyn 3, which introduced task-farming parallelisation for multicore desktops and distributed-memory clusters. The final release of nMOLDYN 3, version 3.0.12, appeared in August 2022; the project is now in maintenance-only status, still available at GitHub. Because of its dependence on Python 2 and the MMTK library, porting nMOLDYN to Python 3 was not pursued by its original authors.
MDANSE (2017–present) MDANSE grew out of nMOLDYN at the Institut Laue-Langevin (ILL) in Grenoble, France. Gaël Goret, Bachir Aoun, and Éric Pellegrini published the first description in 2017. Development then shifted to the ISIS Neutron and Muon Source (STFC, UK), which maintains the project jointly with the ILL. Versions up to 1.5.2 (April 2021) were Python 2-based. A major rewrite targeting Python 3 was released as MDANSE 2.0.0 in April 2024.
Features MDANSE accepts MD trajectories from a wide range of simulation codes, including GROMACS, LAMMPS, CASTEP, VASP, CP2K, DL_POLY, CHARMM, NAMD, and others, converting them to HDF5 format; output can additionally be exported as plain text. The software computes more than 40 molecular properties grouped into five categories:
Scattering Coherent and incoherent intermediate scattering functions I(Q,τ) dynamic structure factors S(Q,ω) elastic incoherent structure factors (EISF) van Hove functions static structure factors Dynamics Velocity autocorrelation functions density of states mean-square displacements (MSD) angular velocity autocorrelation functions reorientational correlation functions memory functions Structure Radial distribution functions coordination numbers spatial density maps Thermodynamics Kinetic and potential energy distributions Infrared IR absorption spectra derived from dipole autocorrelation functions A separate PyPI package, MDANSE_GUI, provides an interactive graphical front-end that supports running multiple analyses concurrently and visualising results within the same session. MDANSE can also be driven from Python scripts without the GUI.
Implementation MDANSE is written entirely in Python and distributed via PyPI (pip install MDANSE). It relies on NumPy, SciPy, and h5py for numerical work and trajectory storage, and uses MDAnalysis, ASE, and mdtraj as optional back-ends for trajectory conversion. The original MPI parallelisation inherited from nMOLDYN 3 was retained in the 1.x series. The 2.x series, which requires Python 3.10 or later, introduced a redesigned internal architecture, a new plotting interface, and TOML-based settings.
Related software MDANSE and nMOLDYN share their scientific scope with several other programs. Sassena is a C++/MPI tool optimised for petascale parallel computation of X-ray and neutron scattering from very large MD trajectories. LiquidLib provides similar scattering calculations in a Python framework. VMD, MDAnalysis, and TRAVIS are general-purpose MD analysis packages that also compute some scattering-relevant quantities.
References
