DRIDmetric is a Python package to calculate the first three moments of the Distribution of Reciprocal Interatomic Distances (DRID) for molecular dynamics (MD) trajectories.
The DRID representation is a structure-preserving dimensionality reduction method that captures essential kinetic and structural information, making it highly suitable for clustering, free energy landscape analysis, and kinetic modeling.
- Compute frame-wise DRID vectors from MD trajectories
- Based on reciprocal interatomic distances to emphasize short-range contacts
- Extract first three moments of distance distributions for selected centroids:
- Mean (μ)
- Variance (ν)
- Skewness (ξ)
- Simple integration with MDAnalysis
- Outputs results as NumPy arrays for direct use in clustering or ML pipelines
Given:
- a set of m centroids
$C={c_i}_{i=1}^m$ , - a set of N reference atoms
$A={a_j}_{j=1}^{N}$ , excluding covalently bound neighbors,
the distribution of reciprocal distances is defined by:
The first three moments for centroid (i) are:
where $ n_b^i $ is the number of covalent bonds for centroid
The DRID vector of a frame is then a 3m-dimensional vector:
The distance metric between two conformations
Install directly within your environment
pip install git+http://github.com/MoSchaeffler/DRIDmetric.git#egg=DRIDmetricor clone and install in editable mode
git clone https://github.com/MoSchaeffler/DRIDmetric.git
cd DRIDmetric
pip install -e .This installs:
numpytqdmMDAnalysis
from DRIDmetric import DRID
DRID(
top: str,
traj: str,
atom_selection: str,
centroid_selection: str,
)Parameters
-
top(str)
Topology file (e.g.,.gro,.tpr,.pdb, …). -
traj(str)
Trajectory file (e.g.,.xtc,.trr,.dcd, …). -
centroid_selection(str)
MDAnalysis selection string defining centroid atoms, e.g.:
"(name CA and resid 28) or (name CA and resid 23) or (name CA and resid 1) ..." -
atom_selection(str)
MDAnalysis selection string for the reference atom group (atoms compared to the centroids), e.g.:
"protein"
Notes
• Covalently bonded neighbors of each centroid are automatically excluded from its reference set.
• The class iterates frames oftraj, computing ((\mu,\nu,\xi)) per centroid and saving an array of shape(n_frames, n_centroids, 3).
run(outname: str = "DRID") -> np.array
Computes DRID for all frames and saves a NumPy fileoutname.npy.
Minimal Example
from DRIDmetric import DRID
# Input files
top = "/path/to/your/topology.tpr"
traj = "/path/to/your/trajectory.xtc"
# MDAnalysis selections
sel_atoms = "protein"
sel_cent = "(name CA and resid 1) or (name CA and resid 11) or (name CA and resid 21)"
drid = DRID(top, traj, sel_atoms, sel_cent)
drid.run("DRID_output")Please refer to the example for detailed usage instructions
If you use this package, please cite:
- Schäffler, Wales, & Strodel (2024) Chem. Commun.
“The energy landscape of Aβ42: a funnel to disorder for the monomer becomes a folding funnel for self-assembly.”
Background on DRID:
- Zhou & Caflisch (2012) J. Chem. Theory Comput.
- Chakraborty, Straub & Thirumalai (2023) Sci. Adv.