From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Wed Feb 20 2013 - 04:03:54 CST

On Wed, Feb 20, 2013 at 10:38 AM, Rebeca García Fandiño
<regafan_at_hotmail.com> wrote:
> Hi,
> thanks a lot for your help. However, when I tried
>
> set sel [atomselect top "resid 10"]
> set matrix [transaxis z 45]
> $sel move $matrix
>
> I do not obtain a rotated residue around z axis, it is translated long away
> my main molecule...

it works for me.

> My main molecule is a nanotube and it is aligned to principal axes.
> Do you have any idea of the reason for this problem?

there is one thing that you may be overlooking.
by applying a rotation matrix to the coordinates of the selection, you
rotate around the origin of your _coordinate system_ not your
viewpoint. those two may be far away from each other and thus the
rotation may appear as a translation. to rotate about the center of
mass of an object you have to extend the Tcl code as follows:

set sel [atomselect top "resid 10"]
set com [measure center $sel weight mass]
set matrix [transaxis z 45]

$sel moveby [vecscale -1.0 $com]
$sel move $matrix
$sel moveby $com

axel.

> Thanks a lot again for your help.
> Best wishes,
> Rebeca.
>
>
>
>
>> Date: Tue, 19 Feb 2013 17:07:23 +0100
>> Subject: Re: vmd-l: rotate a selection of a molecule and write rotated
>> coordinates
>> From: akohlmey_at_gmail.com
>> To: regafan_at_hotmail.com
>> CC: vmd-l_at_ks.uiuc.edu
>
>>
>> On Tue, Feb 19, 2013 at 3:45 PM, Rebeca García Fandiño
>> <regafan_at_hotmail.com> wrote:
>> > Hello,
>> > I am trying to rotate a part of an assembled molecule, consisting on
>> > several
>> > residues, so I want to rotate only one of these residues, for example,
>> > residue 10. I have tried different combinations:
>> >
>> > set sel [atomselect top "resid 10"]
>> > $sel rotate z by 45
>> >
>> > $sel [rotate z by 45]
>> >
>> > $sel rotate [z by 45]
>> >
>> > But I always get errors.
>>
>> yes, because none of this is not a supported syntax. please have a look
>> at:
>> http://www.ks.uiuc.edu/Research/vmd/current/ug/node121.html
>>
>> > By the other hand, when I have tried to rotate the whole molecule
>> >
>> > set sel [atomselect top "resid 10"]
>> > rotate z by 45
>> >
>> > It works, but when I try to write the coordinates using:
>> >
>> > $sel writepdb file.pdb
>> >
>> > they are identical to the first ones!
>>
>> yes, because the rotate command rotates the *view* (i.e. the camera),
>> it doesn't change the coordinates. please check out:
>> http://www.ks.uiuc.edu/Research/vmd/current/ug/node146.html
>>
>>
>> what you need is:
>>
>> $sel move $matrix
>>
>> and the rotation matrix can be computed beforehand with:
>>
>>
>
>
>>
>> check out:
>> http://www.ks.uiuc.edu/Research/vmd/current/ug/node191.html
>>
>>
>> HTH,
>> axel.
>>
>> > Please, could anyone help me to rotate a selection in a molecule and to
>> > save
>> > its rotated coordinates?
>>
>> > Thanks a lot for your help in advance.
>> >
>> > Best wishes,
>> >
>> > Rebeca.
>> >
>> >
>> >
>> >
>> > Dr Rebeca García
>> > Universidad de Santiago de Compostela
>> > Spain
>> >
>> >
>>
>>
>>
>> --
>> Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0
>> International Centre for Theoretical Physics, Trieste. Italy.
>>

--
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com  http://goo.gl/1wk0
International Centre for Theoretical Physics, Trieste. Italy.