RMSF Calculator

GitHub Link to Code.

Calculator utilities for RMSF computations.

class mdxplain.analysis.structure.calculators.rmsf_calculator.RMSFCalculator(trajectories: Iterable[Trajectory], chunk_size: int, use_memmap: bool, trajectory_names: List[str] = None)

Perform RMSF calculations with optional chunk-aware processing.

The calculator mirrors RMSDCalculator but focuses on atom-wise and residue-wise fluctuations relative to configurable reference structures. Reference coordinates can be derived from mean, median frames and deviations support the same robust metrics.

__init__(trajectories: Iterable[Trajectory], chunk_size: int, use_memmap: bool, trajectory_names: List[str] = None) None

Initialise the RMSF calculator with trajectory data.

Parameters

trajectoriesIterable[md.Trajectory]

Iterable of trajectory-like objects.

chunk_sizeint

Chunk size used for streaming calculations.

use_memmapbool

Flag indicating whether the trajectories are memory mapped.

trajectory_namesList[str], optional

Names for result mapping. Defaults to “trajectory_0”, “trajectory_1”, etc.

Raises

ValueError

If no trajectories are supplied.

calculate_per_atom(reference_mode: Literal['mean', 'median'], metric: Literal['mean', 'median', 'mad'], atom_indices: ndarray = None, cross_trajectory: bool = False) List[ndarray]

Return per-atom RMSF values for the trajectories.

Builds the requested reference structure, streams trajectory coordinates in chunks and applies the chosen robust metric to the atom-wise squared deviations.

Parameters

reference_mode{‘mean’, ‘median’}

Strategy used to construct the reference structure.

metric{‘mean’, ‘median’, ‘mad’}

Robust metric applied to the squared deviations.

atom_indicesnp.ndarray, optional

Atom indices used for the RMSF calculation. None selects all atoms.

cross_trajectorybool, optional

When True, all trajectories are combined into a single RMSF profile.

Returns

List[np.ndarray]

List of per-atom RMSF arrays. If cross_trajectory=True, returns single element.

calculate_per_residue(reference_mode: Literal['mean', 'median'], metric: Literal['mean', 'median', 'mad'], residue_aggregator: Literal['mean', 'median', 'rms', 'rms_median'], atom_indices: ndarray = None, cross_trajectory: bool = False, reference_trajectory_index: int = 0) List[ndarray]

Return per-residue RMSF values for the trajectories.

Computes per-atom RMSF values with the requested reference and metric and aggregates them residue-wise using the selected aggregator.

Parameters

reference_mode{‘mean’, ‘median’}

Strategy used to construct the reference structure.

metric{‘mean’, ‘median’, ‘mad’}

Robust metric applied to the atom-wise squared deviations.

residue_aggregator{‘mean’, ‘median’, ‘rms’, ‘rms_median’}

Aggregator applied to per-atom RMSF values within each residue.

atom_indicesnp.ndarray, optional

Atom indices used for the RMSF calculation. None selects all atoms.

cross_trajectorybool, optional

When True, all trajectories are combined into a single RMSF profile before residue aggregation.

reference_trajectory_indexint, optional

Index of trajectory providing the topology for residue aggregation.

Returns

List[np.ndarray]

List of per-residue RMSF arrays. If cross_trajectory=True, returns single element.