Re: [PyMOL] movie help, rotating around an objects own center of mass.

2012-09-17 Thread Thomas Holder
Hi Jordan,

the rotate command has a camera argument. Does it help if you set 
that to zero?

rotate [0,0,1],360, object=3hmx_ant, origin=3hmx_ant, camera=0

Cheers,
   Thomas

Jordan Willis wrote, On 09/17/12 02:55:
 Hello,
 
 I'm making a movie, and I think I really got it down! However, I'm having 
 trouble with independent rotations. 
 
 I have nine independent objects, of which three I'm trying to get to rotate 
 their own z-axis. Is this possible? Let me show you what I mean :)
 
 
 
 frame 30
 rotate [0,0,1],360, object=3hmx_ant, origin=3hmx_ant
 rotate [0,0,1],360, object=2b1a_ant, origin=2b1a_ant
 rotate [0,0,1],360, object=2xwt_ant, origin=2xwt_ant
 
 #store all views
 mview store, object=2b1a_ant
 mview store, object=2b1a_h
 mview store, object=2b1a_l
 mview store, object=2xwt_ant
 mview store, object=2xwt_h
 mview store, object=2xwt_l
 mview store, object=3hmx_ant
 mview store, object=3hmx_l
 mview store, object=3hmx_h
 
 
 #reinterpolate
 mview reinterpolate, object=2b1a_ant
 mview reinterpolate, object=3hmx_ant
 mview reinterpolate, object=2xwt_ant
 
 
 The problem is that the rotate command uses the entire scenes y-axis rather 
 than the objects. I understand you can supply an axis vector, but I have no 
 idea how to do this. Essentially I want to do what movie.roll would do, but 
 just to one object independently of the entire scene.
 
 Jordan

-- 
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net


Re: [PyMOL] movie help, rotating around an objects own center of mass.

2012-09-17 Thread Thomas Holder

Hi Jordan,

I guess you actually do want the axis in camera space, not in object 
space. Unfortunately the origin argument will pick the origin of object 
coordinate space and not it's geometric center.


Check the attached script, which I modified slightly. I defined a 
my_rotate command which takes care of the origin.


Hope that helps.

Cheers,
  Thomas

Jordan Willis wrote, On 09/17/12 18:13:

Hi Thomas,

I was crazy not to see that option. Although it did change the axis,
it is not using the objects axis, but an unidentified axis I can't
quite put my finger on. By changing the origin= option, it does not
seem to have an effect. Is it possible that I'm putting the wrong
command into the origin option?

If you would like to look, my .pml file and the pdbs I loaded I have
attached. I guess I still can't figure out how to use the selected
objects center of mass. Any help would be much appreciated!

Thanks, Jordan


--
Thomas Holder
MPI for Developmental Biology
Spemannstr. 35
D-72076 Tübingen
reinitialize
set matrix_mode, 1
set movie_panel, 1
set scene_buttons, 1
set cache_frames, 1
set movie_auto_interpolate, off
config_mouse three_button_motions, 1


python
import glob, os
path = /Users/jordanwillis/workspace/specificaim3/msd_movie/files/
if not os.path.exists(path):
path = 'files/'
l1 = glob.glob(path+*A*.pdb)
l2 = glob.glob(path+*B*.pdb)
l3 = glob.glob(path+*C*.pdb)
for j in l1[:10]:
cmd.load(j,A1)
for g in l2[:10]:
cmd.load(g,B1)
for d in l3[:10]:
cmd.load(d,C1)
cmd.load(path+2b1a.pdb, A_bb)
cmd.load(path+2xwt.pdb, B_bb)
cmd.load(path+3hmx.pdb, C_bb)

try:
from psico.querying import centerofmass
except ImportError:
centerofmass = lambda s: [(a+b)/2 for (a,b) in zip(*cmd.get_extent(s))]

def my_rotate(angle, object, axis='y'):
com = centerofmass(object)
cmd.rotate(axis, angle, object=object, origin=com)

cmd.extend('my_rotate', my_rotate)
python end

bg white

hide lines



#object creators
create 2b1a_ant, A_bb and chain P
create 2xwt_ant, B_bb and chain C
create 3hmx_ant, C_bb and chain A
create 2b1a_l, A_bb and chain L
create 2xwt_l, B_bb and chain B
create 3hmx_l, C_bb and chain L
create 2b1a_h, A_bb and chain H
create 2xwt_h, B_bb and chain H
create 3hmx_h, C_bb and chain H

set_view (\
-0.987339199,   -0.147254646,0.058693748,\
-0.130136862,0.541538239,   -0.830523551,\
 0.090512969,   -0.827677608,   -0.553851545,\
 0.000551268,0.000143198, -327.257324219,\
21.386798859,  -23.021564484,   12.119427681,\
   176.506362915,  478.079681396,  -20.0 )
### cut above here and paste into script ###



select antigens, chain C + chain A + chain P
select light, chain B + chain L
select msd_residues, A1 + B1 + C1
select heavy, not msd_residues and chain H
deselect 
color grey20, heavy
color forest, antigens
color sand, light
spectrum b, blue_white_red, msd_residues


#show sticks, msd_residues 
show surface, 2b1a_ant + 2xwt_ant + 3hmx_ant + 2b1a_l + 2xwt_l + 3hmx_l + 
2b1a_h + 2xwt_h + 3hmx_H
show cartoon, 2b1a_h + 2xwt_h + 3hmx_h
set transparency, .5

translate [-60,0,0], object=2b1a_ant
translate [-60,0,0], object=2b1a_h
translate [-60,0,0], object=2b1a_l
translate [60,0,0], object=3hmx_ant
translate [60,0,0], object=3hmx_l
translate [60,0,0], object=3hmx_h

mset 1 x160
frame 1
color magenta, antigens 
mview store, object=2b1a_ant
mview store, object=2b1a_h
mview store, object=2b1a_l
mview store, object=2xwt_ant
mview store, object=2xwt_h
mview store, object=2xwt_l
mview store, object=3hmx_ant
mview store, object=3hmx_l
mview store, object=3hmx_h



frame 40
translate [0,10,0], object=3hmx_ant
translate [0,10,0], object=2b1a_ant
translate [0,10,0], object=2xwt_ant
mview store, object=2b1a_ant
mview store, object=2b1a_h
mview store, object=2b1a_l
mview store, object=2xwt_ant
mview store, object=2xwt_h
mview store, object=2xwt_l
mview store, object=3hmx_ant
mview store, object=3hmx_l
mview store, object=3hmx_h



frame 50
color forest, antigens
color magenta, light
#translate [0,-10,0], object=3hmx_ant
#translate [0,-10,0], object=2b1a_ant
#translate [0,-10,0], object=2xwt_ant

my_rotate 180, 3hmx_ant
my_rotate 180, 2b1a_ant
my_rotate 180, 2xwt_ant

#,origin=3hmx_h
#rotate [0,0,1], 180,object=2b1a_ant,camera=0,origin=2b1a_ant
#rotate [0,0,1], 180,object=2xwt_ant,camera=0,origin=2xwt_ant

mview store, object=2b1a_ant
mview store, object=2b1a_h
mview store, object=2b1a_l
mview store, object=2xwt_ant
mview store, object=2xwt_h
mview store, object=2xwt_l
mview store, object=3hmx_ant
mview store, object=3hmx_l
mview store, object=3hmx_h

frame 90
translate [-10,0,0], object=3hmx_l
translate [-10,0,0], object=2b1a_l
translate [-10,0,0], object=2xwt_l
mview store, object=2b1a_ant
mview store, object=2b1a_h
mview store, object=2b1a_l
mview store, object=2xwt_ant
mview store, object=2xwt_h
mview store, object=2xwt_l
mview store, object=3hmx_ant
mview store, object=3hmx_l
mview store, object=3hmx_h

frame 100
color sand,  light