def getAtomsInSameFragment(self, a1, a2=0): if not is_int(a1) or not is_int(a2): raise ValueError if a2 != 0: raise ValueError tmp = openbabel.vectorInt() self.mol.FindChildren(tmp, a2, a1) fragment = sorted(toList(tmp) + [a1]) return fragment
def getAtomsInSameFragment(self, a1, a2 = 0): if not is_int(a1) or not is_int(a2): raise ValueError if a2 != 0: raise ValueError tmp = openbabel.vectorInt() self.mol.FindChildren(tmp, a2, a1) fragment = sorted(toList(tmp) + [a1]) return fragment
def fragment_size(self, a, b): # size of fragment b if a-b were broken c1 = ob.vectorInt() self.mol.FindChildren(c1,a.GetIdx(),b.GetIdx()) #for atom in c1: # if self.mol.GetAtom(atom).GetValence() == 1: return 1+len(c1)
def getAtomsInSameFragment(self, a1, a2 = 0): """ The heart of FragIt. This method determines fragments in a system. It works by finding all possible atoms between two end-points in the molecular graph by calling the FindChildren method of OBMol. Note: There is some dark art going on here since a2 is apparently always zero. """ if not isinstance(a1, int) or not isinstance(a2, int): raise ValueError if a2 != 0: raise ValueError tmp = openbabel.vectorInt() self.mol.FindChildren(tmp, a2, a1) fragment = sorted(toList(tmp) + [a1]) return fragment
def getAtomsInSameFragment(self, a1, a2=0): """ The heart of FragIt. This method determines fragments in a system. It works by finding all possible atoms between two end-points in the molecular graph by calling the FindChildren method of OBMol. Note: There is some dark art going on here since a2 is apparently always zero. """ if not isinstance(a1, int) or not isinstance(a2, int): raise ValueError if a2 != 0: raise ValueError tmp = openbabel.vectorInt() self.mol.FindChildren(tmp, a2, a1) fragment = [value for value in tmp] + [a1] return sorted(fragment)
def fragment_size(self, a, b): # size of fragment b if a-b were broken c1 = openbabel.vectorInt() self.mol.OBMol.FindChildren(c1,a.GetIdx(),b.GetIdx()) return len(c1) + 1
def fragment_size(self, a, b): # size of fragment b if a-b were broken c1 = openbabel.vectorInt() self.mol.OBMol.FindChildren(c1, a.GetIdx(), b.GetIdx()) return len(c1) + 1