NANI
k-means initialization
Deterministic k-means seeding that finds metastable states the first time.
- Picks diverse centroids from high-density regions
- Same cluster populations across replicates
MDANCE is a toolkit of n-ary clustering algorithms for molecular dynamics. It compares all frames at once, so your analysis scales linearly and gives the same answer every run.
8 algorithms · 9 peer-reviewed papers in JCTC, JCIM & Digital Discovery · NIH-funded
Modern simulations generate terabytes of conformations. Most clustering tools still reason about them two at a time.
Pairwise methods compare every frame with every other frame. Double the trajectory, quadruple the work.
A full RMSD matrix for a million-frame trajectory runs to terabytes before clustering even starts.
Random seeding means different clusters on every run, so reviewers and collaborators get different answers.
MDANCE does 50,000× less work at this size.
On the same 75,000-frame trajectory, HELM finishes in about 2 minutes. Classic hierarchical clustering (HAC) needs 29 hours. Press play to watch the race.
Source: HELM paper, J. Chem. Inf. Model. 2025. Same 75,000-frame trajectory for both methods; the clock is sped up.
Every method shares the same n-ary similarity core, so each one is O(N), deterministic, and avoids pairwise matrices.
k-means initialization
Deterministic k-means seeding that finds metastable states the first time.
Hybrid hierarchical
The speed of k-means with the flexibility of a full hierarchy.
Divisive hierarchical
Top-down splitting that explores every resolution in a single pass.
Online clustering
Cluster frames as they stream in, with merge tests calibrated to RMSD.
Pathway clustering
Find the dominant transition pathways hiding in enhanced-sampling runs.
Pathway representation
Summarize each pathway by its structural medoids, then compare them all.
Flat clustering
Radial threshold clustering, rebuilt to run in linear time.
Native structure prediction
Retrieve the native fold from your ensemble, within 2 Å of experiment.
Drop the N×N RMSD matrix. Cluster full-length trajectories on a laptop or a single node, with results you can reproduce.
Go from simulations to biology: dominant transition pathways, metastable states, and native structures that match experiment.
Screen conformational ensembles at scale. Linear cost and deterministic output fit production pipelines and audits.
Learn modern MD analysis with step-by-step tutorials and notebooks.
Start with NANI →pip install to clusters in 60 seconds.One command. Pure Python, built on NumPy, scikit-learn and MDAnalysis.
Read AMBER, GROMACS or CHARMM output through MDAnalysis, or bring a NumPy array.
Start with NANI, then go further with HELM, DIVINE, SHINE or PRIME.
pip install mdance
# verify
python -c "import mdance; print(mdance.__version__)" import numpy as np
from sklearn.cluster import KMeans
from mdance import data
from mdance.cluster.nani import KmeansNANI
# Example trajectory: 6,001 frames x 50 backbone atoms
X = np.load(data.sim_traj_numpy)
# Deterministic NANI seeding: no random starts
nani = KmeansNANI(data=X, n_clusters=6, metric='MSD',
N_atoms=50, init_type='strat_reduced',
percentage=10)
centroids = nani.initiate_kmeans()
# k-means from NANI's seeds: same labels every run
labels = KMeans(n_clusters=6, init=centroids,
n_init=1).fit(X).labels_ Each algorithm in MDANCE is described and validated in its own paper.
@article{chen_k-means_2024,
title = {k-Means NANI: An Improved Clustering Algorithm for Molecular Dynamics Simulations},
author = {Chen, Lexin and Roe, Daniel R. and Kochert, Matthew and Simmerling, Carlos and Miranda-Quintana, Ram{\'o}n Alain},
journal = {Journal of Chemical Theory and Computation},
year = {2024},
doi = {10.1021/acs.jctc.4c00308},
} Also cite the paper for each algorithm you use.
Free, open source, and one command away.
Have a hard dataset or a research idea? Open an issue or reach out to collaborate.