From: Adupa Vasista (adupavasista_at_gmail.com)
Date: Tue Feb 18 2020 - 11:29:49 CST

Thanks, I'll check it out.

On Tue, Feb 18, 2020 at 10:58 PM Goedde, Chris <CGOEDDE_at_depaul.edu> wrote:

> You should read through a tcl tutorial; I like the one here:
>
> https://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html
>
> From the section on grouping:
>
> “[G]rouping words within double braces disables substitution within the
> braces. Characters within braces are passed to a command exactly as
> written.”
>
> So your script is passing the literal strings $x $y and $z to moveby, not
> the values stored in x, y, and z. Hence the error about non-numeric values.
>
> I forget whether moveby takes three values or wants a list of three values
> (probably the latter); there are various ways to construct a list, if
> that’s what it wants. See for example, section 17 of the above tutorial. If
> it just wants three values, you can just eliminate the braces from that
> line.
>
> Chris
>
> > On Feb 18, 2020, at 10:59 AM, Adupa Vasista <adupavasista_at_gmail.com>
> wrote:
> >
> > Hi,
> >
> > Thanks for the reply, I am able to read the data and checked that the
> selection and it is not empty, I think the problem is in the moveby
> command which does not take $variable. Is that the problem? If so, Is
> there any other approach for this.
> >
> > Thank you.
> >
> > On Tue, Feb 18, 2020 at 10:16 PM Joaquim Rui de Castro Rodrigues <
> joaquim.rodrigues_at_ipleiria.pt> wrote:
> > Hi,
> >
> > Start by inserting some puts commands before entering the foreach loop,
> to be sure that you are reading data correctly:
> > puts $frx
> > puts $fry
> > puts $frz
> > Dont' forget to close the file after reading. Also, check that you
> selection is not empty:
> > puts [$index num]
> > and finally, in your last line, you probably want to increase the
> counter k, and not the selection $index.
> >
> > HTH,
> > Rui Rodrigues
> >
> >
> >
> > ________________________________________
> > De: owner-vmd-l_at_ks.uiuc.edu <owner-vmd-l_at_ks.uiuc.edu> em nome de Adupa
> Vasista <adupavasista_at_gmail.com>
> > Enviado: 18 de fevereiro de 2020 15:32
> > Para: vmd-l_at_ks.uiuc.edu
> > Assunto: vmd-l: atomselect moveby: non-numeric in vector
> >
> > 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.
> >
> >
> > --
> > A.Vasista
> > M.Tech,Department Of Chemical Engineering,
> > IIT Guwahati.
>
>

-- 
*A.VasistaM.Tech,Department Of Chemical Engineering,*
*IIT Guwahati.*