stko.RmsdMappedCalculator
- class stko.RmsdMappedCalculator(initial_molecule, ignore_hydrogens=False)[source]
Bases:
RmsdCalculatorCalculates the root mean square distance between molecules.
This calculator allows for different molecules but they should be aligned, see the example below. It will calculate the RMSD based on the nearest atom of the same class (element). Both molecules are moved to a centroid position of (0, 0, 0). The number of atoms is based on the mol input into calculate.
Warning: the RMSD depends on the order, i.e. it is not guaranteed to be the same when you switch the initial and test molecule.
Examples
import stk import stko import numpy as np bb1 = stk.BuildingBlock('C1CCCCC1') # Fake rotation of new molecule. bb2 = stk.BuildingBlock('C1CCCCC1').with_rotation_about_axis( 1.34, np.array((0, 0, 1)), np.array((0, 0, 0)), ) # Get RMSD without alignment. calculator = stko.RmsdMappedCalculator(bb1) results = calculator.get_results(bb2) rmsd = results.get_rmsd() # Align the molecules. optimizer = stko.Aligner(bb1, (('C', 'C'), )) aligned_bb2 = optimizer.optimize(bb2) calculator = stko.RmsdMappedCalculator(bb1) results = calculator.get_results(aligned_bb2) rmsd = results.get_rmsd()
Methods
Calculate the RMSD between mol and the initial molecule.
- Parameters:
initial_molecule (Molecule)
ignore_hydrogens (bool)
- get_results(mol)
Calculate the RMSD between mol and the initial molecule.
- Parameters:
mol (Molecule) – The
stk.Moleculeto calculate RMSD to.- Returns:
The RMSD between the molecules.
- Return type: