[cctbxbb] Rotate & translate a structure

James Stroud xtald00d at gmail.com
Tue Mar 26 10:29:43 PDT 2013


Hello all,

I have a rotation + translation matrix. Let's say

py> mtx
array([[  0.88302225,   0.11697778,   0.45451948,   5. ],
       [  0.11697778,   0.88302225,  -0.45451948,  10. ],
       [ -0.45451948,   0.45451948,   0.76604444,  20. ],
       [  0.        ,   0.        ,   0.        ,   1. ]])

My usual way of transforming a set of coordinates with a 4x4 matrix is to use numpy:

py> xyz_1
array([[  5.,  10.,  15.,   1.],
       [ 20.,  15.,  10.,   1.]])

py> numpy.inner(xyz_1, mtx)
array([[ 17.40268126,  12.59731919,  33.76326397,   1. ],
       [ 28.9603065 ,  21.03969455,  25.38784698,   1. ]])

What is the equivalent in cctbx? Is there a way to avoid converting coordinates back and fourth between numpy arrays with atoms().extract_xyz() & .set_xyz() (as might be used from a iotbx_pdb_hierarchy_ext.root).

Thank you for any help.

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20130326/5f350faf/attachment.htm>


More information about the cctbxbb mailing list