def _get_atom_valence(self, atom: Chem.Atom): """ Cannot get the normal way as it cannot be sanitised. :param atom: :return: """ valence = 0 for bond in atom.GetBonds(): valence += bond.GetBondTypeAsDouble() return valence - atom.GetFormalCharge()
def is_sp2(atom: Chem.Atom) -> bool: N_neigh = len(atom.GetBonds()) symbol = atom.GetSymbol() if symbol == 'H': return False elif symbol == 'N' and N_neigh < 3: return True elif symbol == 'C' and N_neigh < 4: return True elif symbol == 'O' and N_neigh < 2: return True else: return False
def find_bonders(atom: Chem.Atom) -> List[Chem.Atom]: return [get_other(bond, atom) for bond in atom.GetBonds()]