def setZoom(self):
         self.writeMessageToLog("Setting zoom")
         surf = self.surfaces[0]
         rc = Radial_Color()
         try:
                 rmin, rmax = rc.value_range(surf.surfacePieces[0])
         except:
                 self.writeMessageToLog("using old Chimera radial method")
                 #keep for older version of chimera, e.g. v1.2509
                 vertices, triangles = surf.surfacePieces[0].geometry
                 rmin, rmax = rc.value_range(vertices, vertex_xform=None)
         while rmax is None:
                 self.writeMessageToLog("Contour %.2f is too big, no surface is shown"%(self.contour))
                 self.contour *= 0.9
                 self.voldata.set_parameters(surface_levels = [self.contour])
                 self.voldata.show('surface')
                 self.surfaces = openModels.list(modelTypes=[SurfaceModel])
                 surf = self.surfaces[0]
                 try:
                         rmin, rmax = rc.value_range(surf.surfacePieces[0])
                 except:
                         #keep for older version of chimera, e.g. v1.2509
                         vertices, triangles = surf.surfacePieces[0].geometry
                         rmin, rmax = rc.value_range(vertices, vertex_xform=None)
         self.writeMessageToLog("found r_max value of %.3f"%(rmax))
         ## ten percent bigger to ensure that entire particle is in frame
         viewsize = 1.1*rmax/self.zoom
         chimera.viewer.viewSize = viewsize
         #self.runChimCommand('scale %.3f' % self.zoom)
         self.writeMessageToLog("set view size to %.3f"%(viewsize))
 def color_surface_radially(self, surf):
     self.writeMessageToLog("Color radially")
     rc = Radial_Color()
     rc.origin = [0, 0, 0]
     try:
         rmin, rmax = rc.value_range(surf.surfacePieces[0])
     except:
         #keep for older version of chimera, e.g. v1.2509
         vertices, triangles = surf.surfacePieces[0].geometry
         rmin, rmax = rc.value_range(vertices, vertex_xform=None)
     rrange = rmax - rmin
     self.writeMessageToLog("%.3f,%.3f" % (rmin, rmax))
     #key: red,green,blue,opacity
     #order: red, yellow, green, cyan, blue
     if self.colors is None:
         data_values = (.5 * rmax, .625 * rmax, .75 * rmax, .875 * rmax,
                        rmax)
         colors = [(0.9, 0.1, 0.1, 1), (0.9, 0.9, 0.1, 1),
                   (0.1, 0.9, 0.1, 1), (0.1, 0.9, 0.9, 1),
                   (0.1, 0.1, 0.9, 1)]
     else:
         ### set colors
         colors = self.getColors()
         data_values = (.125 * rrange + rmin, .5 * rrange + rmin,
                        .875 * rrange + rmin)
     rc.colormap = Color_Map(data_values, colors)
     color_surface(surf, rc, caps_only=False, auto_update=False)
 def color_surface_radially(self, surf):
         self.writeMessageToLog("Color radially")
         rc = Radial_Color()
         rc.origin = [0,0,0]
         try:
                 rmin, rmax = rc.value_range(surf.surfacePieces[0])
         except:
                 #keep for older version of chimera, e.g. v1.2509
                 vertices, triangles = surf.surfacePieces[0].geometry
                 rmin, rmax = rc.value_range(vertices, vertex_xform=None)
         rrange = rmax-rmin
         self.writeMessageToLog("%.3f,%.3f"%(rmin,rmax))
         #key: red,green,blue,opacity
         #order: red, yellow, green, cyan, blue
         if self.colors is None:
                 data_values = (.5*rmax, .625*rmax, .75*rmax, .875*rmax, rmax)
                 colors = [(0.9,0.1,0.1,1), (0.9,0.9,0.1,1), (0.1,0.9,0.1,1), (0.1,0.9,0.9,1), (0.1,0.1,0.9,1)]
         else:
                 ### set colors
                 colors = self.getColors()
                 data_values = (.125*rrange+rmin, .5*rrange+rmin, .875*rrange+rmin)
         rc.colormap = Color_Map(data_values, colors)
         color_surface(surf, rc, caps_only = False, auto_update = False)