# [phenixbb] Equations of transformation

Pavel Afonine pafonine at lbl.gov
Wed May 25 23:19:34 PDT 2011

```Hi,

we discussed this recently on phenixbb. Here is the copy:

phenix.pdbtools model.pdb rotate_about_axis.axis="chain A and resseq
1:123 and (name CA or name CB)" rotate_about_axis.atom_selection="chain
A and resseq 1" rotate_about_axis.angle=35

where

rotate_about_axis.axis defines the rotation axis (must be two points in
space);
rotate_about_axis.atom_selection defines the atoms that will be rotated
about the axis;
rotate_about_axis.angle defines rotation angle in degrees.

Instead of specifying atom selection string in rotate_about_axis.axis,
you can give it coordinates of two points:

phenix.pdbtools model.pdb rotate_about_axis.axis="1.234 2.345 4.567
-2.321 3.765 0.001" rotate_about_axis.atom_selection="chain A and resseq
1:123" rotate_about_axis.angle=35

If interested in the math details - see the code in phenix.pdbtools that
does it.

Pavel.

On 5/25/11 12:24 PM, Nathaniel Echols wrote:
> FYI, for anyone inclined to write their own programs, there is a
> similar Python function for this in CCTBX:
>
> from mmtbx.refinement.fit_rotamers import rotate_point_around_axis
> xyz_new = rotate_point_around_axis(axis_start, axis_end, xyz,
> angle_degrees)
>
> I'm not posting the code here because Paul's version is clearer, but
> it's in \$PHENIX/cctbx_project/mmtbx/refinement/fit_rotamers.py.  (It
> wouldn't surprise me if this duplicates a more general function in one
> of the lower-level math modules, but I'm not sure where to look.)
>
> -Nat
>
> On Wed, May 25, 2011 at 12:11 PM, Paul Emsley
> <paul.emsley at bioch.ox.ac.uk <mailto:paul.emsley at bioch.ox.ac.uk>> wrote:
>
>     On 25/05/11 19:41, Hena Dutta wrote:
>
>
>         Dear Members,
>
>
>
>         I want to know the mathematical relations between 2 sets of
>         co-ordinates, one before and one after the rotation. I used
>         COOT to rotate the side chain (containing atoms N1, C2, N3,
>          C4, C5, C6, N6, N7 and C8) of Adenine by 180 degree about the
>         glycosidic bond (C1’-N9). How the initial co-ordinates (Xi,
>         Yi, Zi) and final co-ordinates (Xf, Yf, Zf) are mathematically
>         related? I shall be very grateful if someone can tell me the
>         equations.
>
>
>
>     I got it from the matrix from the Amore documentation.
>
>     Coord_orth
>     rotate_round_vector(direction, // vector of the bond about which
>     we are rotating
>                                    position,  // of the moving atom
>                                    origin_shift, // typically the
>     position of the B atom (e.g. N9)
>                                    angle) {
>
>        unit_vec = direction.unit();
>
>       l = unit_vec[0];
>       m = unit_vec[1];
>       n = unit_vec[2];
>
>       ll = l*l;
>       mm = m*m;
>       nn = n*n;
>       cosk = cos(angle);
>       sink = sin(angle);
>       I_cosk = 1.0 - cosk;
>
>       // The Rotation matrix angle w about vector with direction
>     cosines l,m,n.
>       //
>       // ( l**2+(m**2+n**2)cos k     lm(1-cos k)-nsin k
>      nl(1-cos k)+msin k   )
>       // ( lm(1-cos k)+nsin k        m**2+(l**2+n**2)cos k
>     mn(1-cos k)-lsin k   )
>       // ( nl(1-cos k)-msin k        mn(1-cos k)+lsin k
>      n*2+(l**2+m**2)cos k )
>       //
>       //  Thanks for that pointer EJD :).
>
>
>
>      Paul.
>
>
>
>     _______________________________________________
>     phenixbb mailing list
>     phenixbb at phenix-online.org <mailto:phenixbb at phenix-online.org>
>     http://phenix-online.org/mailman/listinfo/phenixbb
>
>
>
> _______________________________________________
> phenixbb mailing list
> phenixbb at phenix-online.org
> http://phenix-online.org/mailman/listinfo/phenixbb

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phenix-online.org/pipermail/phenixbb/attachments/20110525/5241c40d/attachment.htm>
```

More information about the phenixbb mailing list