Structure.compare_structures#

classmethod Structure.compare_structures(structure1, structure2, origin=None, sampling_rate=None, weighted=False)[source]#

Compute root mean square deviation (RMSD) between two structures with the same number of atoms.

Parameters:
structure1, structure2Structure

Structure instances to compare.

origintuple of floats, optional

Coordinate system origin. For computing RMSD on discretized grids.

sampling_ratetuple of floats, optional

Sampling rate in units of atom_coordinate. For computing RMSD on discretized grids.

weightedbool, optional

Whether atoms should be weighted acoording to their atomic weight.

Returns:
float

Root Mean Square Deviation between input structures.

Examples

>>> from importlib_resources import files
>>> from tme.matching_utils import get_rotation_matrices
>>> from tme import Structure
>>> fname = str(files("tests.data").joinpath("Structures/5khe.cif"))
>>> structure = Structure.from_file(filename=fname)
>>> transformed = structure.rigid_transform(
>>>     rotation_matrix = get_rotation_matrices(60)[2],
>>>     translation = (0, 1, -5)
>>> )
>>> Structure.compare_structures(structure, transformed)
31.35238
>>> Structure.compare_structures(structure, structure)
0.0