def _reconstruct_mol_from_conformer(
    mol: Molecule,
    positions: unit.Quantity,
) -> Molecule:
    mol = deepcopy(mol)
    mol._conformers = None
    mol.add_conformer(positions)
    return mol
Example #2
0
def _get_rms_two_conformers(mol: Molecule, positions1: unit.Quantity,
                            positions2: unit.Quantity) -> float:
    """Find the RMSD between two conformers of a molecule using RDKit"""
    # TODO: Is it worth making Molecule.get_rmsd(), which operates
    # through ToolkitWrapper methods?
    from rdkit.Chem import rdMolAlign

    mol_copy = Molecule(mol)
    mol_copy._conformers = None
    mol_copy.add_conformer(positions1)
    mol_copy.add_conformer(positions2)

    rdmol = mol_copy.to_rdkit()
    rmslist: List = []
    rdMolAlign.AlignMolConformers(rdmol, RMSlist=rmslist)

    return rmslist[0]