From: Jason V. <jav...@ut...> - 2008-01-29 13:30:49
|
Buz, Tsjerk's answer is right on. This has already been implemented for PyMOL a= s a=20 plugin. See Kabsch/optAlign from "cealign," here: =20 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=20 matrix. Then multiply the right and left singular vectors by each other --= =20 that will yield the DxD rotation matrix (where D is the dimension of your=20 vector sets). (This is how Kabsch/optAlign works.) =2D- Jason On Monday 28 January 2008 10:48:29 pm=20 pym...@li... wrote: > ------------------------------ > > Message: 3 > Date: Sat, 26 Jan 2008 10:04:06 +0100 > From: "Tsjerk Wassenaar" <ts...@gm...> > Subject: Re: [PyMOL] Algorithm to Rotate One Set of Vectors onto > =A0=A0=A0=A0=A0=A0=A0=A0Another > To: "Buz Barstow" <bu...@ma...> > Cc: pym...@li... > Message-ID: > =A0=A0=A0=A0=A0=A0=A0=A0<8ff898150801260104k4902e5f0tcb94e8ebbbf1e027@mai= l.gmail.com> > Content-Type: text/plain; charset=3DISO-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 =3D 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 =3D RN > > Then > > MN^-1=3DRNN^-1 > > such that > > R =3D 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 <bu...@ma...> 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 =2D-=20 Jason Vertrees (jav...@ut...) Doctoral Candidate Biophysical, Structural & Computational Biology Program University of Texas Medical Branch=20 Galveston, Texas http://www.best.utmb.edu/ http://www.pymolwiki.org/ |