Hi Ricardo -
You can install this open-source contribution to pymol. It was distributed
with v.80, but isn't working in the publicly available distribution I think
because of some changes Warren made to the pymol code.
The command is 'movie.tdroll' so type help movie.tdroll for advice on how to
use it after you install it. The code below will work with pymol v.80
(currently only available for windows release, I think...).
Put the code in the movie.py file ([installation root]/DeLano
Scientific/python/modules/python/ ) directory.
Make sure you remove the tdroll routine that is currently in the movie.py
code before adding this new piece of code.
Alternatively, just replace your movie.py file with the one I've attached to
this email (hope it makes it through the maillist server...)
Now how to use it -
movie.tdroll ('Three-Dimensional roll') will allow you to use make a quick
movie of rotation along multiple axes of whatever is showing on the pymol
screen. You can speed it up or slow it down by changing the 'skip' value.
Play with setting different axes to 0 until you achieve what you want. I
like movie.tdroll 180,180,0,5 for a cool display of the molecule.
If your movies are still too fast, you can alter the fps setting in pymol to
be whatever you want. Otherwise, you will have to change the playback rate
with whatever you are using to generate your movies. I use bink&smacker
software (freely available, just google the name) for generating avi's - it
allows pseudo-control over the playback speed.
Good luck -
Byron
--->start below here---->
def tdroll(rangex,rangey,rangez,skip=1):
'''
AUTHOR
Byron DeLaBarre
USAGE
movie.tdroll(rangex,rangey,rangez,skip=1,mset=0)
This is an extension of the roll command along other axes (3d-roll)
rangex/y/z = rotation range on respective axis
enter 0 for no rotation on the particular axis.
skip is angle increment in each frame
Use skip to reduce final movie size or to speed up rotation.
EXAMPLE
movie.tdroll 360,360,360,5
'''
rangex = float(rangex)
rangey = float(rangey)
rangez = float(rangez)
skip = int(skip)
axis=['x','y','z']
rangel=[rangex,rangey,rangez]
axpos=0
frpos=1
tot_frames=(((rangex+rangey+rangez)/skip) + (rangex % skip) + (rangey %
skip) + (rangez % skip))
cmd.mset ("1 x%d" %((int(tot_frames))))
for ax in axis:
range = int(rangel[axpos])
if range:
leftover = divmod(range,skip)
print leftover[1]
if leftover[1]:
range = range + int(leftover[1])
a = 0
while a<=range:
cmd.mdo("%d" % (int(frpos)),"turn %s,%8.3f" % (ax,skip))
a = a + skip
frpos+=1
axpos+=1
else:
axpos+=1
print (" tdroll: defined rotations for %s frames" %(int(frpos) - 1))
<----- cut above here
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]on Behalf Of Ricardo
> Aparicio
> Sent: Monday, May 06, 2002 10:36 AM
> To: [email protected]
> Subject: [PyMOL] util.mroll & movie rate
>
>
> Dear users:
>
> Sorry if these are trivial questions for you but I am in trouble and any
> help is very welcomed:
>
> 1) How to use util.mroll to rotate around another axis other than Y axis ?
>
> 2) how to control the speed of a movie?
> (it is possible to change size and number of images but I think there is
> an easier answer to this question)
>
> Thank you in advance,
>
>
> Ricardo Aparicio
> PhD Student
> Brazil
>
>
> _______________________________________________________________
>
> Have big pipes? SourceForge.net is looking for download mirrors. We supply
> the hardware. You get the recognition. Email Us: [email protected]
> _______________________________________________
> PyMOL-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pymol-users
>
#A* -------------------------------------------------------------------
#B* This file contains source code for the PyMOL computer program
#C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific.
#D* -------------------------------------------------------------------
#E* It is unlawful to modify or remove this copyright notice.
#F* -------------------------------------------------------------------
#G* Please see the accompanying LICENSE file for further information.
#H* -------------------------------------------------------------------
#I* Additional authors of this source file include:
#-* Peter Haebel, Byron DeLaBarre
#-*
#-*
#Z* -------------------------------------------------------------------
import cmd
import glob
import math
def load(*args):
nam = "mov"
if len(args)>1:
nam = args[1]
fils = glob.glob(args[0])
fils.sort()
if not len(fils):
print "Error: no matching files"
else:
for a in fils:
cmd.load(a,nam)
def rock(first,last,angle=30,phase=0,loop=1,axis='y'):
first=int(first)
last=int(last)
angle=float(angle)
phase=float(phase)
loop=int(loop)
nstep = (last-first)+1
if nstep<0:
nstep = 1
if loop:
subdiv = nstep
else:
subdiv = nstep+1
ang_cur = math.pi*phase/180
ang_inc = 2*math.pi/subdiv
ang_cur = ang_cur - ang_inc
a = 0
while a<nstep:
last = angle*math.sin(ang_cur)/2
ang_cur = ang_cur + ang_inc
disp = angle*math.sin(ang_cur)/2
diff = disp-last
# com = "mdo %d:turn %s,%8.3f" % (first+a,axis,diff)
# cmd.do(com)
cmd.mdo("%d"%(first+a),"turn %s,%8.3f"% (axis,diff))
a = a + 1
def roll(first,last,loop=1,axis='y'):
first=int(first)
last=int(last)
loop=int(loop)
n = last - first
if loop:
step = 2*math.pi/(n+1)
else:
step = 2*math.pi/n
a = 0
deg = (180*step/math.pi)
while a<=n:
# com = "mdo %d:turn %s,%8.3f" % (first+a,axis,deg)
# cmd.do(com)
cmd.mdo("%d" % (first+a), "turn %s,%8.3f" % (axis,deg))
a = a + 1
def tdroll(rangex,rangey,rangez,skip=1):
'''
AUTHOR
Byron DeLaBarre
USAGE
movie.tdroll(rangex,rangey,rangez,skip=1,mset=0)
This is an extension of the roll command along other axes (3d-roll)
rangex/y/z = rotation range on respective axis
enter 0 for no rotation on the particular axis.
skip is angle increment in each frame
Use skip to reduce final movie size or to speed up rotation.
EXAMPLE
movie.tdroll 360,360,360,5
'''
rangex = float(rangex)
rangey = float(rangey)
rangez = float(rangez)
skip = int(skip)
axis=['x','y','z']
rangel=[rangex,rangey,rangez]
axpos=0
frpos=1
tot_frames=(((rangex+rangey+rangez)/skip) + (rangex % skip) + (rangey %
skip) + (rangez % skip))
cmd.mset ("1 x%d" %((int(tot_frames))))
for ax in axis:
range = int(rangel[axpos])
if range:
leftover = divmod(range,skip)
print leftover[1]
if leftover[1]:
range = range + int(leftover[1])
a = 0
while a<=range:
cmd.mdo("%d" % (int(frpos)),"turn %s,%8.3f" % (ax,skip))
a = a + skip
frpos+=1
axpos+=1
else:
axpos+=1
print (" tdroll: defined rotations for %s frames" %(int(frpos) - 1))
def zoom(first,last,step=1,loop=1,axis='z'):
# Author: Peter Haebel
first=int(first)
last=int(last)
step=int(step)
loop=int(loop)
n = last - first
a = 0
while a<=n:
if (loop and a>n/2):
s = -step
else:
s = step
# com = "mdo %d:move %s,%8.3f" % (first+a,axis,s)
# cmd.do(com)
cmd.mdo("%d" % (first+a),"move %s,%8.3f" % (axis,s))
a = a + 1
def nutate(first,last,angle=30,phase=0,loop=1,shift=math.pi/2.0,factor=0.01):
first=int(first)
last=int(last)
angle=float(angle)
phase=float(phase)
loop=int(loop)
nstep = (last-first)+1
if nstep<0:
nstep = 1
if loop:
subdiv = nstep
else:
subdiv = nstep+1
ang_cur = math.pi*phase/180
ang_inc = 2*math.pi/subdiv
ang_cur = ang_cur - ang_inc
a = 0
while a<nstep:
lastx = angle*math.sin(ang_cur)/2
lasty = angle*math.sin(ang_cur+shift)/2
ang_cur = ang_cur + ang_inc
nextx = angle*math.sin(ang_cur)/2
nexty = angle*math.sin(ang_cur+shift)/2
# com = "mdo %d:turn %s,%8.3f" % (first+a,axis,diff)
# cmd.do(com)
cmd.mdo("%d"%(first+a),"turn x,%8.3f;turn y,%8.3f;turn y,%8.3f;turn
x,%8.3f"%
(-lastx,-lasty,nexty,nextx))
a = a + 1
def screw(first,last,step=1,angle=30,phase=0,loop=1,axis='y'):
# Author: Peter Haebel
first=int(first)
last=int(last)
step=int(step)
angle=float(angle)
phase=float(phase)
loop=int(loop)
nstep = (last-first)+1
if nstep<0:
nstep = 1
if loop:
subdiv = nstep
else:
subdiv = nstep+1
ang_cur = math.pi*phase/180
ang_inc = 2*math.pi/subdiv
ang_cur = ang_cur - ang_inc
a = 0
while a<nstep:
if (loop and a>=nstep/2):
s = -step
else:
s = step
last = angle*math.sin(ang_cur)/2
ang_cur = ang_cur + ang_inc
disp = angle*math.sin(ang_cur)/2
diff = disp-last
# com = "mdo %d:turn %s,%8.3f; move z,%8.3f" % (first+a,axis,diff,s)
# cmd.do(com)
cmd.mdo("%d" % (first+a), "turn %s,%8.3f; move z,%8.3f" % (axis,diff,s))
a = a + 1