示例#1
0
def save_mol_as(root,mollist,gfx):
	if mollist.curselection()==():
		MB.showwarning('Info','Select a molecule in Mol List for saving it')
		return
	for molit in mollist.curselection():
		for mol in gfx.mol:
			if mollist.get(molit)==mol.un:
				fn = FD.asksaveasfilename(parent=root,filetypes=[('PDB files','*.pdb')] ,title="Save molecule %s coordinates as..."%mol.un)
				if len(fn ) > 0:
					if not fn.endswith('.pdb'):
						fn = fn +'.pdb'
		    			mat = mol.acteur.GetMatrix() #recuperation de la mat de pv 4x4
		    			R = array(sym.ExtractRotMat(mat)) #extraction de la matrice de rotation depuit la vtk 4x4
					t = array([mat.GetElement(0,3),mat.GetElement(1,3),mat.GetElement(2,3)]) #extract tx,ty,tz
					pdbin=open(mol.mod.fn,"r")
					pdbout=open(fn,"w")
					for ligne in pdbin:
						if (ligne[0:6] == "ATOM  " or ligne[0:6] == "HETATM"):
							x = float(ligne[30:38])
							y = float(ligne[38:46])
							z = float(ligne[46:54])
							r = array([x,y,z])
							newr = dot(R,r) + t
							ligne=ligne[:30]+"%8.3f%8.3f%8.3f"%tuple(newr)+ligne[54:]
						pdbout.write(ligne)
					#ferme les fichiers
					pdbin.close()
					pdbout.close()
					return
示例#2
0
文件: uro.py 项目: ggoret/VEDA
 def frame(self):
     mol = self.gfx.mol[self.gfx.whichmol - 1]
     mat = mol.acteur.GetMatrix()
     (a, b, g) = sym.R2Eul(sym.ExtractRotMat(mat))
     (x, y, z) = [
         mat.GetElement(0, 3),
         mat.GetElement(1, 3),
         mat.GetElement(2, 3)
     ]
     return '%.3f %.3f %.3f %.3f %.3f %.3f \n' % (a, b, g, x, y, z)
示例#3
0
文件: uro.py 项目: ggoret/VEDA
 def build_fitin_file(self):
     go = open('G0', 'w')
     for mol in self.gfx.mol:
         mat = mol.acteur.GetMatrix()
         nbsymop = len(mol.lnbsm)
         strsymlist = str(mol.lnbsm)[1:-1].replace(',', '')
         (a, b, g) = sym.R2Eul(sym.ExtractRotMat(mat))
         (x, y, z) = [
             mat.GetElement(0, 3),
             mat.GetElement(1, 3),
             mat.GetElement(2, 3)
         ]
         go.write(' #%2d %.3f %.3f %.3f %.3f %.3f %.3f %d %s\n' %
                  (mol.mod.id, a, b, g, x, y, z, nbsymop, strsymlist))
     go.close()
示例#4
0
文件: uro.py 项目: ggoret/VEDA
def fitin_io(p, mol):
    mat = mol.acteur.GetMatrix()
    (a, b, g) = sym.R2Eul(sym.ExtractRotMat(mat))
    (x, y,
     z) = [mat.GetElement(0, 3),
           mat.GetElement(1, 3),
           mat.GetElement(2, 3)]
    frame = '%.3f %.3f %.3f %.3f %.3f %.3f \n' % (a, b, g, x, y, z)
    try:
        p.stdin.write(frame)
        l = p.stdout.read(77)
        return float(l.split()[-1])
    except:
        MB.showwarning(
            'Error',
            'Problem in function ccprofile, process fitin must be dead ... RIP'
        )
示例#5
0
文件: Nma.py 项目: ggoret/VEDA
    def build_nm_fitin_file(self):
        no = open('N0', 'w')
        for mol in self.gfx.mol:
            mat = mol.acteur.GetMatrix()
            nbsymop = len(mol.lnbsm)
            strsymlist = str(mol.lnbsm)[1:-1].replace(',', '')
            (a, b, g) = sym.R2Eul(sym.ExtractRotMat(mat))
            (x, y, z) = [
                mat.GetElement(0, 3),
                mat.GetElement(1, 3),
                mat.GetElement(2, 3)
            ]
            if mol.id == self.currentmol.id:
                cur = ' #%2d %.3f %.3f %.3f %.3f %.3f %.3f %d %s\n' % (
                    33, a, b, g, x, y, z, nbsymop, strsymlist)
            else:
                no.write(' #%2d %.3f %.3f %.3f %.3f %.3f %.3f %d %s\n' %
                         (mol.mod.id, a, b, g, x, y, z, nbsymop, strsymlist))

        no.write(cur)
        no.close()
示例#6
0
文件: Nma.py 项目: ggoret/VEDA
 def save_conf_as(self, gfx):
     conf = self.currentmol.nmcl[self.gfx.itf.varconformerSitu.get() +
                                 self.nbstep]
     fn = FD.asksaveasfilename(
         parent=self.gfx.itf.root,
         filetypes=[('PDB files', '*.pdb')],
         title="Save conformer %d coordinates as..." %
         (self.gfx.itf.varconformerSitu.get() + self.nbstep))
     if len(fn) > 0:
         if not fn.endswith('.pdb'):
             fn = fn + '.pdb'
         mat = conf.GetMatrix()  #recuperation de la mat de pv 4x4
         R = array(sym.ExtractRotMat(
             mat))  #extraction de la matrice de rotation depuit la vtk 4x4
         t = array([
             mat.GetElement(0, 3),
             mat.GetElement(1, 3),
             mat.GetElement(2, 3)
         ])  #extract tx,ty,tz
         pdbin = open(
             gfx.tmpdir + '/%s/' % self.currentmol.mod.un + 'out%s' %
             (self.gfx.itf.varconformerSitu.get()), "r")
         pdbout = open(fn, "w")
         for ligne in pdbin:
             if (ligne[0:6] == "ATOM  " or ligne[0:6] == "HETATM"):
                 x = float(ligne[30:38])
                 y = float(ligne[38:46])
                 z = float(ligne[46:54])
                 r = array([x, y, z])
                 newr = dot(R, r) + t
                 ligne = ligne[:30] + "%8.3f%8.3f%8.3f" % tuple(
                     newr) + ligne[54:]
             pdbout.write(ligne)
         pdbin.close()
         pdbout.close()
         return
示例#7
0
文件: uro.py 项目: ggoret/VEDA
def cc_profile(gfx, mollist, anglemin, anglemax, step, axe):
    if gfx.ifit != None:
        MB.showwarning('Info', 'Stop Interactve Fitting')
        return
    for mol in gfx.mol:
        if mollist.get(tk.ACTIVE) == mol.un:
            chdir(gfx.workdir)
            gfx.fit.build_fitin_file()
            init_ifit_file(gfx, gfx.fit.fitreslow, gfx.fit.fitreshigh)
            p = Popen(['e/fitin', 'G0'],
                      bufsize=0,
                      stdin=PIPE,
                      stdout=PIPE,
                      stderr=PIPE,
                      universal_newlines=True)
            print 'Automatic Sampling Started'
            profile = open('%s.%s.profile' % (axe, mol.un), 'w')
            p.stdin.write('#%2d \n' % mol.id)
            l = p.stdout.read(31)
            print l
            if axe == 'X':
                v = (1, 0, 0)
            elif axe == 'Y':
                v = (0, 1, 0)
            elif axe == 'Z':
                v = (0, 0, 1)
            else:
                print 'strange axe ...'
                return
            mat = mol.acteur.GetMatrix()
            mat3x3 = sym.ExtractRotMat(mat)
            R = array(mat3x3)
            ivect = dot(R, v)
            (sa, sb, sg) = sym.R2Eul(mat3x3)
            angle = anglemin
            while angle < anglemax:
                gfx.sym.render = 0
                mol.acteur.SetOrientation(0, 0, 0)
                RotaEuler(mol.acteur, sa, sb, sg)
                gfx.sym.render = 1
                mol.acteur.RotateWXYZ(angle, ivect[0], ivect[1], ivect[2])
                cc = fitin_io(p, mol)
                try:
                    print '%f  %f' % (angle, cc)
                except TypeError:
                    MB.showwarning(
                        'Error',
                        'cc_profile : Interactive Fitting encountered a problem; go to help'
                    )
                    return
                profile.write('%f  %f \n' % (angle, cc))
                angle += step
            profile.close()
            gfx.sym.render = 0
            mol.acteur.SetOrientation(0, 0, 0)
            RotaEuler(mol.acteur, sa, sb, sg)
            gfx.renwin.Render()
            gfx.sym.render = 1
            try:
                p.stdin.write('\n')
            except:
                MB.showwarning(
                    'Error',
                    'cc_profile : Interactive Fitting terminated badly')
            print 'Automatic Sampling Stopped'
            system("gnuplot -persist <<ENDOF\n plot '%s' with line\nENDOF" %
                   '%s.%s.profile' % (axe, mol.un))
示例#8
0
def printmolpv(gfx):
	for mol in gfx.mol:
		mat=mol.acteur.GetMatrix()
		(a,b,g) = sym.R2Eul(sym.ExtractRotMat(mat))
		(x,y,z) = [mat.GetElement(0,3),mat.GetElement(1,3),mat.GetElement(2,3)]
		print' mol : %d : %.3f %.3f %.3f %.3f %.3f %.3f\n'%(mol.id,a,b,g,x,y,z)