[cctbxbb] Rotate & translate a structure
Nathaniel Echols
nechols at lbl.gov
Tue Mar 26 10:53:22 PDT 2013
On Tue, Mar 26, 2013 at 10:42 AM, Pavel Afonine <pafonine at lbl.gov> wrote:
> a hint: look how rotate/translate is implemented in :
> ...
> This is just an example of a possible way of doing it. I guess there are
> many more.
A more general method (not dependent on xray.structure):
from scitbx import matrix
rt = matrix.rt(([0.88302225, 0.11697778, 0.45451948, 0.11697778,
0.88302225, -0.45451948, -0.45451948, 0.45451948, 0.76604444],
[5,10,20]))
sites = atoms.extract_xyz()
atoms.set_xyz(rt.r.elems * sites + rt.t.elems)
Internally these are simply tuples - so if you multiply a
flex.vec3_double array with a 9-element tuple, it is assumed to be a
3x3 rotation matrix, and adding a 3-element tuple to the array is
assumed to be a translation. But since these operations are
frequently coupled we usually package the two matrices together.
-Nat
More information about the cctbxbb
mailing list