Skip to main content

MDCheck

CI PyPI version Python versions License: MIT DOI

Automated Convergence, Statistical Inefficiency, and Reproducibility Assessment for Molecular Dynamics Simulations.


Overview

MDCheck is an open-source scientific toolkit that solves a universal methodological need in biomolecular and materials simulations: certifying whether a molecular dynamics trajectory has converged, reached equilibrium, and accumulated sufficient statistically independent observations for publication.

Instead of manually inspecting plots or guessing equilibration cutoffs, mdcheck analyzes raw timeseries (GROMACS .xvg, LAMMPS log.lammps, OpenMM/AMBER/NAMD logs, .csv, .dat) with a single command and delivers:

  • 🎯 Automated Equilibration Detection ($t_{\text{eq}}$) via statistical inefficiency minimization.
  • ⏱️ Integrated Autocorrelation Time ($\tau_{\text{int}}$) & Statistical Inefficiency ($g$) using Madras-Sokal self-consistent windowing.
  • 🔢 Effective Sample Size ($N_{\text{eff}} = N / g$) and a 95% confidence interval of the mean corrected for autocorrelation ($\bar{x} \pm t_{N_{\text{eff}}-1}, s\sqrt{g/N}$), validated for nominal coverage on AR(1) processes and OpenMM trajectories (see validation/).
  • 🔄 Multi-Replica Consistency Test: Cochran's $Q$ heterogeneity test of replica means with autocorrelation-corrected standard errors (calibrated false-alarm rate), plus descriptive Jensen-Shannon, Kolmogorov-Smirnov and Wasserstein distances.
  • 📉 Linear drift and Geweke stationarity diagnostics and Flyvbjerg-Petersen block-averaging curves.
  • 🚦 Quality Certification Badges (PASS / WARNING / FAIL) with unambiguous diagnostic messages.
  • 📑 Publication-Ready Outputs: Interactive self-contained report.html, vector plots (SVG/PDF/PNG 300 DPI), LaTeX summary tables (.tex), and a draft Methods & Supporting Information text snippet with automated BibTeX citations.
  Simulations (.xvg, .csv, .dat)
               │
               ▼
  ┌───────────────────────────────────────────────────────────┐
  │                         MDCheck                           │
  │  ├── Auto Equilibration (max N_eff)                       │
  │  ├── Autocorrelation & Inefficiency (tau_int, g)          │
  │  ├── Multi-Replica Consistency (Cochran Q; JSD/KS/W1)     │
  │  └── Drift Detection & Block Averaging                    │
  └───────────────────────────────────────────────────────────┘
               │
               ▼
  ┌───────────────────────────────────────────────────────────┐
  │                   Publication Deliverables                │
  │  ├── report.html (Interactive Dashboard & Badges)         │
  │  ├── mdcheck_convergence_overview.pdf/svg/png             │
  │  ├── mdcheck_summary_table.tex / .csv                     │
  │  ├── methods_snippet.txt (Ready for Manuscript)           │
  │  └── citation.bib (BibTeX Reference)                      │
  └───────────────────────────────────────────────────────────┘

Installation

From PyPI

pip install mdcheck

From Source (Development Mode)

git clone https://github.com/sircalch/mdcheck.git
cd mdcheck
pip install -e .[dev]

Quickstart (CLI)

1. Test Demo Mode (Instant Synthetic Multi-Replica Simulation)

mdcheck demo -o my_demo_results/

Open my_demo_results/report.html in any web browser to see the interactive report!

2. Assess GROMACS XVG Trajectory

mdcheck assess -i rmsd.xvg gyrate.xvg energy.xvg -o md_quality_report/

3. Assess Multi-Replica Convergence (R1, R2, R3)

mdcheck assess -i rep1_rmsd.xvg -r rep2_rmsd.xvg rep3_rmsd.xvg -o replica_assessment/

Python API Usage

import numpy as np
from mdcheck import assess_trajectory_quality
from mdcheck.reporters import generate_publication_figures, generate_manuscript_assets, generate_html_report

# Load or define your timeseries (e.g. Backbone RMSD over 100 ns)
time_coords = np.linspace(0, 100, 2000)  # ns
rmsd_series = ... # 1D numpy array

# Assess simulation quality
report = assess_trajectory_quality(
    timeseries_dict={"Backbone_RMSD": rmsd_series},
    time_coords=time_coords
)

print(f"Overall Quality Status: {report.overall_status}")
print(f"Equilibration Time: {report.observables['Backbone_RMSD'].t_eq_time:.2f} ns")
print(f"Effective Sample Size (N_eff): {report.observables['Backbone_RMSD'].n_eff:.0f}")

# Export publication figures and LaTeX tables
generate_publication_figures({"Backbone_RMSD": rmsd_series}, time_coords, report, "output_dir/")
generate_manuscript_assets(report, "output_dir/")
generate_html_report(report, "output_dir/report.html")

Scientific Foundations & Methodology

1. Automated Equilibration Detection ($t_{\text{eq}}$)

The initial non-equilibrium transient phase is automatically identified by maximizing the total effective sample size in the subsequent production interval: $$\hat{t}{\text{eq}} = \arg\max{t_0} N_{\text{eff}}(t_0) = \arg\max_{t_0} \frac{N - t_0}{g(t_0)}$$

2. Autocorrelation & Statistical Inefficiency ($g$)

MD frames are temporally correlated. MDCheck computes the integrated autocorrelation time $\tau_{\text{int}}$ using the Madras-Sokal self-consistent cutoff window: $$\tau_{\text{int}} = \frac{1}{2} + \sum_{k=1}^{M} C(k), \quad M \ge 6 \tau_{\text{int}}$$ $$g = 2\tau_{\text{int}} = 1 + 2\sum_{k=1}^{M} C(k), \quad N_{\text{eff}} = \frac{N_{\text{prod}}}{g}$$

The 95% confidence interval of the production mean is $\bar{x} \pm t_{0.975,,N_{\text{eff}}-1}, s \sqrt{g / N_{\text{prod}}}$.

3. Multi-Replica Consistency

Replica means $m_i$ with autocorrelation-corrected standard errors $SE_i = s_i\sqrt{g_i/n_i}$ are compared with Cochran's heterogeneity statistic $$Q = \sum_i w_i (m_i - \bar{m}w)^2, \quad w_i = SE_i^{-2}, \quad Q \sim \chi^2{k-1}$$ Status is PASS for $p \ge 0.05$, WARNING for $0.01 \le p < 0.05$ and FAIL for $p < 0.01$. Histogram Jensen-Shannon distances are reported as descriptors only: between finite, autocorrelated samples of the same ensemble they are biased upwards (in the OpenMM validation every replica group exceeded the former 0.15 threshold). An RMSIP function for essential-subspace overlap is available in the API (subspace_overlap_rmsip).


Validation

validation/ reproduces a benchmark against pymbar 4.0.3, pyblock and ArviZ on two kinds of data: AR(1) processes, where g and the mean are known exactly, and 108 OpenMM trajectories of Lennard-Jones argon and TIP3P water (see validation/README.md).

Check Result
Statistical inefficiency, g = 1–199 matches the exact value and pymbar
95% CI coverage, AR(1) 0.90–0.99 (naive s/√N: 0.09–0.97; 1.0.0 bootstrap: 0.82–0.90)
Coverage vs. effective sample size nominal for N_eff ≳ 50; 0.87–0.93 below
Equilibration time vs. pymbar median difference 1–2 samples
Coverage on OpenMM replicas LJ 0.90; TIP3P 0.71–0.79 (100 ps) and 0.92–0.96 (300 ps)
Replica test, false alarms (LJ, 300 ps water) Cochran Q 3–15%; R̂ > 1.01 19–47%; JSD > 0.15 (1.0.0) 29–100%
Replica test, shift of 6 SE Cochran Q detects 98–99%

The one case below nominal coverage, 100 ps water replicas, happens because short runs underestimate g. Every estimator that uses only the series itself shares this limitation, and the replica test flags these cases. The changes made in response to the validation are listed in CHANGELOG.md.

Citation

If you use MDCheck to evaluate trajectory convergence, equilibration, statistical inefficiency, or replica reproducibility in your research, please cite:

@software{monreal2026mdcheck,
  author = {Monreal-Hern{\'a}ndez, Andr{\'e}s},
  title = {{MDCheck: Automated Convergence, Statistical Inefficiency, and Reproducibility Assessment for Molecular Dynamics Simulations}},
  year = {2026},
  version = {1.1.0},
  publisher = {Zenodo},
  doi = {10.5281/zenodo.22217568},
  url = {https://github.com/sircalch/mdcheck}
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for mdcheck 1.1.0

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

Source distribution (sdist)

Source distribution for mdcheck 1.1.0
File Size Uploaded Provenance Actions
mdcheck-1.1.0.tar.gz 38.4 kB With provenance Details for mdcheck-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mdcheck 1.1.0
File Interpreter ABI Platform Actions
mdcheck-1.1.0-py3-none-any.whl Python 3 none any Details for mdcheck-1.1.0-py3-none-any.whl

Total release size: 76.7 kB

Release files / mdcheck-1.1.0.tar.gz

Download URL mdcheck-1.1.0.tar.gz
Size 38.4 kB
Tags Source
SHA-256 checksum
How to use checksums
aaff9f24f573e98e31e68f5ac95f798f655f60a53aee1e5f550fa4929cf656fa
BLAKE2b-256 checksum
How to use checksums
41dca1c00b18dbbed260f7b2a95b6aa66909330acd02ed3b21d28a26852c822d
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 Oct 28, 2026.

Transparency log

Release files / mdcheck-1.1.0-py3-none-any.whl

Download URL mdcheck-1.1.0-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35e805724d9c3bdcc782277e16162222f70eca7c77a1c8617bb72719dcc08f3a
BLAKE2b-256 checksum
How to use checksums
7aee79a9aa56e4b33996a80372b36506b631f2cc954ac65b2bdf71c5f4cbb545
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 Oct 28, 2026.

Transparency log

Security for mdcheck 1.1.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mdcheck-1.1.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 Oct 28, 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.

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