Adaptive Molecular Dynamics with Python
█████████ █████ ██████ ██████ ██████████
███░░░░░███ ░░███ ░░██████ ██████ ░░███░░░░███
████████ █████ ████ ░███ ░███ ███████ ░███░█████░███ ░███ ░░███
░░███░░███░░███ ░███ ░███████████ ███░░███ ░███░░███ ░███ ░███ ░███
░███ ░███ ░███ ░███ ░███░░░░░███ ░███ ░███ ░███ ░░░ ░███ ░███ ░███
░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ███
░███████ ░░███████ █████ █████░░████████ █████ █████ ██████████
░███░░░ ░░░░░███ ░░░░░ ░░░░░ ░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░░
░███ ███ ░███
█████ ░░██████
░░░░░ ░░░░░░
The Adaptive Molecular Dynamics with Excited Normal Modes (aMDeNM) method applies a kinetic excitation of normal modes (NMs) to enhance molecular dynamics simulations sampling. This technique consists in injecting additional atomic velocities along uniformily distributed combinations of NM vectors, creating an effective coupling between slow and fast molecular motions. The motions described by preselected directions of low-frequency NMs are dynamically adjusted throughout the simulation. By coupling low-frequency NM excitation with adaptive directional adjustments, aMDeNM facilitates extensive exploration of the energy landscape, overcoming the constraints of fixed, rectilinear displacements and alleviating structural stresses and environmental resistance. Importantly, aMDeNM requires only an initial structure without the need to specify predefined target states, distinguishing it from many biased sampling techniques that rely on predefined target conformations.
pyAdMD is a package designed to fully setup, run, and analyze aMDeNM simulations on a dedicated Python environment. This document provides an overview of the method and documents the package functionalities.
- Adaptive Molecular Dynamics with Python
- Method Overview
- Equilibration Molecular Dynamics
- CHARMM Normal Modes Analysis (Optional)
- ENM Computation
- Uniform Normal Modes Combination
- Kinetic Energy Control
- Excitation Direction Update
- ENM Recalculation and Subspace Harmonization
- Optional Transverse Diversification with Beta
- Purpose and relationship to alpha
- Coordinates and alpha-corrected direction
- Harmonizing the full reservoir
- Effective stiffness and transverse score
- Exclusion, selection, and sign continuity
- Final mixture and excitation energy
- Activation, constraints, and diagnostics
- Restart and state
- Invalid mode-count configurations
- pyAdMD Applications
- Configuration
- Input Requirements
- Free Energy Landscape
- Analysis
- Usage Examples
- Using OpenMM inputs and heavy atoms NMs
- Using NAMD inputs and Cα NMs with custom parameters
- Using NAMD inputs and CHARMM NMs without direction correction (standard MDeNM)
- Using ENM recalculation with harmonized subspace transport
- Using alpha harmonization with beta diversification
- Restart unfinished pyAdMD simulations
- Append 100 ps to previously finished pyAdMD simulations
- Analyze pyAdMD simulations (all frames)
- Analyze every 5 ps skipping DSSP and LMI
- Compute a free energy landscape
- Extend a previous free energy calculation with more centroids and production time
- Compute a standalone ENM (Cα model, writing modes 7-16)
- Re-write additional modes from a previous ENM run
- Clean previous setup files
- Installation
- Dependencies
- Citing
- License
- Contact
Method Overview
The aMDeNM is a enhanced sampling molecular dynamics method that uses normal modes as collective variables in order do increase the conformational space explored during MD simulation. This is done by injecting an incremental energy to the system, thus assigning additional atomic velocities along the direction of a given NM (or a combination of a NM set). The combination of the velocities from MD and those provided by the NM vectors properly couple slow and fast motions, allowing one to obtain large time scale movements, such as domain transitions in a feasible simulation time. The additional energy injection and the excitation direction are constantly evaluated and updated to ensure the sampling validity.
The aMDeNM production runs (the excitation cycles themselves) are computed with OpenMM using the CHARMM36m force field. GPU platforms (CUDA, then OpenCL) are preferred automatically, with a CPU fallback if neither is available. We strongly recommend that all system preparation be done with CHARMM-GUI.
Equilibration Molecular Dynamics
This is a prerequired step to perform aMDeNM simulations. It consists in performing a short equilibration MD to store the final atomic velocities and positions. Two equilibration input paths are supported, selected via -src/--source:
- NAMD (
-src NAMD): NAMD 3.0 binary files (.coor/.vel/.xsc) plus a CHARMM-style stream file containing the PBC geometry information (.str). - OpenMM (
-src OPENMM): OpenMM state supplied as an XML restart file (.rst) produced withXmlSerializer.serialize(state)from a state built withgetPositions=True, getVelocities=True.
CHARMM Normal Modes Analysis (Optional)
If using CHARMM-based normal modes, it is also necessary to compute the modes from the last MD coordinates and store the vectors from the low-frequency end of the vibrational spectrum on a binary file.
ENM Computation
Physical Motivation and Coarse-Graining
Proteins are not rigid bodies: their function is intimately connected to their internal dynamics, ranging from local side-chain rotations and loop fluctuations to large-scale collective domain motions. Classical molecular dynamics (MD) simulations can capture these phenomena in atomic detail, but they are computationally expensive and often struggle to reach the timescales (microseconds to milliseconds) relevant to biologically important conformational changes.
Elastic Network Models offer a powerful and computationally inexpensive alternative. The central insight behind ENMs is that the low-frequency, large-amplitude collective motions of a protein — those most relevant to function — are predominantly determined by the overall topology of the molecular structure, not by the precise details of atomic interactions. In other words, the shape of the molecule, encoded by which atoms or residues are spatially close to one another, largely dictates the repertoire of accessible motions.
This motivates a coarse-graining strategy: instead of representing every atom with a detailed force field, the protein is reduced to a set of representative interaction sites connected by harmonic springs. In the Cα model (also called ANM, the Anisotropic Network Model), each residue is represented by a single point placed at its α-carbon. In the heavy-atom model, all non-hydrogen atoms are retained, yielding a finer-grained representation at the cost of a larger Hessian matrix. The choice of model involves a tradeoff between computational cost and the resolution of the dynamical description.
Nucleic Acid Support (SBP Model)
Protein–nucleic acid complexes (e.g. transcription factors, ribonucleoproteins, ion channel–RNA interactions) are supported in both ENM models. In the heavy-atom model, nucleic acid heavy atoms (backbone and base) are included exactly like protein heavy atoms — no special handling needed. In the CA model, a single α-carbon has no nucleic acid analog, so pyadmd represents each nucleotide with a three-bead SBP (Sugar-Phosphate-Base) model instead of one point:
- P — phosphate (backbone)
- C1′ — sugar
- C2 — nitrogenous base
Each bead is assigned the mass of its representative element (phosphorus for P; carbon for C1′ and C2), following the same "uniform mass by representative atom" convention already used for protein Cα (uniform carbon mass). All beads — protein Cα and nucleic P/C1′/C2 alike — are then connected pairwise by the same distance-cutoff rule described in Network Construction below, so a protein–nucleic complex is built as one mixed-resolution network, not two separate ones.
Network Construction
Given a set of $N$ interaction sites (Cα atoms or heavy atoms) with equilibrium positions $\mathbf{r}_i^0$, the elastic network is constructed by connecting every pair of sites $i$ and $j$ whose equilibrium distance $r_{ij}^0 = |\mathbf{r}_i^0 - \mathbf{r}_j^0|$ falls within a specified cutoff distance $r_c$:
$$ r_{ij}^0 \leq r_c $$
Typical cutoff values are $10–15 Å$ for the Cα model and $7–12 Å$ for the heavy-atom model. The cutoff is a key parameter: too small a value yields a disconnected or sparse network that fails to capture long-range coupling, while too large a value over-densifies the network and can wash out functionally relevant fluctuation patterns.
The total potential energy of the system under the harmonic approximation is:
$$ V = \frac{1}{2} \sum_{i < j} k_{ij} \left(r_{ij} - r_{ij}^0\right)^2 $$
where $k_{ij}$ is the spring constant between sites $i$ and $j$, $r_{ij}$ is the instantaneous distance between them, and $r_{ij}^0$ is their equilibrium distance. In the simplest ANM formulation, a uniform spring constant $k_{ij} = k$ is used for all connected pairs. This is a deliberate simplification: the spring constant encodes the stiffness of the local environment, and setting it uniformly to $k$ (with default $k = 1.0 kcal/mol/Ų$) means the model's predictions are expressed in units relative to $k$. More sophisticated variants assign distance-dependent spring constants (e.g., $k_{ij} \propto (r_{ij}^0)^{-\alpha}$), but the uniform model already captures the essential topology of collective motions.
The Hessian Matrix
The dynamical properties of the network are encoded in the Hessian matrix $\mathbf{H}$, a $3N \times 3N$ symmetric matrix of second derivatives of the potential energy with respect to atomic displacements, evaluated at the equilibrium configuration:
$$ H_{i\alpha,, j\beta} = \frac{\partial^2 V}{\partial u_{i\alpha}, \partial u_{j\beta}}\Bigg|_{\mathbf{u}=0} $$
where $u_{i\alpha}$ is the displacement of site $i$ along Cartesian direction $\alpha \in \{x, y, z\}$, and similarly for $u_{j\beta}$. The factor of three degrees of freedom per site is what distinguishes this anisotropic (ANM) formulation from simpler isotropic models: the Hessian retains the full directional information of each pairwise spring, which is essential for producing oriented mode trajectories and the vector dot products required by the DCCM.
Carrying out the differentiation of the pairwise harmonic potential, the off-diagonal $3 \times 3$ super-element connecting sites $i \neq j$ is:
$$ \mathbf{H}{ij} = -\frac{k{ij}}{(r_{ij}^0)^2} \begin{pmatrix} \Delta x^2 & \Delta x \Delta y & \Delta x \Delta z \ \Delta y \Delta x & \Delta y^2 & \Delta y \Delta z \ \Delta z \Delta x & \Delta z \Delta y & \Delta z^2 \end{pmatrix} $$
where $\Delta x = x_i^0 - x_j^0$, $\Delta y = y_i^0 - y_j^0$, $\Delta z = z_i^0 - z_j^0$ are the components of the equilibrium difference vector $\mathbf{r}_{ij}^0$. This super-element is nonzero only when $r_{ij}^0 \leq r_c$, so $\mathbf{H}$ is sparse for typical cutoff distances. The diagonal blocks are set by the self-consistency condition (Newton's third law):
$$ \mathbf{H}{ii} = -\sum{j \neq i} \mathbf{H}_{ij} $$
which ensures that $\mathbf{H}$ is positive semi-definite and that rigid-body motions have zero energy cost (see below).
Normal Mode Analysis and Diagonalization
The equations of motion for the mass-weighted displacements $\tilde{\mathbf{u}}_i = \sqrt{m_i}\, \mathbf{u}_i$ (where $m_i$ is the mass of site $i$) take the form:
$$ \mathbf{M}^{-1/2} \mathbf{H}, \mathbf{M}^{-1/2}, \tilde{\mathbf{u}} = -\lambda, \tilde{\mathbf{u}} $$
where $\mathbf{M}$ is the $3N \times 3N$ diagonal mass matrix. Seeking solutions of the form $\tilde{\mathbf{u}}(t) = \mathbf{e}^{(k)} e^{i\omega_k t}$ leads to the standard eigenvalue problem:
$$ \tilde{\mathbf{H}}, \mathbf{e}^{(k)} = \lambda_k, \mathbf{e}^{(k)} $$
where $\tilde{\mathbf{H}} = \mathbf{M}^{-1/2} \mathbf{H}\, \mathbf{M}^{-1/2}$ is the mass-weighted Hessian. The eigenvalues $\lambda_k \geq 0$ are proportional to the squared angular frequencies $\omega_k^2 = \lambda_k$ , and the eigenvectors $\mathbf{e}^{(k)}$ (also called normal mode vectors) define the direction and pattern of collective atomic displacement in mode $k$.
Because the Hessian is real, symmetric, and positive semi-definite, it can always be diagonalized by an orthogonal transformation:
$$ \mathbf{H} = \mathbf{U}, \boldsymbol{\Lambda}, \mathbf{U}^T $$
where $\boldsymbol{\Lambda} = \text{diag}(\lambda_1, \lambda_2, \ldots, \lambda_{3N})$ and $\mathbf{U}$ is the matrix of column eigenvectors.
Rigid-Body Modes and the Null Space
The Hessian of any translationally and rotationally invariant potential has exactly six zero eigenvalues, corresponding to three global translations and three global rotations. These are the "trivial" modes: they represent rigid-body motions of the entire molecule that cost no energy. Because the spring network is built around pairwise distances (which are invariant under rigid-body transformations), these six modes are guaranteed to have $\lambda_k = 0$ by construction.
In practice, numerical diagonalization yields six eigenvalues very close to — but not exactly — zero, due to floating-point arithmetic. These modes are identified and systematically excluded from all physical analyses. The first non-trivial mode is mode 7, corresponding to the lowest-frequency collective internal motion, typically involving the largest-amplitude domain movements. Modes are ordered by increasing frequency: low-frequency modes are large-scale and collective, while high-frequency modes are localized and stiff.
Equipartition and the Physical Meaning of Eigenvalues
Under the classical harmonic approximation, the equipartition theorem states that each normal mode carries an average thermal energy of $\frac{1}{2}k_B T$. The mean-square displacement amplitude of mode $k$ is therefore:
$$ \langle A_k^2 \rangle = \frac{k_B T}{\lambda_k} $$
This has a profound implication: low-frequency modes (small $\lambda_k$) contribute large-amplitude fluctuations, while high-frequency modes (large $\lambda_k$) contribute small fluctuations. The total thermal fluctuation of the system is dominated by the handful of lowest-frequency modes, which is why ENM-based analyses of fluctuations and correlations are already quite accurate using only the first 10–20 non-trivial modes.
Furthermore, the inverse of the Hessian (its pseudo-inverse, excluding the null space) defines the covariance matrix of atomic displacements at thermal equilibrium:
$$ \langle u_{i\alpha}, u_{j\beta} \rangle = k_B T, [\mathbf{H}^+]_{i\alpha, j\beta} $$
where $\mathbf{H}^+$ is the Moore-Penrose pseudo-inverse. This relationship is the foundation for the RMSF and DCCM calculations available via pyadmd enm (see ENM (Standalone Normal Mode Analysis)).
Rotations-Translations of Blocks (RTB)
Direct diagonalization of the full ENM Hessian becomes the dominant computational cost for large systems, particularly the heavy-atom model. RTB trades resolution in the highest-frequency modes for a much smaller diagonalization problem: atoms are grouped into rigid blocks (fixed at one residue per block in pyadmd), and the mass-weighted Hessian is projected onto the 6-DOF-per-block subspace (3 translations + 3 rotations per block) before diagonalizing. The resulting eigenvectors are projected back to full Cartesian space.
Enabled via the --rtb flag on both pyadmd enm and pyadmd run (including any --recalc ENM recomputation mid-run — see Excitation Direction Update). Consequences of the fixed one-residue-per-block choice:
-m HEAVY: each block contains multiple heavy atoms (backbone + sidechain, protein or nucleic), so it genuinely contributes up to 6 degrees of freedom — the reduced problem has roughly $6 \times$ the number of residues degrees of freedom instead of $3 \times$ the number of heavy atoms, giving a real speedup for large systems.-m CA, protein residues: each block is a single Cα atom, which has no meaningful rotation about itself. Therefore, applying RTB on a purely protein Cα system present no computational benefit.-m CA, nucleic acid residues: represented by the three-bead SBP block (P, C1′, C2 — see Nucleic Acid Support (SBP Model)) rather than a single point, so — like a HEAVY block — it genuinely contributes up to 6 degrees of freedom. A protein–nucleic complex run under-m CA --rtbtherefore does see a real reduction on its nucleic portion, even though its protein portion does not.
Note: --rtb is not compatible with -m CHARMM. It reduces the ENM Hessian, and CHARMM normal modes are precomputed externally and never diagonalized by pyadmd.
Uniform Normal Modes Combination
The program generates uniformly distributed excitation vectors through a geometry-aware repulsion-based algorithm. The approach builds on a physics-inspired framework where points behave as charged particles confined to a spherical manifold, interacting through a dimensionally-scaled potential function. Unlike naive implementations that operate in an abstract factor space, the algorithm here accounts for the true geometry of the normal mode subspace before distributing the points, guaranteeing that the resulting excitation vectors are genuinely equidistant in the physical Cartesian space that governs the molecular dynamics.
The PDIM algorithm was the first implementation built for the same purpose; the design presented here extends that concept with a geometry-corrected basis and a faster, more concise implementation.
Problem Definition
Let $\mathbf{v}_1, \mathbf{v}_2, \dots, \mathbf{v}_N \in \mathbb{R}^{3n}$ be the $N$ normal mode vectors selected for excitation, where $n$ is the number of selected atoms. Each $\mathbf{v}_k$ is a flattened Cartesian displacement vector of length $3n$. The set of all normalized linear combinations of these vectors defines an $N$-dimensional subspace of $\mathbb{R}^{3n}$:
$$ \mathcal{V} = \mathrm{span}{\mathbf{v}_1, \mathbf{v}_2, \dots, \mathbf{v}_N} $$
Given an integer $P>0$, we seek to generate $P$ unit vectors $\{\mathbf{q}_1, \mathbf{q}_2, \dots, \mathbf{q}_P\} \subset \mathcal{V}$ that maximize the minimal pairwise angular separation:
$$ \max_{{\mathbf{q}i}} \min{i \neq j} |\mathbf{q}_i - \mathbf{q}_j| $$
This corresponds to finding an optimal spherical code on the unit hypersphere $S^{N-1}$ embedded within $\mathcal{V}$, with minimal angular separation between any two excitation directions.
Mode Subspace Geometry
A naive approach would place the $N$ modes on coordinate axes and treat the combination coefficients $c_k$ directly as coordinates on $S^{N-1}$. This is geometrically valid only if the mode vectors satisfy $\langle \mathbf{v}_i, \mathbf{v}_j \rangle = \delta_{ij}$, i.e., they are orthonormal in plain Cartesian space. In practice this condition is not met. ENM mode vectors are orthogonal in the mass-weighted inner product but carry non-uniform amplitudes in Cartesian coordinates, with low-frequency modes typically exhibiting larger displacements than high-frequency ones. CHARMM normal modes may additionally lose orthogonality when projected onto an atomic subset. As a consequence, equal angular spacing of coefficient vectors in abstract factor space does not translate into equal angular spacing of the physical excitation vectors $\mathbf{q}_i$.
To correct for this, the algorithm explicitly constructs an orthonormal basis
for $\mathcal{V}$ using QR decomposition before running the repulsion algorithm.
Orthonormal Basis Construction
Assemble the mode matrix $\mathbf{M}_{\mathrm{nm}} \in \mathbb{R}^{N \times 3n}$ whose rows are the flattened mode vectors:
$$ \mathbf{M}_{\mathrm{nm}} = \begin{pmatrix} — & \mathbf{v}_1^\top & — \ & \vdots & \ — & \mathbf{v}_N^\top & — \end{pmatrix} $$
Apply QR decomposition to $\mathbf{M}_{\mathrm{nm}}^\top \in \mathbb{R}^{3n \times N}$:
$$ \mathbf{M}{\mathrm{nm}}^\top = \mathbf{Q}{\mathrm{qr}}\ \mathbf{R} $$
where $\mathbf{Q}_{\mathrm{qr}} \in \mathbb{R}^{3n \times N}$ has orthonormal columns and $\mathbf{R} \in \mathbb{R}^{N \times N}$ is upper triangular. Setting $\mathbf{Q} = \mathbf{Q}_{\mathrm{qr}}^\top \in \mathbb{R}^{N \times 3n}$ yields an orthonormal row basis for $\mathcal{V}$:
$$ \langle \mathbf{Q}{i,:}, \mathbf{Q}{j,:} \rangle = \delta_{ij} $$
A point $\mathbf{x} \in \mathbb{R}^N$ on the unit hypersphere $S^{N-1}$ maps to a unit physical vector via $\mathbf{q} = \mathbf{x}\mathbf{Q} \in \mathbb{R}^{3n}$, and because $\mathbf{Q}$ is an isometric embedding, inner products are preserved:
$$ \langle \mathbf{x}_i \mathbf{Q}, \mathbf{x}_j \mathbf{Q} \rangle = \langle \mathbf{x}_i, \mathbf{x}_j \rangle $$
The repulsion algorithm therefore operates on $N$-dimensional coordinates $\mathbf{x} \in \mathbb{R}^N$ whose geometry is faithful to the physical mode subspace, at no additional cost relative to working in abstract factor space.
Energy Minimization Framework
The distribution problem is cast as an energy minimization over $P$ points $\{\mathbf{x}_1, \mathbf{x}_2, \dots, \mathbf{x}_P\} \subset S^{N-1}$:
$$ E = \sum_{i=1}^{P} \sum_{\substack{j=1 \ j \neq i}}^{P} U \left(|\mathbf{x}_i - \mathbf{x}_j|\right) $$
Dimensionally-Scaled Potential Function
The repulsive potential uses an inverse power law scaled by the dimensionality of the space:
$$ U(r) = \frac{1}{r^{k}}, \quad k = N - 1 $$
The exponent $k = N-1$ is chosen for three reasons. First, the fundamental solution to Laplace's equation in $N$ dimensions scales as $1/r^{N-2}$, and the gradient of that solution scales as $1/r^{N-1}$, making this the natural repulsive force law in $N$-dimensional space. Second, the surface area of $S^{N-1}$ grows as $({2\pi e}/{N})^{N/2}$, so stronger repulsion in higher dimensions is required to counteract the concentration-of-measure effect that causes random points to cluster near the equator. Third, the exponent ensures numerical stability by preventing excessively large or small force values as $N$ varies.
Gradient Flow on the Sphere
The repulsive force on point $\mathbf{x}_i$ arising from all other points is:
$$ \mathbf{f}i = \sum{\substack{j=1 \ j \neq i}}^{P} \frac{\mathbf{x}_i - \mathbf{x}_j}{|\mathbf{x}_i - \mathbf{x}_j|^{N+1}} $$
Since the points must remain on $S^{N-1}$, the gradient is projected onto the tangent plane at $\mathbf{x}_i$ to eliminate any radial component:
$$ \tilde{\mathbf{f}}_i = \mathbf{f}_i - \left(\mathbf{f}_i \cdot \mathbf{x}_i\right) \mathbf{x}_i $$
Each iteration updates the points by a fixed step $\eta = 0.001$ along their
tangent-plane forces and then renormalizes back onto $S^{N-1}$:
$$ \mathbf{x}_i \leftarrow \frac{\mathbf{x}_i + \eta,\tilde{\mathbf{f}}_i} {|\mathbf{x}_i + \eta,\tilde{\mathbf{f}}_i|} $$
Convergence is declared when $\max_i \|\mathbf{f}_i\|_\infty < 10^{-6}$, and the iteration is terminated early when the maximum force changes by less than $10^{-7}$ over five consecutive iterations (stagnation criterion).
Special Case: Cross-Polytope Initialization
When $P=2N$, the $2N$ vertices of the cross-polytope:
$$ {\pm\mathbf{e}_1, \pm\mathbf{e}_2, \dots, \pm\mathbf{e}_N} $$
provide an analytically optimal initialization in $\mathbf{Q}$-coordinates and the repulsion loop is skipped. These vertices are already maximally separated on $S^{N-1}$ under the symmetry of the cross-polytope, yielding pairwise angular separations of either $90°$ or $180°$.
Normal Modes Linear Combination
Once the coordinates $\{\mathbf{x}_1, \dots, \mathbf{x}_P\}$ have converged on $S^{N-1}$, each is mapped back to a physical excitation vector via the orthonormal basis $\mathbf{Q}$:
$$ \mathbf{q}_i = \mathbf{x}_i \mathbf{Q} \in \mathbb{R}^{3n}, \qquad |\mathbf{q}_i| = 1 $$
The equivalent scalar combination factors $\{c_{i,k}\}$ in terms of the original (non-orthonormal) mode vectors — useful for logging and interpretability — are recovered by least-squares projection:
$$ \mathbf{c}_i = \mathbf{q}i , \mathbf{M}{\mathrm{nm}}^+ \in \mathbb{R}^N $$
where $\mathbf{M}_{\mathrm{nm}}^+$ denotes the Moore–Penrose pseudoinverse of $\mathbf{M}_{\mathrm{nm}}$. These approximate coefficients are written to the factors.csv output file for reference but do not influence the simulation; the physical vectors $\mathbf{q}_i$ are used directly as excitation directions.
Reproducibility: the only stochastic step in this procedure is the initial placement of the $P$ points on $S^{N-1}$ before the repulsion loop runs (skipped entirely when $P=2N$, see above). This is controlled by a seeded RNG (-seed/--seed, default 42), so pyadmd run calls with identical arguments produce identical excitation vectors and factors.csv — see Run Parameters.
Note: ENM recomputation under --recalc (see Excitation Direction Update) draws a new random combination each time it fires with the default random method and is intentionally not covered by --seed, since its purpose is to re-diversify the excitation direction mid-simulation. The harmonized method (see ENM Recalculation and Subspace Harmonization) involves no random draw.
Kinetic Energy Control
The additional kinetic energy injected in the system has a fast dissipation rate. Therefore, the program constantly checks the injection energy level and rescale the velocities along the excited direction whenever it is necessary. The kinetic energy along the normalized excitation vector $\mathbf{Q}$ direction is calculated by projecting first the current velocities to the excitation direction $\mathbf{Q}$ as $\mathbf{V}_p = (\mathbf{V}_{curr} \cdot \mathbf{Q}) \cdot \mathbf{Q}$, where $\mathbf{V}_{p}$ and $\mathbf{V}_{curr}$ the $3N$-dimensional vectors of the projected and current atomic velocities, respectively. The kinetic energy along the excitation direction is thus given by:
$$ E_k = \frac{1}{2} \mathbf{V}_{p}^T \mathbf{M}\ \mathbf{V}_p $$
where $\mathbf{M}$ is the diagonal mass matrix. At the beginning of each short simulation interval, the remaining excitation energy ($E_k$) is adjusted to the desired excitation level ($E_{exc}$) by modifying the atomic velocities so $\mathbf{V}_{new} = \mathbf{V}_{curr} + (\mathbf{V}_{exc} - \mathbf{V}_{p})$.
Two thresholds are defined around the target energy, $0.75\,E_{exc}$ and $1.25\,E_{exc}$. Whenever $E_k$ leaves this band, only the velocity component along $\mathbf{Q}$ is replaced by the target excitation velocity, while all orthogonal components are preserved. This is a directional excitation/re-injection, not a global thermostat; the thermostat acting on the whole system is the Nosé-Hoover coupling (--nh-frequency).
With this procedure, the system is kept in a continuous excited state, allowing an effective small, "adiabatic-like" energy injection. The energy injection control is done by projecting the velocities computed during the simulation onto the excited vector, thus obtaining and rescaling the kinetic energy corresponding to it.
Excitation Direction Update
Since the excitation vector is obtained from the initial conformation, it is dependent of this configuration. As the system is displaced along this direction and change its conformation, the motion loses its directionality due to mainly anharmonic effects. To prevent the structural distortions produced by the displacement along a vector that is no longer valid, the program update the excitation directions based on the trajectory evolution during the previous excitation steps. This procedure allows the system to adaptively find a relaxed path to follow during the next aMDeNM excitations.
If we consider the $n^{th}$ simulation, the next excitation vector, $\mathbf{Q}_{n+1}$, is determined based on specific parameter values obtained along the trajectory followed in the $\mathbf{Q}_n$ direction. A new excitation vector is defined based on two parameters: the first relates to the effective displacement $\ell$ along $\mathbf{Q}_n$ during the $n^{th}$ excited dynamics by projecting the mass-weighted effective displacement vector $\mathbf{d}_n = \mathbf{M}^{1/2} ({\langle \mathbf{r} \rangle}_n - \mathbf{r}_n^0)$ onto the normalized mass-weighted excitation vector $\mathbf{Q}_n$, where the ${\langle \mathbf{r} \rangle}_n$ is the average position of the structures over the last $0.2~ps$ obtained in the $n^{th}$ excitation, and $\mathbf{r}_n^0$ is the starting position for the following simulation.
The second parameter relates to the relative deviation of the vector $\mathbf{d}_n$ with respect to vector $\mathbf{Q}_n$, evaluated by the angle $\alpha_n$ between them. More precisely, we consider the ${\cos \alpha}_n$ obtained by taking the scalar product of these vectors after normalizing $\mathbf{d}_n$, as following:
$$ {\cos \alpha}_n = \frac {\mathbf{d}_n \mathbf{Q}_n} {|\mathbf{d}_n|} $$
A precise rule is followed to decide whether to modify the excitation vector direction after every short simulation run. The excitation vector is changed as soon as $\ell_n$, the displacement along $\mathbf{Q}_n$, is larger than a threshold value $\ell_c$, and when $\cos {\alpha}$ is lower than a threshold value ${\cos \alpha}_c$. The conditions for choosing the excitation vector between $\mathbf{d}_n$ and $\mathbf{Q}_n$ for the next simulation are defined by:
$$ \mathbf{Q}_{n+1} = \begin{cases} \mathbf{Q}_n, & \text{if } \ell \leq \ell_c \ \mathbf{Q}_n, & \text{if } \ell \gt \ell_c \wedge \cos \alpha \ge {\cos \alpha}_c \ \mathbf{d}_n, & \text{if } \ell \gt \ell_c \wedge \cos \alpha \lt {\cos \alpha}_c \end{cases} $$
The default value for $\ell_c$ is $0.5 m^{1/2} Å$ (with $m$ being atomic mass unit), and for $\alpha$ is $60°$.
Note on --recalc and reproducibility: when --recalc is set, reaching this threshold triggers a full ENM recomputation from the current structure (SimulationRunner._recompute_enm_modes). With the default --recalc-method random, this is followed by a brand-new random linear combination of the recomputed modes, rather than the deterministic displacement-based correction above. This random re-combination is independent of the -seed/--seed flag described in Uniform Normal Modes Combination and is not currently reproducible run-to-run — by design, since its purpose is to re-diversify the excitation direction after the mode subspace itself has changed. With --recalc-method harmonized, ENM recomputation is instead performed only after a true angular correction and the corrected direction is transported through the harmonized mode subspace, with no random component (see ENM Recalculation and Subspace Harmonization). When --rtb is also set, the ENM recomputation is performed via the RTB reduction (see Rotations-Translations of Blocks (RTB)) rather than direct diagonalization.
ENM Recalculation and Subspace Harmonization
As the conformation evolves, the ENM modes computed on the initial structure progressively lose their meaning, and individual mode indices computed on a new conformation do not need to correspond to the "same" collective motion: modes may exchange order, change sign, or mix with neighboring modes. The harmonized method (-r/--recalc --recalc-method harmonized) addresses this by tracking a collective subspace instead of individual mode numbers. It explicitly separates three operations:
- the physical correction $
\mathbf{Q}_{corr}$, issued from the observed structural displacement (Excitation Direction Update); - the ENM recalculation, triggered only when a true angular correction has occurred;
- the harmonization of the new subspace within a larger search space, followed by the controlled transport of $
\mathbf{Q}$.
Active Subspace and Search Space
Let $\mathbf{U}_m$ be the previous active subspace of dimension $m$ (the modes given by -nm) and $\mathbf{V}_M$ the new search subspace of dimension $M \geq m$ (the modes given by --subspace-search-modes; $M = m$ when omitted):
$$ \mathbf{U} = [\mathbf{u}_1 \dots \mathbf{u}_m] ; \qquad \mathbf{V} = [\mathbf{v}_1 \dots \mathbf{v}_M] $$
Columns of $\mathbf{U}$ and $\mathbf{V}$ are expressed in the same mass-weighted coordinate space, restricted to the excitation atoms (the Cα atoms of the protein and the SBP beads of nucleic acids that fall within -sel; all heavy atoms for -m HEAVY). The new structure is first superposed onto the previous one by a mass-weighted Kabsch rotation, the new modes are rotated into the same frame, and both bases are orthonormalized by QR. The problem is therefore not to identify "the new mode 7" in a strict sense, but to recover, within $\mathbf{V}_M$, the $m$-dimensional component that best represents the previous collective subspace.
Overlap Matrix and SVD
The rectangular $m \times M$ overlap matrix is decomposed by thin SVD:
$$ \mathbf{S} = \mathbf{U}^\top \mathbf{V} = \mathbf{L}, \boldsymbol{\Sigma}, \mathbf{R}^\top $$
The singular values $\sigma_i$ are the cosines of the principal angles between the previous active subspace and the best $m$-dimensional subspace contained in $\mathbf{V}_M$:
$$ \sigma_i = \cos \theta_i, \qquad \Omega = \frac{1}{m} \sum_{i=1}^{m} \sigma_i^2 $$
A $\sigma_i$ close to 1 corresponds to a small principal angle, i.e. a well-conserved collective direction; a decrease of $\sigma_i$ signals that part of the active subspace is no longer well represented in the chosen search space. $\Omega$ is a global indicator of subspace conservation but does not replace the individual singular values and principal angles: a high mean can hide one poorly conserved direction, so the diagnostics must be read jointly.
Procrustes Harmonization
The right singular vectors associated with the $m$ singular values define, inside $\mathbf{V}_M$, the combination that maximizes the overlap with $\mathbf{U}_m$. With $\mathbf{R}_m$ the corresponding $M \times m$ block of $\mathbf{R}$:
$$ \mathbf{V}{match} = \mathbf{V}, \mathbf{R}m, \qquad \mathbf{V}{harm} = \mathbf{V}{match}, \mathbf{L}^\top $$
This is a Procrustes-type harmonization: it does not change the selected subspace ($\mathrm{span}(\mathbf{V}_{harm}) = \mathrm{span}(\mathbf{V}_{match})$) but orients its basis consistently with the previous one. The formulation naturally handles permutations, sign inversions and mixing between neighboring modes, avoiding any excessive physical meaning attached to individual mode numbers. The matching coefficients (the entries of $\mathbf{R}_m$) report how the $M$ search modes combine into each of the $m$ matched directions.
Transport of Q and Controlled Mixing
The transport acts on $\mathbf{Q}_{corr}$, the direction issued from the observed physical/angular correction; it does not replace that correction by a purely modal direction. The harmonization intervenes after the correction and constrains its continuity within the new collective subspace:
$$ \mathbf{Q}{harm} = \frac{P(\mathbf{V}{harm}), \mathbf{Q}{corr}}{|P(\mathbf{V}{harm}), \mathbf{Q}_{corr}|} $$
The projection can reduce the norm if part of $\mathbf{Q}_{corr}$ lies outside the harmonized subspace; $\mathbf{Q}_{harm}$ is therefore renormalized, and its sign is chosen to remain continuous with $\mathbf{Q}_{corr}$. The parameter $\alpha$ (--subspace-alpha) then controls the mixing between the physical correction and the transported direction:
$$ \mathbf{Q}{final} = \frac{(1 - \alpha), \mathbf{Q}{corr} + \alpha, \mathbf{Q}{harm}}{|(1 - \alpha), \mathbf{Q}{corr} + \alpha, \mathbf{Q}_{harm}|} $$
Thus $\alpha = 0$ keeps $\mathbf{Q}_{corr}$, $\alpha = 1$ uses entirely the transported direction (discarding the component of $\mathbf{Q}_{corr}$ outside the harmonized subspace), and intermediate values perform a normalized interpolation. $\alpha$ is not a fraction of energy distributed among the search modes: the excitation energy is always set by -ek along $\mathbf{Q}_{final}$.
Each harmonization appends one row to subspace_overlap.csv (replica, cycle, correction index, $m$, $M$, active and search modes, $\Omega$, singular values, principal angles, $\alpha$) and the matching coefficients to subspace_matching_coefficients.csv. The successive archived vectors (cntrl_vector.vec.N) are the $N$-th $\mathbf{Q}_{final}$, with vector 1 being the initial $\mathbf{Q}$; the angle between successive archived vectors combines the physical correction and the transport and must not be interpreted as the isolated effect of the harmonization.
If the ENM recalculation fails, the physical correction $\mathbf{Q}_{corr}$ is kept (no second correction is applied) and archived.
Optional Transverse Diversification with Beta
Purpose and relationship to alpha
The active subspace contains a small number of collective directions, whereas the larger search reservoir allows those directions to be tracked when newly computed modes change order, sign, or composition. Alpha controls transport toward the tracked active subspace. Beta optionally adds a configurable number of directions selected from a separately harmonized full reservoir. These directions favor motion transverse to the alpha-corrected excitation while penalizing high stiffness. This can alter the explored path; it does not by itself guarantee wider sampling or smaller excursions.
Let $m$ be the number of distinct active modes given to -nm, $B$ the positive integer given to --subspace-beta-count (default 3), and $M$ the number of distinct search modes. Positive beta requires $M\ge m+B$, with every active mode in the reservoir. The reservoir is limited by the available ENM spectrum. All contributions form one normalized excitation direction. A harmonized reservoir direction is generally a combination of several instantaneous ENM eigenvectors, so its persistent label need not correspond to the instantaneous eigenmode with the same number.
Coordinates and alpha-corrected direction
All vectors below are columns in the same mass-weighted coordinate system and rigid-body frame. Let $N$ be the number of excitation atoms and $M$ the number of search modes. Unit vectors have Euclidean norm one in this mass-weighted space. The new coordinates and vectors are first rotated into the old reference frame using mass-weighted Kabsch alignment. The resulting direction and both stored bases are then rotated back into the current MD frame, so the stored basis and its reference positions share one frame.
Let $H\in\mathbb{R}^{3N\times m}$ be the orthonormal harmonized active basis obtained by the rectangular Procrustes procedure described above, and let $q$ be the normalized direction after the displacement-based correction. Define
$$ p=HH^\top q,\qquad q_h=\frac{p}{|p|},\qquad q_c=\frac{(1-\alpha)q+\alpha q_h}{|(1-\alpha)q+\alpha q_h|}. $$
Here $HH^\top$ is the orthogonal projector onto the active subspace, $q_h$ is the normalized projection, and $q_c$ is the alpha-corrected direction entering the beta step. A numerically vanishing projection is rejected. The subscript $c$ in this section denotes the result after alpha mixing, not the preceding displacement correction alone.
Harmonizing the full reservoir
Let $E\in\mathbb{R}^{3N\times M}$ contain the newly calculated search vectors after alignment. Write its reduced QR factorization as $E=VT$, where $V^\top V=I_M$ and $T$ is triangular. Let $A$ be an orthonormal basis of the previously stored full reservoir in the same frame. A separate, square Procrustes calculation gives
$$ A^\top V=L_R\Sigma_R R_R^\top,\qquad O=R_RL_R^\top,\qquad W=VO. $$
The columns $w_j$ of $W$ form the current orthonormal, continuously oriented reservoir. This full-reservoir alignment is distinct from the rectangular calculation that produces the active basis with $m$ columns $H$. Both bases are stored for the next update. The singular values in $\Sigma_R$ measure reservoir continuity.
To express these transported directions in the original new-mode coordinates, define
$$ C=T^{-1}O,\qquad W=EC. $$
This triangular transformation matters when the input basis requires orthonormalization: stiffness must be transformed consistently with the vectors.
Effective stiffness and transverse score
Let $D$ be the mass-weighted ENM Hessian, and let $K=E^\top D E$ be its representation in the new search basis. For exact orthonormal eigenvectors, $K$ is diagonal with their eigenvalues. The implementation retains the full matrix, including couplings where applicable. In the transported reservoir,
$$ G=C^\top K C,\qquad \kappa_j=G_{jj},\qquad \lambda_{ref}=\lambda_{min}(K). $$
Thus $\kappa_j$ is the effective stiffness of the whole transported direction $w_j$. The reservoir is rejected if its stiffness matrix is non-finite, non-symmetric, unstable, or nearly singular; the numerical positive-definiteness condition is $\lambda_{min}(K)>10^{-8}\lambda_{max}(K)>0$.
For each candidate, compute
$$ p_j=w_j^\top q_c,\qquad d_j=\sqrt{\max(0,1-p_j^2)},\qquad s_j=d_j\sqrt{\frac{\lambda_{ref}}{\kappa_j}}. $$
Because $w_j$ and $q_c$ are normalized, $p_j$ is their cosine, and $d_j$ measures their transverse separation. Numerically, the cosine is clipped to $[-1,1]$. The stiffness factor favors softer directions, so a direction can score highly through both transverse orientation and low stiffness. Transversality is used for selection; the implementation does not replace $w_j$ with a normalized orthogonal residual.
Exclusion, selection, and sign continuity
First measure overlap with the active space:
$$ a_j=|H^\top w_j|^2=\sum_{i=1}^{m}(h_i^\top w_j)^2. $$
Exclude the $m$ reservoir directions with largest $a_j$. Among the remaining directions, select the $B$ largest scores $s_j$; denote their indices by $J$. Exclusion limits duplication of the active space but does not impose exact orthogonality. Scores that agree to $10^{-12}$ relative precision keep the persistent reservoir ordering. $B$ candidates with scores above $10^{-12}$ are required. With exactly $M=m+B$ search modes, every remaining candidate must qualify; a larger reservoir lets the score choose among alternatives.
For the selected directions, define equal-magnitude coefficients
$$ b_j=\frac{\epsilon_j}{\sqrt{B}},\qquad \epsilon_j=\begin{cases}-1,&p_j<-10^{-12},\+1,&p_j\geq-10^{-12},\end{cases} \qquad S=\sum_{j\in J}b_jw_j. $$
Away from numerical zero, the signs make each selected contribution point toward the same hemisphere as $q_c$. Near-zero projections retain the transported sign rather than introducing an arbitrary reversal. Since the selected reservoir vectors are orthonormal, $|S|=1$. The equal magnitudes apply to the $B$ harmonized directions, not to all instantaneous modes contained in them.
Final mixture and excitation energy
The final direction is
$$ q_{new}=\frac{q_c+\beta S}{|q_c+\beta S|} =\frac{q_c+\beta S}{\sqrt{1+\beta^2+2\beta q_c^\top S}}. $$
Beta sets the relative amplitude of the supplementary combination before normalization. It is neither an energy fraction nor a count-based division of the excitation energy. The code verifies $q_{new}^\top q_c>0$; this local continuity condition does not prevent a later trajectory from returning toward its starting conformation.
For a unit mass-weighted direction, the positive-beta velocity conversion has the form
$$ v_{exc,i}=\sqrt{2E_{target}},\frac{q_{new,i}}{\sqrt{m_i}},\qquad \frac12\sum_i m_i|v_{exc,i}|^2=E_{target}, $$
where $m_i$ is an atomic mass and the implementation performs its internal unit conversions. The existing kinetic-energy controller determines when this target is restored. Increasing -ek changes the energy target along the combined direction; increasing beta changes its geometry. In a harmonic approximation, a pure-mode displacement amplitude scales as $\sqrt{2E/\lambda}$, which explains why stiffness enters the selection score. It does not prescribe an automatic energy compensation when beta changes.
The supplementary mixture's effective stiffness is
$$ \kappa_S=b^\top G_{JJ}b =\sum_{j\in J}b_j^2G_{jj}+\sum_{j\ne k\in J}b_jb_kG_{jk}. $$
The off-diagonal term is retained and reported. Harmonized directions are not generally independent eigenmodes, so their mixture cannot be characterized only by a sum of diagonal eigenvalues.
Activation, constraints, and diagnostics
Beta is enabled by adding the following options to a run command (see Using alpha harmonization with beta diversification):
-r --recalc-method harmonized
--subspace-search-modes <M labels, including all -nm modes>
--subspace-alpha <alpha> --subspace-beta <beta> [--subspace-beta-count <B>]
Positive beta requires $0<\beta<\infty$ and $0\leq\alpha\leq1$, at least one active mode, and at least $m+B$ distinct search modes containing all active modes and excluding labels 1–6. The excitation selection must include the entire ENM representative-atom selection. HEAVY is also supported. The mode ranges and parameter values in the examples illustrate the syntax; they are not general recommendations.
--subspace-beta 0 is the default and keeps the alpha transport and velocity-conversion path. Positive beta additionally uses the consistent current-frame transport and the mass-weighted-to-physical velocity conversion. A beta-zero versus positive-beta comparison therefore includes these implementation differences as well as the supplementary mixture.
Beta updates write subspace_candidates.csv (candidate scores, overlaps, selections and coefficients), subspace_diversity.csv (selection, continuity, stiffness, participation and collectivity summaries) and subspace_diversity_N.npz (full matrices and coefficients). The selected labels refer to tracked reservoir directions. subspace_overlap.csv is written in both modes.
Restart and state
Every fresh replica resets the adaptive displacement threshold to 0.5 Å and clears accumulated averages and ENM bases. A restart restores the saved adaptive state instead. The beta restart state includes the active basis, the full reservoir, the reference coordinates and the configuration; the restart verifies these against the saved checksums and checkpoint. Do not change alpha, beta, the beta count, the mode selections or the model of a saved run; start a new run to use different settings.
Invalid mode-count configurations
For positive beta, the reservoir must contain at least $m+B$ distinct modes, including every active mode and excluding rigid-body modes 1–6. Invalid configurations stop with an error before the simulation starts, and counts are never silently reduced. For example, four active modes with four beta directions require at least eight reservoir modes; seven produces an error stating the required and supplied counts.
During adaptive recomputation, the software also checks that enough meaningful transverse candidates remain. If not, it stops and reports the available and requested counts. A larger reservoir or fewer beta directions should be tested in a fresh run.
Beta may equal or exceed alpha, including values above 1. Alpha remains an interpolation coefficient between 0 and 1. Beta is a relative amplitude, not a percentage or an energy fraction. For example, --subspace-alpha 0.3 --subspace-beta 0.7 is valid, and no condition $\alpha+\beta\leq1$ is imposed. For $\beta>1$, the equivalent mixture $q_c/\beta+S$ is normalized, which avoids overflow.
pyAdMD Applications
The Adaptive MDeNM method takes self-computed Cα or heavy atoms ENM modes or CHARMM-computed normal modes as collective variables to improve Molecular Dynamics sampling.
ENM
Uses simpified force-field based on particles and springs computed automatically by the program. A given normal mode (or a linear combination of several modes) is used to excite the system during the molecular dyamics simulation.
Physical force-field based normal modes
Uses physical force-field based normal modes computed in CHARMM. A given normal mode (or a linear combination of several modes) is used to excite the system during the molecular dyamics simulation.
Configuration
pyadmd is distributed as an installable Python package that computes ENM modes, uniformly distributes linear combinations of modes in the $N$-dimensional hypersphere space, manages the OpenMM-based simulations, and computes the projections along the excitation direction, applying corrections whenever necessary. Its bundled data includes the CHARMM driver script used to write down CHARMM-computed normal modes.
One can easily setup and run an Adaptive MDeNM simulation using pyadmd. The configuration process is straightforward. Some technical aspects will be covered in this section in order to facilitate the method comprehension.
Normal Modes Selection
Choosing which normal mode to include in the pyadmd calculation is crucial for the expected result. We strongly recommend first calculating the ENM modes (pyadmd enm), examining them carefully, and then proceeding with the workflow using the pyadmd run command. From an exploratory perspective, the collectivity data derived from ENM calculations can provide insights into the importance or dominance of each normal mode within the system's overall dynamics. However, there are phenomena where a specific mode (or set of modes) is better suited to explain the particular conformational transitions involved.
Energy injection
The excitation cycle length is set by --cycle-steps (default: $50$ steps; with a $2~fs$ timestep, $0.1~ps$). This means that every cycle the system receives the additional amount of energy defined by the user. Therefore, when studying large scale motions, it is advised to inject small amounts of energy in order to avoid structural distortions caused by an excessive energy injection. Usually, an excitation energy of $2~kcal/mol$ is sufficient to achieve a large exploration of the conformational space ($10~kcal/mol$ if Cα-only ENM).
Simulation time
The total simulation time may require a tuning depending on the system size, energy injection and nature of the motion being excited. Considering a large scale global motion, there is a trade-off between the energy injection and the total simulation time. Larger amounts of energy allows a shorter simulation time, however, this may not be advised as discussed above.
Excitation direction update
As described above, the direction is updated after the system has traveled a distance of $0.5~Å$ along the excitation vector and its real displacement has a deviation of $60°$ with respect to the theoretical one. The update can also be affected by the amount of energy injected, since higher energy values leads to larger motions. In addition, after each correction the new vector loses directionality due to anharmonic effects. This means that, at a given point, the new vectors are so diffuse that there is no point in proceed the simulation. When this ponit is reached, it is necessary to recompute the normal modes and start again. This is one more reason to not inject high energy values and let the system undergoes the changes slowly.
Alternatively, one can recompute ENM modes instead of change the excitation vector direction (only when the original model type is ENM), either with a new random mode combination (--recalc-method random, default) or by transporting the corrected direction through a harmonized mode subspace (--recalc-method harmonized; see ENM Recalculation and Subspace Harmonization).
Number of modes and replicas
The program do a linear combination of the supplied normal modes to compute the excitation direction. This imply that the more modes are provided, the more replicas will be necessary to cover the hyperspace described by these modes.
Atom selection
Create an atom selection to apply the energy injection using MDAnalysis selection language. Must be written between quotes. This same selection (-sel/--selection at run time) is later reused by pyadmd analyze as the default scope for most structural metrics.
The excitation, the direction correction and the ENM-recalculation subspace operate on the ENM representative atoms within this selection: for -m CA, the Cα atoms of protein residues and the P, C1′ and C2 beads of nucleic acid residues; for -m HEAVY, all non-hydrogen atoms. With --recalc, every excitation atom must be protein or nucleic acid.
Input Requirements
Run
Parameters
-
-src/--source: Input engine type,NAMD(binary.coor/.vel/.xsc) orOPENMM(XML restart.rst) (required) -
-m/--model: Normal modes model type,CAENM,HEAVYAtoms ENM orCHARMM(required. Default:CA) -
-nm/--modes: Normal modes to excite (optional. Default:7,8,9) -
-ek/--energy: Excitation energy injection (optional. Default:2kcal/mol) -
-t/--time: Simulation time (optional. Default:250ps) -
-sel/--selection: Atom selection to apply the energy injection (optional. Default:"protein"). Also becomes the default scope for mostpyadmd analyzestructural metrics. -
-rep/--replicas: Number of replicas to run (optional. Default:10) -
-seed/--seed: Random seed for the uniform mode-combination generation (the repulsion-algorithm initialization described in Uniform Normal Modes Combination) (optional. Default:42). Fixing this value makesrunmore reproducible: identical CLI arguments always produce identical excitation vectors andfactors.csv. Pass a different value to obtain an independent replicate ensemble. Does not affect the--recalc-method randommid-simulation re-excitation, which remains stochastic by design — see Excitation Direction Update. Note: fixing the random seed will create the same start conditions torun, but the simulation will diverge after a given point due to stochasticity and floating point precision. -
--cycle-steps: MD steps per adaptive/constant excitation cycle (optional. Default:50; with a 2 fs timestep, 50 steps = 0.1 ps). Ignored with--no-correc, which is fixed at 1000 steps. -
--nh-frequency: Nosé-Hoover thermostat coupling frequency, in ps⁻¹ (optional. Default:1.0) -
--recalc-method: Excitation direction update after each ENM recalculation,randomorharmonized(optional. Default:random). Only meaningful with-r/--recalc;harmonizedrequires it. See ENM Recalculation and Subspace Harmonization. -
--subspace-search-modes: Comma-separated ENM modes defining the larger search subspace $M$ for--recalc-method harmonized, e.g.7,8,9,10,11,12(optional. Default: same modes as-nm). Must contain every mode given in-nm. The parser rejects $M < m$, duplicates and missing active modes before the simulation starts. -
--subspace-alpha: Mixing factor $\alpha \in [0, 1]$ between the physical correction $\mathbf{Q}_{corr}$ and the transported direction $\mathbf{Q}_{harm}$ for--recalc-method harmonized(optional. Default:1.0). -
--subspace-beta: Amplitude of the optional transverse diversification (optional. Default:0, disabled). Positive values require-r --recalc-method harmonized, an ENM model (CAorHEAVY), and a search space that satisfies the count rule in Activation, constraints, and diagnostics. -
--subspace-beta-count: Number of supplementary transverse directions $B$ (positive integer; optional. Default:3). It has no effect when--subspace-betais0.
Files
pyadmd run automatically creates the inputs/ directory in the current
working directory (if it doesn't already exist) and copies every file listed
below into it.
-
-psf/--psffile: PSF structure file containing system molecule-specific information (required) -
-pdb/--pdbfile: PDB structure file in Protein Data Bank format (required) -
-mod/--modefile: Binary file containg CHARMM normal mode vectors (optional. Required only if-m = CHARMM)
NAMD input files (required when -src NAMD):
-coor/--coorfile: NAMD binary coordinates file (.coor)-vel/--velfile: NAMD binary velocities file (.vel)-xsc/--xscfile: NAMD eXtended System Configuration file (.xsc)-str/--strfile: CHARMM-style stream file, containing box info and force field parameters/definitions (required in NAMD mode; optional in OpenMM mode)
OpenMM input files (required when -src OPENMM):
-rst/--rstfile: OpenMM XML restart file (.rst), written viaXmlSerializer.serialize(state)from a state built withgetPositions=True, getVelocities=True
Feature Flags
-
-n/--no-correc: Disable excitation vector direction correction and compute standard MDeNM -
-f/--fixed: Disable excitation vector correction and keep constant excitation energy injections -
-r/--recalc: Recompute ENM modes instead of correcting the excitation vector direction. The update that follows the recalculation is selected by--recalc-method: withrandom(default) the new mode combination is drawn from a fresh random unit vector and is not controlled by-seed/--seed— see Excitation Direction Update; withharmonizedthe recalculation follows a true angular correction and the corrected direction is transported through the harmonized subspace — see ENM Recalculation and Subspace Harmonization. Not compatible with-m CHARMM. -
--full-ener: Write per-term energy decomposition (BOND, ANGLE, DIHED, IMPRP, CMAP, UBREY, NBFIX, NONBONDED, etc.) torep{N}_ener_decomp.logevery cycle -
--rtb: Use RTB (Rotations-Translations of Blocks) reduction for ENM diagonalization instead of direct full-Hessian diagonalization — see Rotations-Translations of Blocks (RTB). Blocks are fixed at one residue each. Only valid with-m CAor-m HEAVY(notCHARMM). Also applies to any--recalcENM recomputation mid-run, with either--recalc-method.
Run Output Files
Besides the trajectory, logs and projection files described in Analysis, each replica folder may contain the excitation-vector archives and ENM-recalculation diagnostics below.
cntrl_vector.vec/excitation.vel: current excitation direction $\mathbf{Q}$ and excitation velocity (full-system arrays).cntrl_vector.vec.N/excitation.vel.N: archived vectors. With--recalc-method harmonized, index $N$ is the $N$-th $\mathbf{Q}_{final}$ (vector 1 being the initial $\mathbf{Q}$); otherwise, $N$ is the vector in use before the $N$-th correction.step_{cycle}.pdbandstep_{cycle}_enm/(--recalc): structure at which each ENM recalculation was performed and its ENM output (mode vectors and trajectories).recalc_factors_{N}.csv(--recalc-method random, insidestep_{cycle}_enm/): random combination factors of the $N$-th recombination.subspace_overlap.csv(harmonized): one row per harmonization — replica, cycle, correction index, $m$, $M$, active and search modes, $\Omega$, singular values $\sigma_i$, principal angles (degrees), $\alpha$.subspace_matching_coefficients.csv(harmonized, alpha path): coefficients of each of the $M$ search modes in each of the $m$ matched directions (entries of $\mathbf{R}_m$).subspace_candidates.csv,subspace_diversity.csv,subspace_diversity_N.npz(--subspace-beta> 0): per-candidate scores and selections, per-update diversity summaries, and the full arrays of the N-th beta update (see Optional Transverse Diversification with Beta)._state_*.npy,correction_state.json,_state_enm_diversity.json(beta): the adaptive state required forrestartandappend. Do not delete them while a run is unfinished.
Append
Parameters
-t/--time: Simulation time to append, in ps (required)
Free Energy
All parameters are optional; the fel subcommand reads its input trajectories and reference state from files already produced by run/restart/append, so no additional files need to be supplied.
-c/--cutoff: GROMOS RMSD clustering cutoff, in Å (optional. Default:1.0)-d/--deexcite: Total restrained de-excitation MD length per centroid, in ps, split evenly over 4 restraint phases (optional. Default:200)-p/--production: Unrestrained production MD length per centroid, in ps (optional. Default:800)-nm/--modes: Comma-separated mode indices to project for the FEL (optional. Default: same modes used inrun, e.g.7,8,9)--modes-2d: Mode pairs for 2D FEL plots, as space-separated"m1,m2"tokens (optional. Default: all pairwise combinations of --modes, e.g. "7,8 7,9 8,9")-b/--bins: Number of histogram bins used for the FEL (optional. Default:100)-T/--temp: Temperature for kBT scaling and the production ensemble, in K (optional. Default:303.15)-s/--sel: MDAnalysis selection string used for GROMOS RMSD clustering (optional. Default:"protein and name CA")--max-centroids: Maximum number of centroids submitted to MD. When the cluster count exceeds this value, exactly this many centroids are selected by greedy farthest-point (MaxMin) sampling to maximize conformational diversity (optional. Default:50)
Note: -s/--sel and -T/--temp must stay the same across repeated fel calls on the same simulation — see Extending a Previous Free Energy Calculation. This -s/--sel selection is independent of run's -sel/--selection: it controls GROMOS clustering only, while run's selection controls both energy injection and (by default) the scope of most pyadmd analyze metrics.
Analysis
Parameters
-src/--source: Trajectory source to analyze,pyadmdforrep{N}.dcdreplica trajectories orfelforcentroid_frame{F}.dcdproduction trajectories (optional. Default:pyadmd)
Feature Flags
-r/--rough: Perform rough analysis (optional. Analyze every5ps instead of every frame.)
Skip Flags
Each analysis step can be independently disabled. When skipped, that metric will not appear in any CSV, plot, or HTML summary output.
--no-rmsd: Skip RMSD calculation--no-rg: Skip radius of gyration calculation--no-sasa: Skip SASA and hydrophobic exposure calculation--no-rmsf: Skip RMSF calculation--no-dssp: Skip secondary structure analysis via DSSP--no-dccm: Skip DCCM (dynamic cross-correlation matrix) calculation--no-lmi: Skip LMI (Linear Mutual Information) calculation--no-modeproj: Skip mode-projection analysis
Note: Before analysis, the program checks if pyadmd or fel calls are properly completed. If any unit (pyAdMD replica or free energy centroid) hasn't finished running, analyze prints a warning listing the incomplete units and their cycles completed/target, but proceeds anyway — see Handling Incomplete Units below.
ENM
Parameters
-
-i/--input: Input PDB file (required, unless-w/--write-modesis used). -
-o/--output: Output folder name (optional. Default:output). -
-m/--model: Model type,CA(Cα-only) orHEAVY(heavy atoms) (optional. Default:CA). Unlikerun's-m/--model,CHARMMis not a valid choice here —enmonly computes ENM normal modes, not CHARMM-derived ones. -
-sel/--selection: Atom selection applied to the input PDB before building the ENM (optional. Default:"protein or nucleic"). Must be written between quotes if it contains spaces, per MDAnalysis selection language. -
-c/--cutoff: Interaction cutoff distance, in Å (optional. Default:15.0for CA,12.0for HEAVY). -
-k/--spring-constant: ENM harmonic spring constant, in kcal/mol/Ų (optional. Default:1.0). -
--max-modes: Number of non-rigid-body vibrational modes to compute (optional. Default:50). -
--output-modes: Number of modes (file-labeled 1 through N, where label 1 is the first non-rigid mode) to write vectors/trajectories for (optional. Default:10). -
--rtb: Use RTB reduction for diagonalization instead of direct full-Hessian diagonalization (optional. Default: disabled).
Skip Flags
Collectivity, contributions, RMSF, DCCM, and mode vector/trajectory writing can each be independently disabled:
--no-vec: Skip writing mode vectors (.xyz)--no-trj: Skip writing mode trajectories (_traj.pdb)--no-collectivity: Skip mode collectivity calculation--no-contributions: Skip the variance-contributions plot--no-rmsf: Skip the NMA-predicted RMSF plot (analytical, from the harmonic approximation — not derived from an MD trajectory; see Analysis for the trajectory-based RMSF computed elsewhere in the package)--no-dccm: Skip the NMA-predicted DCCM plot (same analytical distinction as RMSF above)--no-gpu: Disable GPU acceleration
Post-hoc Mode Re-writer
-w/--write-modes: Write mode vectors/trajectories from a previously completedenmrun's saved*_modes.npy/*_frequencies.npy/structure PDB, without recomputing the ENM. Accepts comma-separated integers and inclusive ranges (start:end), e.g."26,41","7:10","42,44:50". Requires-o/--outputpointing to an existingenmoutput directory.
Note on mode-file resolution: pyadmd enm's mode vector/trajectory files (_mode_{N}.xyz/_mode_{N}_traj.pdb) are written at the ENM's native reduced resolution (Cα-only or heavy-atom only, matching whatever the modes were computed on).
Output Structure
Directory Organization
enm_output/
├── {base_name}_{model}_structure.pdb # reduced‑resolution structure (Cα or heavy atoms)
├── {base_name}_{model}_frequencies.npy # vibrational frequencies (filtered, non‑rigid modes)
├── {base_name}_{model}_modes.npy # eigenvector matrix (filtered, non‑rigid modes)
├── collectivity.csv # per‑mode collectivity (κ) and frequency (cm⁻¹) (omitted with --no-collectivity)
├── mode_contributions.png # per‑mode and cumulative variance contributions (omitted with --no-contributions)
├── rmsf_plot.png # NMA‑predicted residue RMSF (harmonic approximation) (omitted with --no-rmsf)
├── dccm_plot.png # NMA‑predicted residue cross‑correlation matrix (omitted with --no-dccm)
├── dccm_matrix.npy # raw NMA‑DCCM matrix (omitted with --no-dccm)
├── {base_name}_{model}_mode_{N}.xyz # displacement vector of mode N (XYZ format) (omitted with --no-vec)
└── {base_name}_{model}_mode_{N}_traj.pdb # oscillatory PDB trajectory along mode N (multi‑model) (omitted with --no-trj)
Notes:
{base_name}is the stem of the input PDB file (e.g.,system).{model}is eitherca(Cα‑only) orheavy(heavy atoms).- The mode vector and trajectory files are written only for the modes specified by
‑‑output-modes(default: first 10 non‑rigid modes). - The
-w/‑‑write-modesoption re‑uses an existing output directory to write additional mode files (vectors/trajectories) without recomputing the ENM.
Output Files Description
-
Core Data Files
{base_name}_{model}_structure.pdb: PDB file containing only the atoms that participated in the ENM (Cα or heavy atoms). Used as the reference for mode vector/trajectory writing and for RMSF/DCCM plotting.{base_name}_{model}_frequencies.npy: 1D array of vibrational frequencies (in internal angular units, sorted ascending) after removing the six rigid‑body modes.{base_name}_{model}_modes.npy: 2D array of shape(3N, M), where columniis the mass‑weighted eigenvector for modei(matching the order offrequencies). These two NumPy files enable fast post‑hoc re‑writing of vectors/trajectories via-w.
-
Collectivity and Variance Contributions
collectivity.csv: CSV with columnsMode,Frequency (cm⁻¹), andCollectivity. Omitted with‑‑no-collectivity.mode_contributions.png: Two‑panel figure showing (left) the proportion of total mean‑square fluctuation contributed by each of the first‑‑max-modesnon‑rigid modes (proportional to1/λ_kunder equipartition), and (right) the cumulative fraction. Omitted with‑‑no-contributions.
-
NMA‑Predicted RMSF and DCCM
rmsf_plot.png: Residue‑averaged root‑mean‑square fluctuation (Å) derived from the harmonic approximation. The plot is based on the sum over modes of(kBT/λ_k) * |u_i^(k)|² / m_i. Omitted with‑‑no-rmsf.dccm_plot.png: DCCM heatmap, diverging colormap (red = fully correlated, white = uncorrelated, blue = fully anti-correlated).dccm_matrix.npy: Raw correlation matrix, saved alongside the plot. Both are omitted with‑‑no-dccm.
-
Mode‑Specific Vector and Trajectory Files
{base_name}_{model}_mode_{N}.xyz: XYZ‑formatted file listing the displacement vector for modeN. The header includes the mode frequency in cm⁻¹. Omitted with‑‑no-vec.{base_name}_{model}_mode_{N}_traj.pdb: Multi‑model PDB showing a smooth oscillation along modeN. The trajectory is mass‑weighted and scaled to a peak amplitude (default 4 Å). Omitted with‑‑no-trj.
Note: When using the post‑hoc mode re‑writer (pyadmd enm -w "..." -o enm_output), only the mode‑specific vector and trajectory files are newly written for the requested modes; all other files (core data, collectivity, plots) are left untouched and must already exist from a previous full ENM run.
Free Energy Landscape
The fel subcommand computes a free energy landscape (FEL) from a completed set of aMDeNM replicas, following the two-stage protocol of Costa et al..
Method Overview
- Merge trajectories: all
rep*.dcdreplica trajectories are concatenated into a single pseudo-trajectory. - GROMOS clustering: frames are clustered by Cα RMSD (
-s/-c); when the number of clusters exceeds--max-centroids, a maximally diverse subset is selected via greedy farthest-point (MaxMin) sampling on the cluster centroids. - Centroid MD: each centroid undergoes a 4-phase NVT restrained
de-excitation (
-d, progressively decreasing positional restraints on backbone and sidechain heavy atoms) followed by unrestrained NPT production MD (-p). Each de-excitation phase is further split into a 30%/20%/30%/20% pattern of nominal restraint / brief relief dip, where the dip targets a gentler restraint level rather than the nominal one, periodically releasing local strain due to the force constraints. If a centroid's de-excitation fails, it is automatically retried using an alternative member frame from the same cluster (up to 4 substitutes), and if all of those also fail, retried once more with a reinforced integrator ($1 fs$ timestep, $5 ps^{-1}$ friction, applied to de-excitation only) before the centroid is finally marked failed and excluded from the FEL. - Mode projection: every production frame is projected onto each individual normal mode vector as a signed mass-weighted RMS displacement.
- FEL computation: a population histogram (
-bbins) is converted to $\Delta G$ via $\Delta G = -k_{BT} \cdot ln[P(q)/P_{max}]$, computed independently per mode (1D) and for user-specified mode pairs (2D,--modes-2d).
Extending a Previous Free Energy Calculation
fel can be re-invoked on the same simulation with a larger --max-centroids and/or longer -p/--production to extend an earlier calculation, rather than starting over:
- Free to change:
-c/--cutoffand-d/--deexcite. Changing the cutoff only affects the re-thresholding of the cached pairwise-RMSD matrix. Changing the de-excitation length only affects newly-created centroids going forward; existing centroids keep whatever de-excitation they originally had and are simply extended in production. - Must stay the same:
-s/--sel,-T/--temp. Mixing clustering selections or temperatures inside one pooled FEL is not physically valid. - Never shrinks existing work: if
--max-centroidsor-p/--productionis smaller than the previous call, the program warns and uses the larger of the two values instead. We suggest start with smaller values and append more data, if necessary.
Output Structure
Directory Organization
fel/
├── run_metadata.json # parameters used (controls append behavior)
├── clustering_rmsd_cache.npz # cached pairwise-RMSD matrix (reused across calls)
├── clustering_rmsd_cache.json # cache validity metadata (selection, frame count, stride)
├── clustering_summary.csv # per-cluster frame index, size, and production status
├── mode_projections.csv # combined per-frame mode projections (centroid_frame, time, mode_N...)
├── fel_mode[N].csv # 1D FEL data (coordinate, ΔG)
├── fel_mode[N]_plot.png # 1D FEL plot
├── fel_2d_mode[N]_mode[M].png # 2D FEL plot for a mode pair
├── fel_summary.html # HTML summary report
└── centroids/
└── centroid_frame[F]/ # one directory per centroid, named by frame index
├── centroid_[F].dcd # production trajectory (appended to on extension)
├── centroid_[F].log # production logfile (appended to on extension)
├── prod_checkpoint.chk # exact final state, for bit-identical extension
└── checkpoint.chk # periodic (every 10 cycles) checkpoint
Output Files Description
-
Cache Files
run_metadata.json: the clustering selection, temperature, cutoff, de-excitation length,max-centroids, and production length used.clustering_rmsd_cache.npz/.json: the pairwise-RMSD matrix over subsampled frames.clustering_summary.csv: summary containing cluster ID, frame index, cluster size, status this run (fresh/extended/skipped/failed, annotated withsubstitute frame {N}and/orreinforcedwhen a centroid needed those fallbacks),source_frame_used(the frame whose coordinates actually produced a successful run — equal tocentroid_frameunless a substitute member was used),md_attempts(total attempts across the standard and reinforced passes), and cycles/ps completed. Astatusoffailedmeans every attempt (original frame + substitutes, standard + reinforced settings) failed; that centroid is excluded from the FEL rather than blocking the run.mode_projections.csv: every production frame's signed mass-weighted MRMS displacement (Å) along each mode in--modes, one row per(centroid_frame, time)pair, columnscentroid_frame, time, mode_{N}, .... Reused directly bypyadmd analyze -src fel's mode-projection analysis (see Analysis) whenever it already covers every mode that call needs, skipping recomputation entirely.
-
Plot Files
fel_mode[N].csv/fel_mode[N]_plot.png: 1D free energy landscape per mode, in Å and kcal/mol.fel_2d_mode[N]_mode[M].png: 2D free energy landscape for a mode pair.
-
HTML Summary
fel_summary.html: interactive summary with protocol parameters, per-mode FEL statistics, per-centroid production status, and embedded plots.
Analysis
The PyAdMD analysis module provides comprehensive analysis capabilities for molecular dynamics simulations performed using the aMDeNM method. This module processes simulation trajectories and generates detailed structural analysis, visualizations, and summary reports. It can analyze either the aMDeNM replica trajectories from run/restart/append (-src pyadmd, default) or the centroid production trajectories from a completed fel run (-src fel) — see Trajectory Source.
Basic Structural Properties Calculated
-
Root Mean Square Deviation (RMSD): Measures structural deviation from the initial conformation.
-
Radius of Gyration (RoG): Measures the compactness of the protein structure. Useful for identifying folding/unfolding events.
-
Solvent Accessible Surface Area (SASA): Calculates the surface area accessible to solvent molecules.
-
Hydrophobic Exposure: Solvent-accessible surface area (SASA, Ų) contributed by hydrophobic residues (ALA, VAL, LEU, ILE, MET, PHE, TRP, PRO). Useful for identifying folding/unfolding events: buried hydrophobic patches becoming solvent-exposed (or vice versa) is a hallmark of such transitions.
-
Root Mean Square Fluctuation (RMSF): Calculates per-residue flexibility using Cα atoms. Identifies flexible and rigid regions in the protein structure.
-
Secondary Structure Content: Calculates secondary structure elements using DSSP. Tracks helix, sheet, coil, turn, and other structural elements over time and reports the number of residues in each secondary structure type.
-
Dynamic Cross-Correlation Matrix (DCCM): Measures pairwise linear correlation of Cα residue motions after Kabsch superposition to remove rigid-body rotation/translation. Values range from $
+1$ (fully correlated motion) through $0$ (uncorrelated) to $−1$ (fully anti-correlated motion), useful for identifying coupled domains, allosteric communication paths, and correlated/anti-correlated collective motions. -
Linear Mutual Information (LMI): An alternative, signless measure of residue-residue coupling strength (range $
[0, 1]$) computed via the Gaussian approximation of generalized correlation. Unlike DCCM, LMI reports strongly anti-correlated motion with the same high value as strongly correlated motion, since it measures total coupling rather than its direction. -
Mode Projections: Every analyzed frame's signed mass-weighted MRMS displacement (Å) along each individually excited normal mode. Pairs of excited modes are additionally visualized as 2D scatter plots colored by KDE density, useful for seeing which combinations of mode directions the trajectory actually populates.
Analysis Modes
Standard Analysis
- Analyzes every frame of the trajectory
- Provides the highest resolution data
- May be computationally intensive
Rough Analysis
- Analyzes frames at $
5ps$ intervals - Significantly reduces computation time
- Suitable for quick overviews or large systems
Selective Analysis (Skip Flags)
Individual analyses can be disabled at the command line. This is useful when:
- DSSP is not installed (avoid exception error)
- Only a subset of metrics is needed (e.g. RMSD + RMSF only)
- Computation time needs to be minimized (SASA, DSSP, and LMI are the most expensive steps; LMI scales as O(nCα2) with a pairwise covariance computation)
Trajectory Source
The -src/--source flag selects which set of trajectories to analyze:
pyadmd: analyzesrep{N}/rep{N}.dcdreplica trajectories, one analysis unit per replica. Output goes toanalysis/(default).fel: analyzesfel/centroids/centroid_frame{F}/prod.dcdproduction trajectories, one analysis unit per centroid (identified by its merged-trajectory frame index, not a sequential number). Output goes toanalysis/fel/, kept separate frompyadmd-sourced output. All computed metrics (RMSD, RoG, SASA, hydrophobic exposure, RMSF, secondary structure) and skip flags apply identically regardless of source.
In both modes, analyze proceeds even if some units haven't finished — see Handling Incomplete Units below.
Handling Incomplete Units
Before any analysis runs, the program checks whether every unit (replica or centroid) has finished running. Units that haven't are not excluded: they're analyzed using only the cycles they actually completed, with a correctly-scaled time axis reflecting their real elapsed simulation time rather than the run's target time. A console warning lists every incomplete unit (cycles completed/target), and the same information appears in analysis_summary.html under an "Incomplete Units" section.
This means analyze always produces a result, even against a still-running or partially-crashed simulation. If you want a fully completed dataset instead, finish the incomplete units first — restart/append for -src pyadmd, or a further fel call for -src fel — then re-run analyze.
The analysis pipeline is also resilient to being interrupted itself: each unit's results are written to its own output directory as soon as that unit finishes, and a re-run of analyze automatically detects and skips units whose output is already complete, only (re)computing what's missing. Parallel workers are recycled after each unit to keep memory bounded across large batches (e.g. hundreds of fel centroids).
Configuration Parameters
The analysis module reads simulation parameters from the pyAdMD_params.json file, which includes:
- Number of replicas
- Total simulation time
- Atom selection criteria (used to scope RMSD/RoG/SASA/hydrophobic-exposure/DSSP
- Input file paths
When -src fel is used, the shared production time axis (applied uniformly across all centroids) is instead read from fel/run_metadata.json's production_ps value; pyAdMD_params.json is still used to locate the shared PSF topology file and the analysis selection.
Output Structure
Directory Organization
analysis/{fel/}
├── analysis_results.csv # Combined analysis data from all units
├── rmsf.csv # Combined RMSF data (omitted with --no-rmsf)
├── mode_projections.csv # Combined mode-projection data from all units (omitted with --no-modeproj)
├── mode_proj_scatter_mode[N]_mode[M].png # KDE-colored scatter plot for a pair of excited modes (omitted with --no-modeproj)
├── analysis_summary.html # HTML summary report
├── rmsd_plot.png # RMSD plot (omitted with --no-rmsd)
├── radius_gyration_plot.png # Radius of gyration plot (omitted with --no-rg)
├── sasa_plot.png # SASA plot (omitted with --no-sasa)
├── hydrophobic_exposure_plot.png # Hydrophobic exposure plot (omitted with --no-sasa)
├── rmsf_average.png # Average RMSF plot (omitted with --no-rmsf)
├── secondary_structure_average.png # Average secondary structure plot (omitted with --no-dssp)
├── dccm_average.png # Average DCCM heatmap (omitted with --no-dccm)
├── dccm_average.npy # Average DCCM matrix, raw (omitted with --no-dccm)
├── lmi_average.png # Average LMI heatmap (omitted with --no-lmi)
├── lmi_average.npy # Average LMI matrix, raw (omitted with --no-lmi)
└── {rep[1-N]}/ or {centroid_frame[F]}/ # Unit-specific directories
├── analysis_results.csv # Unit-specific analysis data
├── rmsf.csv # Unit-specific RMSF data (omitted with --no-rmsf)
├── rmsd_plot.png # Unit-specific RMSD plot (omitted with --no-rmsd)
├── radius_gyration_plot.png # Unit-specific RoG plot (omitted with --no-rg)
├── sasa_plot.png # Unit-specific SASA plot (omitted with --no-sasa)
├── hydrophobic_exposure_plot.png # Unit-specific hydrophobic exposure plot (omitted with --no-sasa)
├── rmsf_plot.png # Unit-specific RMSF plot (omitted with --no-rmsf)
├── secondary_structure.png # Unit-specific secondary structure plot (omitted with --no-dssp)
├── dccm_matrix.npy # Unit-specific DCCM matrix, raw (omitted with --no-dccm)
├── dccm_plot.png # Unit-specific DCCM heatmap (omitted with --no-dccm)
├── lmi_matrix.npy # Unit-specific LMI matrix, raw (omitted with --no-lmi)
└── lmi_plot.png # Unit-specific LMI heatmap (omitted with --no-lmi)
Note: With -src fel, the same set of files is written under analysis/fel/ instead, with one subdirectory per centroid (named by frame index, mirroring fel/centroids/centroid_frame[F]/) in place of rep[1-N]/.
Output Files Description
-
CSV Files
analysis_results.csv: Time-series data for RMSD, RoG, SASA, hydrophobic exposure, and secondary structure contentrmsf.csv: Per-residue RMSF values for all analyzed units (all replicas, or all centroids with-src fel)mode_projections.csv: Combined per-frame mode-projection data across all analyzed units, columns{unit_col}, time, mode_{N}, ...where{unit_col}isreplica(-src pyadmd) orcentroid_frame(-src fel) andmode_{N}are the individual modes excited inrun(nm_parsed). With-src fel, reused directly fromfel/mode_projections.csvwhen that file already covers every needed mode, instead of being recomputed — see Mode Projections. Omitted with--no-modeproj.
-
Plot Files
- Individual property plots for each unit (replica, or centroid with
-src fel) - Combined plots showing all units
- Average plots across all units
dccm_plot.png/dccm_average.png: DCCM heatmap, diverging colormap (red = fully correlated, white = uncorrelated, blue = fully anti-correlated).lmi_plot.png/lmi_average.png: LMI heatmap, sequential colormap (LMI has no sign).mode_proj_scatter_mode[N]_mode[M].png: One 2D scatter plot per pairwise combination of excited modes, pooling frames from every analyzed unit, colored by KDE density. Omitted with--no-modeproj.
- Individual property plots for each unit (replica, or centroid with
-
Correlation Matrix Files
dccm_matrix.npy(per-unit) /dccm_average.npy(cross-unit): raw (n_Cα × n_Cα) DCCM matrix, values in $[-1, 1]$. Omitted with--no-dccm.lmi_matrix.npy/lmi_average.npy: raw (n_Cα × n_Cα) LMI matrix, values in $[0, 1]$. Omitted with--no-lmi.
-
HTML Summary
- Summary report with tables and embedded plots
- Statistics for each unit and averages across all units
- An "Incomplete Units" section when any unit hadn't reached its target cycle count at analysis time (see Handling Incomplete Units)
Furthermore, some basic analyses are written inside each replica folder at the end of the simulation, they can be found as follows:
- coor-proj.out: projection of the MD coordinates onto the normal mode space described by the excitation vector
- rms-proj.out: the system RMSD displacement along the excitation vectors
- vp-proj.out: projection of the MD velocities onto the normal mode space described by the excitation vector
- ek-proj.out: displays the additional kinetic energy at each MD step, before any re-injection
Usage Examples
Example files are available at the tutorial folder (human calmodulin). We encourage users to test the multiple usages of pyAdMD using these files to get familiar with the method. Replace the tutorial/ paths below with your own OpenMM- or NAMD-compatible inputs.
Using OpenMM inputs and heavy atoms NMs
pyadmd run -src OPENMM \
-psf tutorial/system.psf \
-rst tutorial/system.rst \
-pdb tutorial/system.pdb \
-m HEAVY
Using NAMD inputs and Cα NMs with custom parameters
pyadmd run -src NAMD \
-psf tutorial/system.psf \
-pdb tutorial/system.pdb \
-coor tutorial/system.coor \
-vel tutorial/system.vel \
-xsc tutorial/system.xsc \
-str tutorial/system.str \
-m CA \
-nm 7,8 \
-ek 0.5 \
-t 100 \
-sel "protein and resid 4 to 148" \
-rep 48
Using NAMD inputs and CHARMM NMs without direction correction (standard MDeNM)
pyadmd run -src NAMD \
-psf tutorial/system.psf \
-pdb tutorial/system.pdb \
-coor tutorial/system.coor \
-vel tutorial/system.vel \
-xsc tutorial/system.xsc \
-str tutorial/system.str \
-m CHARMM \
-mod tutorial/system.mod \
--no-correc
Using ENM recalculation with harmonized subspace transport
pyadmd run -src OPENMM \
-psf tutorial/system.psf \
-rst tutorial/system.rst \
-pdb tutorial/system.pdb \
-m CA \
-nm 7,8,9 \
-ek 1 \
-r \
--recalc-method harmonized \
--subspace-search-modes 7,8,9,10,11,12,13,14,15,16 \
--subspace-alpha 0.5
Using alpha harmonization with beta diversification
Three active modes (7–9), a ten-mode search reservoir (7–16), alpha = 0.5, beta = 0.2, and 1.2 kcal/mol excitation energy over 500 ps:
pyadmd run -src OPENMM \
-psf tutorial/system.psf \
-rst tutorial/system.rst \
-pdb tutorial/system.pdb \
-m CA \
-nm 7,8,9 \
-ek 1.2 \
-t 500 \
-rep 24 \
-seed 42 \
--cycle-steps 50 \
-r \
--recalc-method harmonized \
--subspace-search-modes 7,8,9,10,11,12,13,14,15,16 \
--subspace-alpha 0.5 \
--subspace-beta 0.2
Run from a new simulation directory. The excitation selection must include all ENM representative atoms. For four active modes with the default three supplementary directions, use -nm 7,8,9,10 with the same reservoir; for four plus four, also add --subspace-beta-count 4 and provide at least eight reservoir modes. To run the alpha-only counterpart in a separate directory, set --subspace-beta 0. Beta changes the geometry of the combined direction; -ek independently sets its energy target. See Optional Transverse Diversification with Beta.
Restart unfinished pyAdMD simulations
pyadmd restart
Append 100 ps to previously finished pyAdMD simulations
pyadmd append -t 100
Analyze pyAdMD simulations (all frames)
pyadmd analyze
Analyze every 5 ps skipping DSSP and LMI
pyadmd analyze -r --no-dssp --no-lmi
Compute a free energy landscape
pyadmd fel -c 2 -p 100
Extend a previous free energy calculation with more centroids and production time
pyadmd fel -c 2 -p 500 --max-centroids 100
Compute a standalone ENM (Cα model, writing modes 7-16)
pyadmd enm -i tutorial/system.pdb -o enm_output -m CA
Re-write additional modes from a previous ENM run
pyadmd enm -w "15,20:22" -o enm_output
Clean previous setup files
pyadmd clean
Installation
pyadmd is published on PyPI and it can be installed by:
pip install pyadmd
Alternatively, install from source (pyproject.toml, src/ layout). From the
repository root:
pip install .
pyadmd requires a CUDA-enabled GPU. Two dependencies need to be told about
your CUDA toolkit version — both default to CUDA 12.x here:
openmm[cuda12]: the baseopenmmPyPI package only ships the CPU/OpenCL/Reference platforms; the[cuda12]extra additionally installs the CUDA-compiled platform (pip-native — no separate conda install or source build needed).cupy-cuda12x: imported unconditionally at module load time (enm/calculator.py), so it's a required dependency, not optional.
If your CUDA toolkit is 12.x but a different minor/major release, or CUDA
13.x, adjust the openmm[cuda12] extra to openmm[cuda13] accordingly.
Note: OpenMM's pip wheels only build CUDA platforms for CUDA 12 and
above — if your CUDA toolkit is 11.x, the [cuda12]/[cuda13] pip extras
won't work; drop the extra (falling back to the OpenCL platform) or install
via conda instead (conda install -c conda-forge openmm, which supports
older CUDA versions), then pip install the rest of pyadmd's dependencies
into that environment. Either way, also swap cupy-cuda12x>=13.6 for
cupy-cuda11x>=13.6 in pyproject.toml.
Dependencies
Python dependencies are declared in pyproject.toml and installed automatically
by pip install. Requires Python ≥ 3.12. Core dependencies:
numpy>=2.2.5scipy>=1.16.0mdanalysis>=2.9.0matplotlib>=3.10.0seabornpandasopenmm[cuda12]>=8.3.1(the[cuda12]extra installs the CUDA-compiled OpenMM platform; substitute[cuda13]for a CUDA 13.x toolkit. See the OpenMM installation guide.)numba>=0.61.2biopythoncupy-cuda12x>=13.6(GPU-accelerated ENM diagonalization)
External system dependency (must be installed separately):
dssp(>=4.2.2), required for secondary structure analysis. Refer to the DSSP official GitHub repository for building details.
Citing
Please cite the following paper if you are using any Adaptive MDeNM application in your work:
Resende-Lara, P. T. et al. Adaptive Normal Mode Sampling (aMDeNM) Enhances Exploration of Protein Conformational Space and Reveals the Functional Role of Frequency Coupling. J. Chem. Theory Comput. 14 July 2026; 22 (13): 6304–6321. https://doi.org/10.1021/acs.jctc.6c00398
License
This project is licensed under the GNU General Public License v3.0 (GPLv3) and is distributed as is, with absolutely no warranty. See the LICENSE file for the full text.
Contact
If you experience a bug or have a suggestion, please contact:
Metadata
Release files for pyadmd 3.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyadmd-3.6.0.tar.gz | 3.7 MB | With provenance | Details for pyadmd-3.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyadmd-3.6.0-py3-none-any.whl | Python 3 | none | any | Details for pyadmd-3.6.0-py3-none-any.whl |
Total release size: 7.3 MB
Release files / pyadmd-3.6.0.tar.gz
| Download URL | pyadmd-3.6.0.tar.gz |
|---|---|
| Size | 3.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fdcf7cdc107a14230acd5c1e45d99f57331e7f59e2b52bcd8286f88cb82bf91
|
|
BLAKE2b-256 checksum How to use checksums |
157bd2afd33c8184778645053a537672a36ef35cfb046755770b5a1f93a8ca33
|
| 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 17, 2026.
Transparency logRelease files / pyadmd-3.6.0-py3-none-any.whl
| Download URL | pyadmd-3.6.0-py3-none-any.whl |
|---|---|
| Size | 3.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dde1df2b4c89c78edd045504832016ff5360d257f5afc7b6fcb0d0d3e0f12747
|
|
BLAKE2b-256 checksum How to use checksums |
8296b0dbe818f2c2cd7f1ec815223ceb594b76985bcd3900a015aa45556ff1cd
|
| 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 17, 2026.
Transparency logSecurity for pyadmd 3.6.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.
Attestation for pyadmd-3.6.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 Nov 17, 2026.
Transparency logA 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.