From: Jérôme Hénin (jerome.henin_at_ibpc.fr)
Date: Tue Feb 18 2020 - 11:34:37 CST

Hi,

Tcl will not do variable substitution inside curly braces. The official way
to construct a list is :
$index moveby [list $x $y $z]

Best,
Jérôme

On Tue, 18 Feb 2020 at 17:10, Adupa Vasista <adupavasista_at_gmail.com> wrote:

> Dear VMD users,
>
> I have a system where I need to randomly distribute the molecules in the
> simulation box with some constraints. I got the coordinates from MATLAB and
> saved it as a dat file. Further I loaded the system and the molecules
> separately (indexed from 1 to 100). i need to randomly place these
> molecules according to the dat file coordinates.
>
> I loaded the dat file using
>
> set fpx [open "x.dat" r]
> set frx [read $fpx]
> set fpy [open "y.dat" r]
> set fry [read $fpy]
> set fpz [open "z.dat" r]
> set frz [read $fpz]
>
> then I used foreach loop
>
> set k 1
> foreach x $frx y $fry z $frz {
> set index [atomselect $k all]
> $index moveby {$x $y $z}
> incr $index 1
> }
>
> But I am having an error in moveby command.
>
> *atomselect moveby: non-numeric in vector*
>
> Is there any workaround for this?
>
> Please let me know.
>
> Thank you.
>