Structure.align_structures#
- classmethod Structure.align_structures(structure1, structure2, origin=None, sampling_rate=None, weighted=False)[source]#
Align
structure2
tostructure1
using the Kabsch Algorithm. Both structures need to have the same number of atoms.- Parameters:
- structure1, structure2
Structure
Structure instances to align.
- 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 by their atomic weight.
- structure1, structure2
- Returns:
Structure
structure2
aligned tostructure1
.- float
Alignment RMSD
Examples
>>> from importlib_resources import files >>> from tme import Structure >>> from tme.matching_utils import get_rotation_matrices >>> 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) >>> ) >>> aligned, rmsd = Structure.align_structures(structure, transformed) Initial RMSD: 31.07189 - Final RMSD: 0.00000