From: Peter Freddolino (petefred_at_ks.uiuc.edu)
Date: Wed May 13 2009 - 22:41:34 CDT

Hi,
you will probably find the moveby command to be **much** easier, since
it acts on the full structure at once, eg.,

$O frame $i
$protein frame $i
set ocoord [lindex [$O get {x y z}] 0]
$protein moveby [vecscale -1 $ocoord]

Also, making lots of unneeded atom selections is bad ($sel frame $i
suffices to update an existing selection to a given frame) because it is
expensive, and not deleting them is worse because it wastes memory.

Best,
Peter

Andres Morales N wrote:
>
> Hi all VMD users!
>
> I want to move protein atoms of each strcuture from a dcd file to a
> position where alpha carbon of first residue will be located at point {0
> 0 0}. I tried the script:
>
> set O [atomselect top "protein and resid 1 and alpha"]
> set nf [molinfo top get numframes]
> set protein [atomselect top "protein"]
> set indices 0;
> set newcoords 0;
> lvarpop newcoords
> set indices [$protein get index]
> for {set i 0 } {$i < $nf } { incr i } {
> $O frame $i
> $protein frame $i
> set A [lindex [$O get {x y z}] 0]
> for {set j 0 } {$j < 882 } { incr j } {
> set sel [atomselect top "index $j" frame $i]
> set coor [lindex [$sel get {x y z}] 0]
> set r [vecsub $coor $A]
> lappend newcoords $r
> }
> $protein set {x y z} $newcoords
> }
>
>
> So it apperas the following mistake: *vecsub: two vectors don't have
> the same size*
> **
> I wait somebody can help me.
>
>
> Thanks a lot
>
> Andres
>
>
>
>
> ------------------------------------------------------------------------
> Connect to the next generation of MSN Messenger Get it now!
> <http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline>