# [Chimera-users] making a plane through the atoms of a ring and Distance measurements

Eric Pettersen pett at cgl.ucsf.edu
Tue Jun 3 17:55:42 PDT 2008

```Hi Dave,
We want to make measurements of axes, centroids, and planes
possible, and as the first step of that we have been working on
axes.  So planes/centroids will be coming, but I can't really
guarantee when (there's still plenty of work left for axes!).  So as
Greg says, measuring planes/centroids has to be done using Python for
now.
Now, the fact that the Chimera Plane constructor requires the points
in "ring order" (for now) is kind of a major PITA, so my suggestion
is to do a singular value decomposition and take as the plane normal
the cross product of the two largest eigenvectors.  This is actually
really easy.  If you look at the axis() function of StructureMeasure/
__init__.py, it finds the centroid and does an SVD on a set of
coordinates. The single largest eigenvector is the "axis" of those
coordinates.  You would use numpy.argsort to find the two
eigenvectors with the largest eigenvalues, and numpy.cross to get the
cross product.  Some useful numpy docs are here: http://www.scipy.org/
Numpy_Example_List_With_Doc .  The other thing to know is that to get
a bunch of atoms (say from chimera.selection.currentAtoms()) into an
Nx3 numpy array, you use the function chimera.numpyArrayFromAtoms.
With the centroid and the normal, you would construct a
chimera.Point and chimera.Vector.  Then there is a chimera.Plane
constructor that takes a Point and a Vector.  There are a bunch of
methods of Point, Vector, and Plane for measuring distances and
angles, etc.  You can see documentation for them by typing e.g. help
(chimera.Vector) in the IDLE tool.  So for instance, the distance
from an atom to the centroid is atom.coord().distance(centroid).
Some measurements, such as angle(),  are only available as functions
in the chimera module (so help(chimera) to see them).  So the angle
atom-centroid-normal is: chimera.angle(atom.coord() - centroid,
normal) [the subtraction of two Points produced a Vector].
To show planes, you might want to construct BILD files/strings and
open those: http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/bild.html

--Eric

Eric Pettersen
UCSF Computer Graphics Lab
http://www.cgl.ucsf.edu

On Jun 2, 2008, at 9:02 PM, David Chenoweth wrote:

> Dear Chimera team,
>
> I would like to make a plane through the atoms of an aromatic ring and
> then measure a distance from an atom to the ring centroid. I would
> also like to measure the angle between the normal to the ring plane
> and the line joining the centroid and the atom I am measuring from. It
> would also be nice if I could specify the dimensions, color, and
> transparency of the plane. In addition it would be great to be able to
> make multiple planes through atoms, select and color them separately,
> and measure the angles at the intersection of the planes. Just
> wondering if there is a way to do this with Chimera.
>
> Dave
>
> **********************************************
> David M. Chenoweth
> California Institute of Technology
> Division of Chemistry and Chemical Engineering
> Mail Code: 164-30
> 1200 California Boulevard, 91125 Pasadena
> California, USA
>
> Phone: 626-395-6074
> Email: dchen at caltech.edu
> **********************************************
>
>
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20080603/24c3209c/attachment.html>
```