rmsd#

biotite.structure.rmsd(reference, subject)[source]#

Calculate the RMSD between two structures.

The root-mean-square-deviation (RMSD) indicates the overall deviation of each model of a structure to a reference structure. It is defined as:

\[RMSD = \sqrt{ \frac{1}{n} \sum\limits_{i=1}^n (x_i - x_{ref,i})^2}\]
Parameters:
referenceAtomArray or ndarray, dtype=float, shape=(n,3)

The reference structure. Alternatively, coordinates can be provided directly as ndarray.

subjectAtomArray or AtomArrayStack or ndarray, dtype=float, shape=(n,3) or shape=(m,n,3)

Structure(s) to be compared with reference. Alternatively, coordinates can be provided directly as ndarray.

Returns:
rmsdfloat or ndarray, dtype=float, shape=(m,)

RMSD between subject and reference. If subject is an AtomArray a float is returned. If subject is an AtomArrayStack a ndarray containing the RMSD for each model is returned.

See also

rmsf

Notes

This function does not superimpose the subject to its reference. In most cases superimpose() should be called prior to this function.

Examples

Calculate the RMSD of all models to the first model:

>>> superimposed, _ = superimpose(atom_array, atom_array_stack)
>>> rms = rmsd(atom_array, superimposed)
>>> print(np.around(rms, decimals=3))
[0.000 1.928 2.103 2.209 1.806 2.172 2.704 1.360 2.337 1.818 1.879 2.471
 1.939 2.035 2.167 1.789 1.653 2.348 2.247 2.529 1.583 2.115 2.131 2.050
 2.512 2.666 2.206 2.397 2.328 1.868 2.316 1.984 2.124 1.761 2.642 1.721
 2.571 2.579]