def _rock(mode, axis, first, last, period, pause, _self=cmd): cmd = _self n_frame = last - first + 1 angle = cmd.get_setting_float('sweep_angle') if (period * 1.5) < pause: n_cyc = int(round(pause / period)) frame_list = [] for cyc in range(n_cyc): frame_list.extend([ (first + ((1 + 4 * cyc) * n_frame) / (4 * n_cyc)), (first + ((3 + 4 * cyc) * n_frame) / (4 * n_cyc)) ]) else: frame_list = [first + n_frame / 4, first + (3 * n_frame) / 4] if 1 or mode: direction = 0 for frame in frame_list: if not direction: cmd.turn(axis, angle / 2.0) cmd.mview("store", frame, power=-1, freeze=1) direction = -1 else: cmd.turn(axis, direction * angle) cmd.mview("store", frame, power=-1, freeze=1) direction = -direction cmd.turn(axis, direction * angle / 2.0) cmd.mview("store", last, power=-1, freeze=1) cmd.mview("interpolate", first, last)
def _rock(mode,axis,first,last,period,pause,_self=cmd): cmd = _self n_frame = last - first + 1 angle = cmd.get_setting_float('sweep_angle') if (period * 1.5) < pause: n_cyc = int(round(pause / period)) frame_list = [] for cyc in range(n_cyc): frame_list.extend( [(first + ((1+4*cyc)*n_frame)/(4*n_cyc)), (first + ((3+4*cyc)*n_frame)/(4*n_cyc))] ) else: frame_list = [ first+n_frame/4, first+(3*n_frame)/4 ] if 1 or mode: direction = 0 for frame in frame_list: if not direction: cmd.turn(axis,angle/2.0) cmd.mview("store",frame,power=-1,freeze=1) direction = -1 else: cmd.turn(axis, direction * angle) cmd.mview("store",frame,power=-1,freeze=1) direction = -direction cmd.turn(axis,direction * angle/2.0) cmd.mview("store",last,power=-1,freeze=1) cmd.mview("interpolate",first,last)
def _nutate(mode, first, last, period, pause, _self=cmd): cmd = _self n_frame = last - first + 1 axis = 'y' angle = cmd.get_setting_float('sweep_angle') if (period * 1.5) < pause: n_cyc = int(round(pause / period)) frame_list = [] for cyc in range(n_cyc): frame_list.append([(first + ((cyc) * n_frame) / (n_cyc)), (first + ((cyc + 1) * n_frame) / (n_cyc))]) else: frame_list = [[first, first + n_frame]] direction = 0 spiral = 1 for frame in frame_list: _nutate_sub(frame[0], frame[1], angle, spiral, _self=cmd) spiral = 0
def _nutate(mode,first,last,period,pause,_self=cmd): cmd = _self n_frame = last - first + 1 axis = 'y' angle = cmd.get_setting_float('sweep_angle') if (period * 1.5) < pause: n_cyc = int(round(pause / period)) frame_list = [] for cyc in range(n_cyc): frame_list.append( [(first + ((cyc)*n_frame)/(n_cyc)), (first + ((cyc+1)*n_frame)/(n_cyc))] ) else: frame_list = [ [first, first+n_frame] ] direction = 0 spiral = 1 for frame in frame_list: _nutate_sub(frame[0], frame[1], angle, spiral, _self=cmd) spiral = 0
def png(filename, width=0, height=0, dpi=-1.0, ray=0, quiet=1, prior=0, format=0, _self=cmd): ''' DESCRIPTION "png" saves a PNG format image file of the current display. USAGE png filename [, width [, height [, dpi [, ray]]]] ARGUMENTS filename = string: file path to be written width = integer or string: width in pixels (without units), inches (in) or centimeters (cm). If unit suffix is given, dpi argument is required as well. If only one of width or height is given, the aspect ratio of the viewport is preserved. {default: 0 (current)} height = integer or string: height (see width) {default: 0 (current)} dpi = float: dots-per-inch {default -1.0 (unspecified)} ray = 0 or 1: should ray be run first {default: 0 (no)} EXAMPLES png image.png png image.png, dpi=300 png image.png, 10cm, dpi=300, ray=1 NOTES PNG is the only image format supported by PyMOL. SEE ALSO mpng, save PYMOL API cmd.png(string filename, int width, int height, float dpi, int ray, int quiet) ''' r = DEFAULT_ERROR prior = int(prior) if prior: # fetch the prior image, without doing any work (fast-path / non-GLUT thread-safe) r = _self._png(str(filename),0,0,float(dpi),0,int(quiet),1, int(format),_self) if r != 1: # no prior image available -- revert to default behavior if prior < 0: # default is to fall back to actual rendering prior = 0 if not prior: dpi = float(dpi) if dpi < 0: dpi = cmd.get_setting_float('image_dots_per_inch') width = _unit2px(width, dpi) height = _unit2px(height, dpi) if thread.get_ident() == pymol.glutThread: r = _self._png(str(filename),int(width),int(height),float(dpi), int(ray),int(quiet),0,int(format),_self) else: r = _self._do("cmd._png('''%s''',%d,%d,%1.6f,%d,%d,%d,%d)"% (filename,width,height,dpi, ray,int(quiet),0,int(format)),_self=_self) if _self._raising(r,_self): raise QuietException return r