Tom,
Neither transform_object or transform_selection are documented
yet, and that reflects the fact the that transformation code in PyMOL is
still immature and likely to change.
However, for your purposes I suggest transform_selection, but be
warned that future changes may break your code at some point.
transform_selection takes a selection name, a matrix, and a 1-based
state index. Selection can be an object name.
cmd.transform_selection(string selection,
list-of-16-floats matrix, int state-number):
Note that matrix is NOT a standard homogenous 4x4 transformation matrix.
Instead it is something PyMOL-specific which consists of the following:
1) a 3x3 matrix containing the rotation in the upper-left quadrant
2) a 3x1 translation to be applied before rotation in the right-hand
column (matrix[3],matrix[7],matrix[11])
3) a 1x3 translation to be applied after rotation in the bottom row
(matrix[12],matrix[13],matrix[14]).
In other words, if the matrix is:
[ m0 m1 m2 m3
m4 m5 m6 m7
m8 m9 m10 m11
m12 m13 m14 m15 ]
Atoms will be transformed as follows
Y = M X
y0 = m0*(x0+m3) + m4*(x1+m7) + m8*(x2+m11) + m12
y1 = m1*(x0+m3) + m5*(x1+m7) + m9*(x2+m11) + m13
y2 = m2*(x0+m3) + m6*(x1+m7) + m10*(x2+m11) + m14
Which is completely non-standard and confusing -- my apologies for that.
I call these things TTT matrices (translate, transform, translate) to
distinguish them from conventional 4x4's. Note that the 3x3
transformation is backwards from what you might normally expect in C or
Python.
Cheers,
Warren
--
mailto:[email protected]
Warren L. DeLano, Ph.D.
Principal Scientist
DeLano Scientific LLC
Voice (650)-346-1154
Fax (650)-593-4020
> -----Original Message-----
> From: [email protected] [mailto:pymol-users-
> [email protected]] On Behalf Of Tom Walsh
> Sent: Monday, October 13, 2003 2:48 AM
> To: [email protected]
> Subject: [PyMOL] Applying a rotation matrix to coordinates
>
> Hi,
>
> I want to superimpose two structures using a translation vector
and
> rotation
> matrix. Is the transform_object() function the best way to do this?
>
> Thanks,
>
> Tom Walsh
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> SourceForge.net hosts over 70,000 Open Source Projects.
> See the people who have HELPED US provide better services:
> Click here: http://sourceforge.net/supporters.php
> _______________________________________________
> PyMOL-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pymol-users