[Chimera-users] Rotation about an axis

Thomas Goddard goddard at cgl.ucsf.edu
Fri Apr 21 11:01:11 PDT 2006

Hi Jordan,

  Aha!  It turns out I wrote code that does exactly what you want last year.
It is called the symmetric molecule copies command at the bottom of the
Chimera experimental features web page:


It is not distributed with Chimera yet but you can download it on that
page and install it with your existing Chimera.

  I hate to discourage you from Python programming in Chimera but I
think this is just what you need.  You open one copy of your molecule
and then use this "sym" command to make the hexamer.  Then when you
move the original copy of the molecule relative to your map, the other
5 copies automatically reposition to maintain the 6-fold symmetry.  To
get a more detailed description look at the "details" link on the
experimental features page.

  The hexamer symmetry comes from the BIOMT matrices in the PDB file.
This sym command treats those matrices in the coordinate system of the
density map (yes, a bit weird).  The key here is to make sure the
symmetry axis of the density map matches the symmetry axis of the
BIOMT matrices.  The easiest approach is probably to make the BIOMT
matrices produce a hexamer about the z-axis through (0,0,0).  When you
open your density map in Chimera it may not have the hexamer density
centered at (0,0,0).  You will need to adjust its origin so the
density hexamer is centered at (0,0,0).  Use the volume dialog menu
entry Features / Origin and Scale to adjust the position of the lower
left front corner of the map.  Assuming the hexamer is centered in a
128 x 128 x 100 grid with voxel size 0.8 angstroms you would set the
origin to (-50.8, -50.8, -39.6) = (-63.5 * 0.8, -63.5 * 0.8, -49.5 *
0.8).  The weird 63.5 = 128/2 - .5 instead of 64 = 128/2 is easiest to
understand if you think of a map that is only 2 by 2 by 2 in size.
Remember to press the Enter key in one of the origin fields in the
volume dialog to have the new position take effect.  In any case that
may still be a half voxel off depending on your map, or it may be way
off.  Of course you have to know the position of the center of the
hexamer in your density to make this work.  A way to verify that you
have set the correct origin is to open 2 copies of the map -- set the
map origins, then use constrained move to rotate just one copy keeping
the other one fixed.  It is easy then to visually see if the two
copies are concentric.  For convenience you can save your map as an
MRC file with the new origin with the volume dialog File / Save As...
menu entry.  Saving a Chimera session also saves the origin in the
Chimera session file (the map is not modified).

  I can see various troubles with using the Multiscale tool.  First
Multiscale low resolution surfaces are not reliably synchronized to
the individual PDB models.  If you change a PDB model position
Multiscale won't realize it and the low resolution surface will not
move to the new location.  If you are using the latest Chimera
snapshot (1.2224, April 10, 2006) then the problems will be even more
severe because I changed the way Multiscale positions PDB models.
Instead of setting the pdb_model.openState.xform it changes the atom
coordinates of the model (setting atom.coord = x,y,z).  All the xforms
of the 6 models in a hexamer would be the same in Chimera 1.2224.
This change was made to allow correctly moving individual chains of
multiscale models, possible with the "movement mouse mode" feature
on the experimental features web page.

  Lastly some clarification about Chimera's coordinate systems.
First there is a global Chimera coordinates system with the x axis
always horizontal relative to your graphics window, the y axis always
vertical, and the z axis always pointing out of the screen at you.
When you rotate models with the mouse, this coordinate system does
not change -- the individual matrices positioning the models are
changed.  The origin of this global coordinate system is not necessarily
in the center of the screen.  It can be anywhere including off-screen.
The global coordinates for the center of the screen are set to match
the center of the bounding box of the first model you open in Chimera.
Besides the global coordinate system each model has a local coordinate
system.  With a PDB file, the atom coordinate positions are in the
local coordinate system.  If you open a PDB model in Chimera and rotate
it, the atom.coord x,y,z values do not change -- they are expressed
in the local coordinate system which is fixed to the atoms and rotates
with the model.  (You can however change the atom.coord positions using
Python code.)  The pdb_model.openState.xform 3 row by 4 column matrix
gives the rotation and translation that maps the local coordinates
(e.g. a PDB atom position) into Chimera global coordinates.  Other
types of Chimera models like density maps are just like PDB models
having a local coordinate system -- the density map grid points have
unchanging coordinates in the local coordinate system.

  More than you wanted to know.


> Date: Thu, 20 Apr 2006 19:51:40 -0700
> From: "Jordan Benjamin" <jordan.benjamin at gmail.com>
> To: "Thomas Goddard" <goddard at cgl.ucsf.edu>
> Subject: Re: [Chimera-users] Rotation about an axis
> Ah, it looks like it still works for normal models. The weird behavior
> was with a model that had been generated with the Multiscale Models
> tool from crystal contacts. I still wish I understood the
> global-vs-local issue better though.
> On 4/20/06, Jordan Benjamin <jordan.benjamin at gmail.com> wrote:
> Thank you for your help on this. I have a further question. Basically,
> I'm trying to dock into electron density the crystal structure of a
> protein that forms a hexamer. I would like to be able to have six
> copies of the monomer structure loaded at once, and when I move or
> rotate one copy, I'd like to be able to transform the other five to
> match. So, I thought the ConstrainedMove code would be a good starting
> point, since what I'm trying to do is the same thing it does, just
> with the rotation specified by degrees instead of by dragging the
> mouse.
> After you sent the email below, I modifed the function I was writing
> accordingly, and it worked. However, I'm trying to use it now, and
> it's not working. I'm a little lost on debugging it, because I don't
> even know what Chimera's concept of a global coordinate system is, nor
> do I have any way to visually display the local origin and axis for
> each object. Is there a way to do these things that you know of? Do
> you know of a simple way to rotate an object X degrees around a
> specified axis (relative to another object if needed)?
> If these are really hard questions and the answer is just that I
> should read the source code until I figure it out, that's totally
> fine. I just thought I'd ask.
> At least with Chimera the code IS available, unlike the situation with
> Amira where things would be undocumented and broken, and there'd be no
> way to fix them...
> Thanks so much,
> Jordan
> The function I was using is as follows (yes, it's brittle and ugly,
> but it's all I had time for):
> def update_hexamer(ref_model,model,*rest):
>     origin = (0,0,0)
>     axis = (0,0,1)
>     angle_deg = 60
>     mvo = chimera.Point(*origin)
>     vo = ref_model.openState.xform.apply(mvo)
>     mva = apply(chimera.Vector, axis)
>     va = ref_model.openState.xform.apply(mva)
>     xf_original = model.openState.xform
>     for i in range(5):
>         xf = chimera.Xform()
>         xf.translate(*vo)
>         xf.rotate(va, angle_deg+60*i)
>         xf.translate(-vo.x, -vo.y, -vo.z)
>         model.openState.globalXform(xf)
>         rest[i].openState.xform = model.openState.xform
>         model.openState.xform = xf_original

More information about the Chimera-users mailing list