def check_connectivity(bond_set, filename): """ Check if the connectivity in the molecule file is consistent with geometry Using force balance Molecule.build_bonds() for this first draft This can be improved by OpenEye or other methods """ fbmol = Molecule(filename) fbmol.build_bonds() new_bonds = set(fbmol.bonds) return bond_set == new_bonds
def check_connectivity(filename): """ Check if the connectivity in the molecule file is consistent with geometry Using force balance Molecule.build_bonds() for this first draft This can be improved by OpenEye or other methods """ fbmol = Molecule(filename) orig_bonds = set(fbmol.bonds) # for b1, b2 in fbmol.bonds: # bond = (b1, b2) if b1 < b2 else (b2, b1) # orig_bonds.add(bond) fbmol.build_bonds() new_bonds = set(fbmol.bonds) # for b1, b2 in fbmol.bonds: # bond = (b1, b2) if b1 < b2 else (b2, b1) # new_bonds.add(bond) return orig_bonds == new_bonds