Buz,

Tsjerk's answer is right on.  This has already been implemented for PyMOL as a 
plugin.  See Kabsch/optAlign from "cealign," here:   
  http://www.pymolwiki.org/index.php/Kabsch
The code is open-source and so can be applied elsewhere.

Another simple method is to simply calculate the SVD of the correlation 
matrix.  Then multiply the right and left singular vectors by each other -- 
that will yield the DxD rotation matrix (where D is the dimension of your 
vector sets).  (This is how Kabsch/optAlign works.)

-- Jason

On Monday 28 January 2008 10:48:29 pm 
pymol-users-requ...@lists.sourceforge.net wrote:
> ------------------------------
>
> Message: 3
> Date: Sat, 26 Jan 2008 10:04:06 +0100
> From: "Tsjerk Wassenaar" <tsje...@gmail.com>
> Subject: Re: [PyMOL] Algorithm to Rotate One Set of Vectors onto
>         Another
> To: "Buz Barstow" <b...@mac.com>
> Cc: pymol-users@lists.sourceforge.net
> Message-ID:
>         <8ff898150801260104k4902e5f0tcb94e8ebbbf1e...@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi Buz,
>
> To my opinion, this is not the best place for your question. Pymol is
> a molecular viewer...
> But the question itself is basically trivial from the linear algebra
> point of view.
>
> If X is your source set of orthogonal vectors and Y is the target,
> then you should have some sort of matrix R to satisfy
>
> Y = RX
>
> But, since it should only be a rotation, you'll first have to
> transform X and Y to their orthonormal counterparts N and M:
>
> M = RN
>
> Then
>
> MN^-1=RNN^-1
>
> such that
>
> R = MN^-1
>
> If both sets are of equal dimensions (and full rank), there's an exact
> solution. Otherwise, there's a bit more trouble...
>
> So, taking your favourite language with the proper linear algebra
> package, it comes down to:
>
> normalize X -> N
> normalize Y -> M
> invert N
> multiply M with the inverse of N
>
> By the way, you're probably dealing with 3x3 matrices here (molecules
> in cartesian space), in which case the routines are simple enough to
> write down yourself (I believe these were even in the array.py I
> posted like two days ago).
>
> Hope it helps,
>
> Tsjerk
>
> On Jan 25, 2008 10:55 PM, Buz Barstow <b...@mac.com> wrote:
> > Dear All,
> >
> > I'm looking for an algorithm that will allow me to derive a
> > transformation matrix that superimposes one set of orthogonal vectors
> > onto another set of orthogonal vectors, that I can then use to
> > transform another set of orthogonal vectors.
> >
> > Thanks! and all the best,
> >
> > --Buz



-- 

Jason Vertrees (javer...@utmb.edu)
Doctoral Candidate
Biophysical, Structural & Computational Biology Program
University of Texas Medical Branch 
Galveston, Texas

http://www.best.utmb.edu/
http://www.pymolwiki.org/

Reply via email to