Hi Jared,

this is a numerical problem. Look in transformations.py for the lines
where values get compared to 1e-8 and change this number to something
like 1e-7.

And in your script the angle calculation missed the arccos:

elbow = 180 - numpy.degrees(numpy.arccos(numpy.dot(direction_v,direction_c)))

Cheers,
  Thomas

On Tue, Dec 14, 2010 at 7:57 PM, Sampson, Jared <jared.samp...@nyumc.org> wrote:
> Hello all - I'm trying to calculate the elbow angle of an Fab locally (i.e. 
> without uploading to a server) and decided to try it in PyMOL.  I got stuck, 
> and thought maybe someone much wiser than I might be able to shed some light 
> on the error(s) of my ways.
>
> I've been trying to use some of the functions in transformations.py by 
> Christoph Gohlke (quite a thorough toolset!); what I have so far is the 
> following .pml script:
>
> run transformations.py
>
> import numpy
> import transformations
>
> fetch 3ghe, async=0
>
> # break the fab into 4 pieces
> create vl, chain L and resi 1-107
> create vh, chain H and resi 1-113
> create cl, chain L and !vl
> create ch, chain H and !vh
>
> # align the pieces
> super vl,vh
> super cl,ch
>
> python
>
> # get the transformation matrices
> mat_v = cmd.get_object_matrix("vl")
> mat_c = cmd.get_object_matrix("cl")
>
> # turns Pymol's output into a 4x4 python array
> def mat_to_R(mat):
>    R = [[mat[0],mat[1],mat[2],mat[3]],
>         [mat[4],mat[5],mat[6],mat[7]],
>         [mat[8],mat[9],mat[10],mat[11]],
>         [mat[12],mat[13],mat[14],mat[15]]]
>    return R
>
> Rv = mat_to_R(mat_v)
> Rc = mat_to_R(mat_c)
>
> # calculate the axis & angle
> angle_v,direction_v,point_v = transformations.rotation_from_matrix(Rv)
> angle_c,direction_c,point_c = transformations.rotation_from_matrix(Rc)
>
> # calculate the elbow angle
> elbow = numpy.degrees(numpy.dot(direction_v,direction_c))
> print "Elbow angle:",elbow
>
> python end
>
> I'm getting the following error, but I'm not sure how to address it:
>
> Traceback (most recent call last):
>  File "/sw64/lib/pymol-py26/modules/pymol/parser.py", line 155, in parse
>    exec(py_block,self.pymol_names,self.pymol_names)
>  File "<string>", line 19, in <module>
>  File "transformations.py", line 348, in rotation_from_matrix
>    raise ValueError("no unit eigenvector corresponding to eigenvalue 1")
> ValueError: no unit eigenvector corresponding to eigenvalue 1
>
> Any help would be greatly appreciated!
>
> Thanks,
>
> Jared
>
> --
> Jared Sampson
> Xiangpeng Kong Lab
> NYU Langone Medical Center
> New York, NY 10016
> 212-263-7898

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to