This seems like a simple pymol task. I have an arbitrary number (<10) of PDB files each with one molecule/protein. I would like to set them up as a "chorus line" rotating around their own Y axes. I can figure out all the movie.roll, movie export, and mset commands, but am stuck on getting each molecule its own axis to rotate around. Spacing each molecule equidistant along the x axis (regardless of size) would be a bonus.
2 answers
Note: the solution is a bit of a hack, there might be easier ways. Anyway, this sounds like an interesting project so when you manage to create an acceptable movie please consider hosting the code on github and linking it here.
The commands you are looking for are most likely translate and rotate. These can be called for each object seperately (object movement) and not just your whole scene (camera movement). You can use standard python code (ie., a loop to call the above functions with cmd.[?]function[?]) in the PyMOL prompt.
In order to have each molecule rotate around their own central Y axis you have to, for all your objects:
- Translate an object to the origin
- Rotate it the desired amount around the y axix
- Translate it back where you want it to be
- Save the configuration to a new state
Points 1 to 3 are needed because of the way positions and transformations of objects are calculated with matrix operations. The mmatrix command might help here.
And then finally create the movie using all your new states (see PyMOL's movie syntax).
edit: also see this tutorial
Hello @hurfdurf, today I found this good resource that answers exactly to your topic: Rotation with two independent rotation centers.
Here the python code:
#Rotate two different objects 360 degrees aroung thier axes
#@frames: number of frames to animate (integer)
#@rotation_axis: axis to rotate the structure ('x', 'y' or 'z')
#@obj1: first object (protein molecule)
#@obj2: second object (protein molecule)
def two_roll (frames, rotation_axis, obj1, obj2):
angle=360/frames
frame=1
#Loop over frames, make small rotation to each object,
#ray trace the scene and save the image
while frame <= frames:
#Set rotation center to object1
cmd.origin(obj1)
#Rotate object1
cmd.rotate(rotation_axis, angle, obj1)
#Set rotation center to object2
cmd.origin(obj2)
#Rotate object2
cmd.rotate(rotation_axis, angle, obj2)
#Ray trace and save the image
ray()
frame+=1

Cheers
Log in to answer this question.