def set_rotatable_bonds_from_file(self,mol): assert mol.allAtoms.bonds[0] assert hasattr(self, 'activeInFile') mol.allAtoms.bonds[0].possibleTors = 0 mol.allAtoms.bonds[0].activeTors = 0 for ll in self.activeInFile: # 0 1 2 3 4 5 6 7 #ex: ll = ['REMARK', '1', 'A', 'between', 'atoms:', 'N1_1', 'and', 'C31_39'] name1, index1 = ll[5].split('_') #index1 is NOT usable ['N1','1']@@ name2, index2 = ll[7].split('_') #index2 is NOT ['C31','39'] #at1 = mol.allAtoms[int(index1)-1] at1 = mol.allAtoms.get(name1)[0] #if len(ats1)==1: # at1 = ats1[0] #else: #?WHAT TO DO IF more than one? # ?check for bonded atom named at2 ATS2 = mol.allAtoms.get(name2) if len(ATS2)==1: at2 = ATS2[0] else: for at in ATS2: if at.isBonded(at1): at2 = at break #at2 = mol.allAtoms[int(index2)-1] bnd = AtomSet([at1,at2]).bonds[0] bnd.possibleTors = 1 bnd.activeTors = 1 #?verify 'A' if ll[2]=='I': bnd.activeTors = 0
def set_rotatable_bonds_from_file(self, mol): assert mol.allAtoms.bonds[0] assert hasattr(self, 'activeInFile') mol.allAtoms.bonds[0].possibleTors = 0 mol.allAtoms.bonds[0].activeTors = 0 for ll in self.activeInFile: # 0 1 2 3 4 5 6 7 #ex: ll = ['REMARK', '1', 'A', 'between', 'atoms:', 'N1_1', 'and', 'C31_39'] name1, index1 = ll[5].split( '_') #index1 is NOT usable ['N1','1']@@ name2, index2 = ll[7].split('_') #index2 is NOT ['C31','39'] #at1 = mol.allAtoms[int(index1)-1] at1 = mol.allAtoms.get(name1)[0] #if len(ats1)==1: # at1 = ats1[0] #else: #?WHAT TO DO IF more than one? # ?check for bonded atom named at2 ATS2 = mol.allAtoms.get(name2) if len(ATS2) == 1: at2 = ATS2[0] else: for at in ATS2: if at.isBonded(at1): at2 = at break #at2 = mol.allAtoms[int(index2)-1] bnd = AtomSet([at1, at2]).bonds[0] bnd.possibleTors = 1 bnd.activeTors = 1 #?verify 'A' if ll[2] == 'I': bnd.activeTors = 0