TRANS.append(random.uniform(-1,1)*tscale) if verbose: print('translation=', TRANS) #rot = [1,0,0,180] #for the rotation axis, use xscale rot = [] for ind in range(3): rot.append(random.uniform(-1,1)*xscale) #for the rotation angle rot.append(random.uniform(-1,1)*ascale) if verbose: print('axis=', rot[:3], ' and angle=', rot[-1]) #torsions: dihe = [] for ind in range(ndihe): dihe.append(dscale * random.uniform(-1,1)) if verbose: print('dihe=', dihe) conf = Conformation(m, origin, TRANS, rot, dihe) new_coords = conf.getCoords() #verify that no new bonds would be formed for this conformation m.allAtoms.updateCoords(new_coords, ind=coord_index) #remove all original bonds and set hasBonds to 0 on all levels del(m.allAtoms.bonds) m.hasBonds=0 for c in m.chains: c.hasBonds=0 for r in m.chains.residues: r.hasBonds=0 for a in m.allAtoms: a.bonds = BondSet([]) a.hasBonds = 0 m.buildBondsByDistance() newLen = len(m.allAtoms.bonds[0]) if verbose: print("originally %d bonds form; after transformation %d bonds form" %(orig, newLen)) new_d = {}
eline = states[i + 1] #build a states from each of the lines in statefile #State:\t 4.847 -2.386 14.760 -0.413 0.552 -0.724 4.257 58.27 -33.47 -87.92 134.64 -36.46 114.79 -44.86 -74.96 -118.53 77.29 139.08 78.23 -52.09 -12.69 35.08 -118.21 -175.94\n' fl = map(float, sline.split()[1:]) assert len(fl) == length_of_state # 0 1 2 3 4 5 6 [7.... #[t1,t2,t3,q1,q2,q3,q4,tors1,tors2, tors3.... # translation = fl[:3] quaternion = [fl[6], fl[3:6]] #energy = eline.split()[8] energy = eline.split()[index_of_energy] torsion_angles = [] if ntors > 0: torsion_angles = fl[7:] newConf = Conformation(lig, origin, translation, quaternion, torsion_angles) newCrds = newConf.getCoords() if interim_state: #here's where to add back the origin or ? newCrds -= origin #write some MODEL stuff then newCrds ostr = "MODEL %d\n" % ctr outptr.write(ostr) ctr += 1 ostr = "REMARK AD4 RESULT: %s\n" % energy #put energy here... outptr.write(ostr) #lig.parser.write_with_new_coords(newCrds,outptr) ct = 0 for l in ligLines: if l.find("ATOM") == 0 or l.find("HETATM") == 0: cc = newCrds[ct]
TRANS.append(random.uniform(-1,1)*tscale) if verbose: print 'translation=', TRANS #rot = [1,0,0,180] #for the rotation axis, use xscale rot = [] for ind in range(3): rot.append(random.uniform(-1,1)*xscale) #for the rotation angle rot.append(random.uniform(-1,1)*ascale) if verbose: print 'axis=', rot[:3], ' and angle=', rot[-1] #torsions: dihe = [] for ind in range(ndihe): dihe.append(dscale * random.uniform(-1,1)) if verbose: print 'dihe=', dihe conf = Conformation(m, origin, TRANS, rot, dihe) new_coords = conf.getCoords() #verify that no new bonds would be formed for this conformation m.allAtoms.updateCoords(new_coords, ind=coord_index) #remove all original bonds and set hasBonds to 0 on all levels del(m.allAtoms.bonds) m.hasBonds=0 for c in m.chains: c.hasBonds=0 for r in m.chains.residues: r.hasBonds=0 for a in m.allAtoms: a.bonds = BondSet([]) a.hasBonds = 0 m.buildBondsByDistance() newLen = len(m.allAtoms.bonds[0]) if verbose: print "originally %d bonds form; after transformation %d bonds form" %(orig, newLen) new_d = {}
eline =states[i+1] #build a states from each of the lines in statefile #State:\t 4.847 -2.386 14.760 -0.413 0.552 -0.724 4.257 58.27 -33.47 -87.92 134.64 -36.46 114.79 -44.86 -74.96 -118.53 77.29 139.08 78.23 -52.09 -12.69 35.08 -118.21 -175.94\n' fl = map(float, sline.split()[1:]) assert len(fl)==length_of_state # 0 1 2 3 4 5 6 [7.... #[t1,t2,t3,q1,q2,q3,q4,tors1,tors2, tors3.... # translation = fl[:3] quaternion = [fl[6],fl[3:6]] #energy = eline.split()[8] energy = eline.split()[index_of_energy] torsion_angles = [] if ntors>0: torsion_angles = fl[7:] newConf = Conformation(lig,origin,translation, quaternion, torsion_angles) newCrds = newConf.getCoords() if interim_state: #here's where to add back the origin or ? newCrds -= origin #write some MODEL stuff then newCrds ostr = "MODEL %d\n"%ctr outptr.write(ostr) ctr += 1 ostr = "REMARK AD4 RESULT: %s\n" %energy #put energy here... outptr.write(ostr) #lig.parser.write_with_new_coords(newCrds,outptr) ct = 0 for l in ligLines: if l.find("ATOM")==0 or l.find("HETATM")==0: cc = newCrds[ct]