set all [atomselect top all] #get the vector v3 needed set s1 [atomselect top "index 3540"] set s2 [atomselect top "index 3542"] set v1 [lindex [$s1 get {x y z}] 0] $all moveby [vecinvert $v1] set v1 [lindex [$s1 get {x y z}] 0] set v2 [lindex [$s2 get {x y z}] 0] set v3 [vecsub $v1 $v2] #move all atoms to new coor.. foreach cor [$all get {x y z}] indx [$all list] { set at [atomselect top "index $indx"] #by using Matrix routine $at moveto [vectrans [transvecinv $v3] $cor] }