[Rdkit-discuss] Chem.RemoveHs does not remove explicit hydrogens
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: Steven K. <ke...@go...> - 2019-06-17 19:41:10
|
mol = Chem.MolFromSmiles('C(C(=O)C([H])([H])[H])([H])([H])[H]') for atom in mol.GetAtoms(): print(atom.GetNumImplicitHs(), atom.GetNumExplicitHs()) >>> 0 3 0 0 0 0 0 3 mol_noh = Chem.RemoveHs(mol, updateExplicitCount=True) for atom in mol_noh.GetAtoms(): print(atom.GetNumImplicitHs(), atom.GetNumExplicitHs()) >>> 0 3 0 0 0 0 0 3 Note that if I add the hydrogens first, everything works as expected: mol_h = Chem.AddHs(mol, explicitOnly=True) mol_noh = Chem.RemoveHs(mol_h) for atom in mol_noh.GetAtoms(): print(atom.GetNumImplicitHs(), atom.GetNumExplicitHs()) >>> 3 0 0 0 0 0 3 0 Perhaps this is expected behavior? |