Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project!

## Re: [PyMOL] moving molecules using rotation matrix

 Re: [PyMOL] moving molecules using rotation matrix From: Tsjerk Wassenaar - 2009-03-27 10:39:32 ```Hi Cedric, In general terms, you can do such things with alter_state. More specifically, you may want to start scripting, reading in the file (assuming it's from a file) and doing the transformation. One thing that's not directly clear is whether t is pre- or post-shifting. You can directly read in the matrix from the file using some Python magic: M=[ map(float,x.split()[1:]) for x in open("matrixfile").readlines() if x.strip() and x.strip()[0] in "123" ] Yes, I know this is way over the top :) List comprehensions are definitely the way to break the inobfuscatability of Python ;) But then again, you would be able to do: def ip(x,y): sum( [ x[i]*y[i] for i in range( len( x ) ) ] ) alter_state 1,Chain_1,(x,y,z)=[ M[i][0]+ip((x,y,z),M[i][1:]) for i in range(3) ] Hmm, haven't actually tested this and I don't give warranty ;) Cheers, Tsjerk On Fri, Mar 27, 2009 at 10:56 AM, cedric bauvois wrote: > Dear All, > > Is there any command to move a molecule using this type of matrix ? > > > -------- rotation matrix to rotate Chain-1 to Chain-2 ------ > i t(i) u(i,1) u(i,2) u(i,3) > > 1 -59.0140477207 0.5936510259 -0.4271312489 0.6820097915 > 2 26.6732874752 -0.7924917102 -0.4575097139 0.4032886695 > 3 86.5815155425 0.1397689115 -0.7798998384 -0.6100990849 > > Thanks > > -- > .................................................................. > Dr. Cedric Bauvois > Cristallographie des protéines > Institut de Recherches Microbiologiques J.-M. Wiame -IRMW > Campus CERIA - Av. E. Gryson, 1 > B-1070 Bruxelles, BELGIUM > e-mail: Cedric.Bauvois@... > tél: +32 (0)2 5273634 > fax: +32 (0)2 5267273 > .................................................................. > > ------------------------------------------------------------------------------ > > _______________________________________________ > PyMOL-users mailing list > PyMOL-users@... > https://lists.sourceforge.net/lists/listinfo/pymol-users > > -- Tsjerk A. Wassenaar, Ph.D. Junior UD (post-doc) Biomolecular NMR, Bijvoet Center Utrecht University Padualaan 8 3584 CH Utrecht The Netherlands P: +31-30-2539931 F: +31-30-2537623 ```

 [PyMOL] moving molecules using rotation matrix From: cedric bauvois - 2009-03-27 09:56:51 Attachments: Message as HTML ```Dear All, Is there any command to move a molecule using this type of matrix ? -------- rotation matrix to rotate Chain-1 to Chain-2 ------ i t(i) u(i,1) u(i,2) u(i,3) 1 -59.0140477207 0.5936510259 -0.4271312489 0.6820097915 2 26.6732874752 -0.7924917102 -0.4575097139 0.4032886695 3 86.5815155425 0.1397689115 -0.7798998384 -0.6100990849 Thanks -- .................................................................. Dr. Cedric Bauvois Cristallographie des protéines Institut de Recherches Microbiologiques J.-M. Wiame -IRMW Campus CERIA - Av. E. Gryson, 1 B-1070 Bruxelles, BELGIUM e-mail: Cedric.Bauvois@... tél: +32 (0)2 5273634 fax: +32 (0)2 5267273 .................................................................. ```
 Re: [PyMOL] moving molecules using rotation matrix From: Tsjerk Wassenaar - 2009-03-27 10:39:32 ```Hi Cedric, In general terms, you can do such things with alter_state. More specifically, you may want to start scripting, reading in the file (assuming it's from a file) and doing the transformation. One thing that's not directly clear is whether t is pre- or post-shifting. You can directly read in the matrix from the file using some Python magic: M=[ map(float,x.split()[1:]) for x in open("matrixfile").readlines() if x.strip() and x.strip()[0] in "123" ] Yes, I know this is way over the top :) List comprehensions are definitely the way to break the inobfuscatability of Python ;) But then again, you would be able to do: def ip(x,y): sum( [ x[i]*y[i] for i in range( len( x ) ) ] ) alter_state 1,Chain_1,(x,y,z)=[ M[i][0]+ip((x,y,z),M[i][1:]) for i in range(3) ] Hmm, haven't actually tested this and I don't give warranty ;) Cheers, Tsjerk On Fri, Mar 27, 2009 at 10:56 AM, cedric bauvois wrote: > Dear All, > > Is there any command to move a molecule using this type of matrix ? > > > -------- rotation matrix to rotate Chain-1 to Chain-2 ------ > i t(i) u(i,1) u(i,2) u(i,3) > > 1 -59.0140477207 0.5936510259 -0.4271312489 0.6820097915 > 2 26.6732874752 -0.7924917102 -0.4575097139 0.4032886695 > 3 86.5815155425 0.1397689115 -0.7798998384 -0.6100990849 > > Thanks > > -- > .................................................................. > Dr. Cedric Bauvois > Cristallographie des protéines > Institut de Recherches Microbiologiques J.-M. Wiame -IRMW > Campus CERIA - Av. E. Gryson, 1 > B-1070 Bruxelles, BELGIUM > e-mail: Cedric.Bauvois@... > tél: +32 (0)2 5273634 > fax: +32 (0)2 5267273 > .................................................................. > > ------------------------------------------------------------------------------ > > _______________________________________________ > PyMOL-users mailing list > PyMOL-users@... > https://lists.sourceforge.net/lists/listinfo/pymol-users > > -- Tsjerk A. Wassenaar, Ph.D. Junior UD (post-doc) Biomolecular NMR, Bijvoet Center Utrecht University Padualaan 8 3584 CH Utrecht The Netherlands P: +31-30-2539931 F: +31-30-2537623 ```