## pymol-users

 [PyMOL] Rotation/Translation From: J. Fleming - 2010-05-29 15:21:36 ```Hello, I've been using 'super' to align the C-alphas within one domain of two different models of the same protein while leaving the second domain to move freely. I can do this using: super (A and resid 1-100 and name ca), (B and resid 1-100 and name ca) What I would like to do is determine the rotation and translation of model B's second domain as it moves away from A's second domain. I can output a matrix after running super using: print cmd.get_object_matrix("A") How do I go from the matrix to an angle and distance? Thanks for any thoughts, Jon ```
 Re: [PyMOL] Rotation/Translation From: Martin Hoefling - 2010-05-30 12:54:39 ```Quoting "J. Fleming" : Hello Jon & ML, > print cmd.get_object_matrix("A") > > How do I go from the matrix to an angle and distance? according to http://www.pymolwiki.org/index.php/Get_object_matrix you should recieve a 4x4 matrix which contains the inital and target translation as lower and right vector. Their difference should be the translation. The 3x3 top-left ist the rotation matrix. The angular extraction depends on which angle(s) you're interested in. If you e.g. have a vector, that describes you inital orientation (along a helix), you can transform it via the rotation matrix and then determine the angle between both. If youre interested in the rotation axis and the angle, have a look into "Finding the rotation matrix" http://en.wikipedia.org/wiki/Rotation_matrix Hope this helps. Best Martin ```
 Re: [PyMOL] Rotation/Translation From: Christoph Gohlke - 2010-05-30 18:22:49 ``` On 5/29/2010 8:21 AM, J. Fleming wrote: > Hello, > > I've been using 'super' to align the C-alphas within one domain of two > different models of the same protein while leaving the second domain > to move freely. I can do this using: > > super (A and resid 1-100 and name ca), (B and resid 1-100 and name ca) > > What I would like to do is determine the rotation and translation of > model B's second domain as it moves away from A's second domain. > > I can output a matrix after running super using: > > print cmd.get_object_matrix("A") > > How do I go from the matrix to an angle and distance? > > Thanks for any thoughts, > Jon > To extract Euler rotation angles from the superimposition matrix you can use the euler_from_matrix function of the transformations.py module at ;. If you rather have a rotation angle and axis use the rotation_from_matrix function. You might have to use the transpose of the matrix returned by PyMOL, not sure. The extraction of the translation vector has already been explained. To find how domain #2 is translated and rotated in molecule B relative to A when the domains #1 of A and B are superimposed, you can write a Python script outside of PyMOL. The following untested (!) script assumes that you have (1) the C-alpha coordinates of molecule A and B as homogeneous coordinate numpy arrays of shape (4, *), and (2) the C-alpha atom indices that belong to domain 1 and 2 as Python sequences or slices: import numpy import transformations # transform B such that domain1 of A and B overlap S0 = transformations.superimposition_matrix( B[:, domain1], A[:, domain1]) B = numpy.dot(S0, B) # calculate matrix to transform domain2 of A to B S1 = transformations.superimposition_matrix( A[:, domain2], B[:, domain2]) # extract translation vector and Euler rotation angles from S1 translation = S1[:3, 3].copy() eulerangles = transformations.euler_from_matrix(S1) -- Christoph ```