示例#1
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)
示例#2
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()
示例#3
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'
        )
示例#4
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()
示例#5
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))
示例#6
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)