mdtraj.rmsf

mdtraj.rmsf(target, reference, frame=0, atom_indices=None, parallel=True, precentered=False)

Compute RMSF of all conformations in target to a reference conformation. Note, this will center the conformations in place.

Parameters
targetmd.Trajectory

For each conformation in this trajectory, compute the RMSF to a particular ‘reference’ conformation in another trajectory object.

referencemd.Trajectory, or None

The object containing the reference conformation to measure distances to. If not supplied, it is assumed that the trajectory is already aligned.

frameint, default=0

The index of the conformation in reference to measure distances to.

atom_indicesarray_like, or None

The indices of the atoms to use in the RMSF calculation. If not supplied, all atoms will be used. If the atoms used in alignment and the atoms used in RMSF calculations are different, the trajectory must be aligned first manually.

ref_atom_indicesarray_like, or None

Use these indices for the reference trajectory. If not supplied, the atom indices will be the same as those for target.

parallelbool

Use OpenMP to calculate each of the RMSFs in parallel over multiple cores.

precenteredbool, default=False

Assume that the conformations are already centered at the origin, and that the “rmsd_traces” have been computed, as is done by Trajectory.center_coordinates. The “rmsd_traces” are intermediate calculations needed for the RMSF calculation which can be computed independently on each trajectory. Note that this has the potential to be unsafe; if you use Trajectory.center_coordinates and then modify the trajectory’s coordinates, the center and traces will be out of date and the RMSFs will be incorrect.

Returns
rmsfnp.ndarray, shape=(target.n_frames,)

A 1-D numpy array of the optimal root-mean-square fluctuations from the frame-th conformation in reference to each of the conformations in target.

See also

Trajectory.center_coordinates

Notes

This function uses OpenMP to parallelize the calculation across multiple cores. To control the number of threads launched by OpenMP, you can set the environment variable OMP_NUM_THREADS.

Examples

>>> import mdtraj as md                                      
>>> rmsf = md.rmsf(trajectory, trajectory, 0)                
>>> print rmsf                                               
array([ 0.0,  0.03076187,  0.02549562, ...,  0.06230228,
    0.00666826,  0.24364147])

The calculation is slightly faster if you precenter the trajectory

>>> trajectory.center_coordinates()
>>> rmsf = md.rmsf(trajectory, trajectory, 0, precentered=True)

If the atoms used in alignment and RMSF calculations are different, align the trajectory before using this method.

>>> trajectory.superpose(atom_indices=atom_indices)
>>> rmsf = md.rmsf(trajectory, None, atom_indices=rmsf_atom_indices)