From: Adupa Vasista (
Date: Tue Feb 18 2020 - 09:32:22 CST

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.