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@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@phenix-online.org
http://phenix-online.org/mailman/listinfo/phenixbb