spyrmsd.molecule module
- class spyrmsd.molecule.Molecule(atomicnums: Union[ndarray, List[int]], coordinates: Union[ndarray, List[List[float]]], adjacency_matrix: Optional[Union[ndarray, List[List[int]]]] = None)[source]
Bases:
object
- center_of_geometry() ndarray [source]
Center of geometry.
- Returns
Center of geometry
- Return type
np.ndarray
- center_of_mass() ndarray [source]
Center of mass.
- Returns
Center of mass
- Return type
np.ndarray
Notes
Atomic masses are cached.
- classmethod from_obabel(obmol, adjacency: bool = True)[source]
Constructor from OpenBabel molecule.
- Parameters
obmol – OpenBabel molecule
adjacency – Flag to compute the adjacency matrix
- Returns
spyrmsd
Molecule- Return type
- classmethod from_rdkit(rdmol, adjacency: bool = True)[source]
Constructor from RDKit molecule.
- Parameters
rdmol – RDKit molecule
adjacency – Flag to compute the adjacency matrix
- Returns
spyrmsd
Molecule- Return type
- rotate(angle: float, axis: Union[ndarray, List[float]], units: str = 'rad') None [source]
Rotate molecule.
- Parameters
angle (float) – Rotation angle
axis (np.ndarray) – Axis of rotation (in 3D)
units ({“rad”, “deg”}) – Units of the angle (radians rad or degrees deg)
- spyrmsd.molecule.coords_from_molecule(mol: Molecule, center: bool = False) ndarray [source]
Atomic coordinates from molecule.
- Parameters
mol (molecule.Molecule) – Molecule
center (bool) – Center flag
- Returns
Atomic coordinates (possibly centred)
- Return type
np.ndarray
Notes
Atomic coordinates are centred according to the center of geometry, not the center of mass.