示例#1
0
文件: util.py 项目: Almad/pymol
def performance(mode,_self=cmd):
    pymol=_self._pymol
    cmd=_self
    mode = int(mode)
    if mode==0: # maximum quality
        cmd.set('line_smooth',1)
        cmd.set('depth_cue',1)         
        cmd.set('specular',1)
        cmd.set('surface_quality',1)
        cmd.set('stick_quality',15)
        cmd.set('sphere_quality',2)
        cmd.set('cartoon_sampling',14)
        cmd.set('ribbon_sampling',10)
        cmd.set('transparency_mode',2)
        cmd.set('stick_ball',1)
        cmd.do("rebuild")
    elif mode==33:
        cmd.set('line_smooth',1)         
        cmd.set('depth_cue',1)         
        cmd.set('specular',1)
        cmd.set('surface_quality',0)
        cmd.set('stick_quality',8)
        cmd.set('sphere_quality',1)
        cmd.set('cartoon_sampling',7)
        cmd.set('ribbon_sampling',1)
        cmd.set('transparency_mode',2)
        cmd.set('stick_ball',0)
        cmd.do("rebuild")
    elif mode==66: # good perfomance
        cmd.set('line_smooth',0)
        cmd.set('depth_cue',0)         
        cmd.set('specular',1)
        cmd.set('surface_quality',0)
        cmd.set('stick_quality',8)
        cmd.set('sphere_quality',1)
        cmd.set('cartoon_sampling',6)
        cmd.set('ribbon_sampling',1)
        cmd.set('transparency_mode',2)
        cmd.set('stick_ball',0.0)
        cmd.do("rebuild")         
    else: # maximum performance
        cmd.set('line_smooth',0)
        cmd.set('depth_cue',0)
        cmd.set('specular',0)
        cmd.set('surface_quality',-1) # new
        cmd.set('stick_quality',5)
        cmd.set('sphere_quality',0)
        cmd.set('ribbon_sampling',1)
        cmd.set('cartoon_sampling',3)
        cmd.set('transparency_mode',0)
        cmd.set('stick_ball',0.0)
        cmd.do("rebuild")         
示例#2
0
def alignsg(sele):
   allsg = cmd.get_model("(("+sele+") and (name VSG))").atom
   allsf = cmd.get_model("(("+sele+") and (name S5,S6,S7,S8))").atom
   while allsg:
      closest = [9e9,None,None]
      for sga in allsg:
         for sfa in allsf:
            sg = Vec(sga.coord)
            sf = Vec(sfa.coord)
            if (sg-sf).length() < closest[0]:
               closest = [(sg-sf).length(),sga,sfa]
      sga,sfa = closest[1:]
      allsg.remove(sga)
      allsf.remove(sfa)
      if closest[0] > 10.0: break
      cmd.do("alter_state 1, (("+sele+") and (resi %s and name %s))"%(sga.resi,sga.name)+",x=%f"%sfa.coord[0])
      cmd.do("alter_state 1, (("+sele+") and (resi %s and name %s))"%(sga.resi,sga.name)+",y=%f"%sfa.coord[1])
      cmd.do("alter_state 1, (("+sele+") and (resi %s and name %s))"%(sga.resi,sga.name)+",z=%f"%sfa.coord[2])           
示例#3
0
def alignsg(sele):
    allsg = cmd.get_model("((" + sele + ") and (name VSG))").atom
    allsf = cmd.get_model("((" + sele + ") and (name S5,S6,S7,S8))").atom
    while allsg:
        closest = [9e9, None, None]
        for sga in allsg:
            for sfa in allsf:
                sg = Vec(sga.coord)
                sf = Vec(sfa.coord)
                if (sg - sf).length() < closest[0]:
                    closest = [(sg - sf).length(), sga, sfa]
        sga, sfa = closest[1:]
        allsg.remove(sga)
        allsf.remove(sfa)
        if closest[0] > 10.0: break
        cmd.do("alter_state 1, ((" + sele + ") and (resi %s and name %s))" %
               (sga.resi, sga.name) + ",x=%f" % sfa.coord[0])
        cmd.do("alter_state 1, ((" + sele + ") and (resi %s and name %s))" %
               (sga.resi, sga.name) + ",y=%f" % sfa.coord[1])
        cmd.do("alter_state 1, ((" + sele + ") and (resi %s and name %s))" %
               (sga.resi, sga.name) + ",z=%f" % sfa.coord[2])
示例#4
0
    def parse(self, line):

        if self.control == None:
            self.blurt("your control is unlinked")
            return

        commandQue = []

        if line == "":
            line = self.lastcmd

        self.lastcmd = line

        # slice the input to a managable size
        line = line[0:128]

        # bug: input with multiple commands (\n seperated) are ignored
        if line.rfind("\n") > -1:
            return False

        words = line.split()
        punct = "\' \" , . ? !".split()  # incomplete

        # = special case! this is to remain compatable with cmd.py's do_help ===
        if len(words) > 0:
            if words[0] == "help":
                cmd, arg, line = self.parseline(line)
                return self.do_help(arg)
        # === end special case ===

        # checking to see if ands in words refer to items
        referedTo, words = self.getReferedTo(words)

        ands = self.findall(words, "and")

        group = []
        for i in ands:
            if isinstance(words[i - 1], mc.Thing):
                if isinstance(words[i + 1], mc.Thing):
                    group.append(words[i - 1])
                    group.append(words[i + 1])

        # group is a list of items that were refered to
        if len(group) > 0:
            commandQue = []
            for thing in group:
                cmd = self.getCommand(words, [thing])
                commandQue.append(cmd)

            if None in commandQue:
                return self.default()
            else:
                for cmd in commandQue:
                    cmd.do()
                return True
            return

        if len(ands) > 0:
            start = 0
            chunk = []
            vfyAnd = []
            for i in ands:
                chunk.append(words[start:i])
                start = i + 1

            if len(words[start:]) > 0:
                chunk.append(words[start:])

                # ok, we have some chunks!
            for i in chunk:
                cmd = self.getCommand(i, referedTo)
                vfyAnd.append(cmd)

            # with a reasonable amount of certainty, we can say "and" here
            # is used to split apart multiple actions if getCommand does not
            # return False for any chunk
            #if None not in vfyAnd:

            # bug: this is only temporary...
            commandQue = vfyAnd

        else:
            # simply process words as a single command
            cmd = self.getCommand(words, referedTo)
            commandQue.append(cmd)

        # if we have a unknown or failing command, then fail the whole parse
        if None in commandQue:
            return self.default()
        else:
            for cmd in commandQue:
                cmd.do()
            return True
示例#5
0
文件: py2txt.py 项目: johbo/pypi2nix
def do(py_file):
    out, err = cmd.do("nix-build %s/pip.nix --argstr path %s" % (os.path.dirname(__file__), os.path.dirname(py_file)))

    # TODO: handle err

    return os.path.join(out.split("\n")[0], "wheelhouse")