# [Chimera-users] Angles

hsosa at aecom.yu.edu hsosa at aecom.yu.edu
Tue Nov 6 07:05:02 PST 2007

```Hi Greg,

Yes that is what I meant. My questions now is: Is it possible in idle to
get the atoms being currently selected on the structure display window
instead of explicitily writing their number ?

i.e.

Is there a command  like:

at1 = XXX.Current_selection_on_screen.atoms()[0]

at1 = chimera.selection.OSLSelection(":32.A at CA").atoms()[0]

Thanks

Hernando

Greg Pintilie wrote:
> If you think of the line connecting the two atoms as a vector (with no
> position in space), then it's angle to another vector (e.g. the x-axis
> (1,0,0)) can be computed from the definition of dot product:
>
> u . v = |u| * |v| * cos ( theta)
>
> where u . v is the dot product between the vectors u and v, theta is
> the angle between the vectors u and v, and |u| is the magnitude
> (length) of u
>
> so
>
> cos ( theta) = u . v / ( |u| * |v| )
> theta = arccos ( u.v / ( |u| * |v| ) )
>
> if the vectors u and v are normalized / have unit length of 1 then you
> can simplify:
>
> theta = arccos ( u.v )
>
> within chimera, in the python interpreter IDLE, you first need to get
> the coordinates of the two atoms, for example, to get the vector from
> the alpha carbon in residue 32 to the alpha carbon in residue 33:
>
> at1 = chimera.selection.OSLSelection(":32.A at CA").atoms()[0]
> at2 = chimera.selection.OSLSelection(":33.A at CA").atoms()[0]
> v = at2.coord() - at1.coord()
> v.normalize()
> import numpy
> theta_to_x_in_degrees = numpy.arccos ( v * chimera.Vector(1,0,0) ) *
> 180 / numpy.pi
>
>
> hope that helps...
>
> Greg
>
>
>
> On Nov 5, 2007 3:24 PM,  <hsosa at aecom.yu.edu> wrote:
>
>> Hi,
>> I have a couple of questions:
>>
>> Is there a simple  way to determine the angle between  any of the three
>> axes, X,Y or Z and the line connecting two selected atoms?. I know you
>> can use the Angles/Torsions tools to determine the angle formed between
>> 3 sets of atoms, but I wonder if  you could use that tool, or some
>> other,  to  report the angle of two atoms with the axes?.
>>
>> Is it possible to draw a box with the axes around a structure as it can
>> be done with a volume ?.
>>
>> Thanks
>>
>> Hernando
>>
>> --
>> -----------------------------------
>> Hernando Sosa
>> Dept. of Physiology and Biophysics
>> Albert Einstein College of Medicine
>> 1300 Morris Park Av.
>> Bronx NY 10461
>> phone   (718) 430-3456
>> FAX     (718) 430-8819
>> email   hsosa at aecom.yu.edu
>> -----------------------------------
>>
>>
>>
>> _______________________________________________
>> Chimera-users mailing list
>> Chimera-users at cgl.ucsf.edu
>> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
>>
>>
>
>
>

--
-----------------------------------
Hernando Sosa
Dept. of Physiology and Biophysics
Albert Einstein College of Medicine
1300 Morris Park Av.
Bronx NY 10461
phone	(718) 430-3456
FAX	(718) 430-8819
email	hsosa at aecom.yu.edu
-----------------------------------

```