[cctbxbb] Rotate & translate a structure

Pavel Afonine pafonine at lbl.gov
Tue Mar 26 10:42:24 PDT 2013


Hi James,

a hint: look how rotate/translate is implemented in :

in cctbx_project/mmtbx/pdbtools.py
look for
def _rb_shift(..)
and then follow the code.

This is just an example of a possible way of doing it. I guess there are 
many more.

Pavel

On 3/26/13 10:29 AM, James Stroud wrote:
> 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
>
>
> _______________________________________________
> cctbxbb mailing list
> cctbxbb at phenix-online.org
> http://phenix-online.org/mailman/listinfo/cctbxbb

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


More information about the cctbxbb mailing list