Hi Minh,

you define a rotation axis by the rotation axis x, y or z (first argument in cmd.rotate) and a point in 3d (origin argument in cmd.rotate). Instead of rotations around axes that are not parallel to the x, y or z axis you can do composite rotations.

Btw, for the case of GroEL (PDB 2c7e), the structure is oriented along the Z axis, so you can flap the flexible regions with a single rotation around the axis that goes through the regions center of mass and is parallel to the z-axis.
See the attached file.

repeat the last rotate command from the gray window
cmd.rotate("z", 30, "flexregion", camera=0, origin=rotationCenter)

hope that makes sense.

Minh Nhat wrote:
Hi everyone,
Is it possible to make a selection rotate about an arbitrary axis (which we can actively define ourself (not x,y, z) ?)
Thanks,

Send instant messages to your online friends http://uk.messenger.yahoo.com

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
------------------------------------------------------------------------

_______________________________________________
PyMOL-users mailing list
PyMOL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pymol-users

--
Andreas Henschel
Bioinformatics Group
TU Dresden
Tatzberg 47-51
01307 Dresden, Germany

Phone: +49 351 463 40063
EMail: a...@biotec.tu-dresden.de


from pymol import cmd
from pymol.cgo import *

def centerOfMass(selection, createSphere=True):
    ## assumes equal weights (best called with "and name ca" suffix)
    model = cmd.get_model(selection)
    x,y,z=0,0,0
    for a in model.atom:
        x+= a.coord[0]
        y+= a.coord[1]
        z+= a.coord[2]
    com = (x/len(model.atom), y/len(model.atom), z/len(model.atom))
    if createSphere:
        print "Center of mass: (%.1f,%.1f,%.1f)"% com
        ## Creating a sphere CGO
        comS = [COLOR, 1.0, 0.5, 0.5, SPHERE]+list(com) + [1.0] 
        cmd.load_cgo(comS, "CoM")        
    return com

cmd.fetch("2c7e") ## requires a newer pymol
cmd.as("cartoon", "all") ## requires a newer pymol
cmd.create("flexregion", "chain A and resi 229-270")
cmd.color("red", "flexregion")

rotationCenter = list(centerOfMass("flexregion"))
cmd.rotate("z", 30, "flexregion", camera=0, origin=rotationCenter) ## repeat this!
cmd.zoom("flexregion")

Reply via email to