From: Marzieh Alishahi (alishahi.mar_at_gmail.com)
Date: Thu Feb 21 2013 - 05:30:58 CST

Dear Axel,

Thank you very much for your complete explanation. Actually, I want to
export the computed velocities and positions for all ions in each frame to
text format, I want to perform further analysis on these results using my
own code. Basically I have to extract positions from DCD file and
velocities from VEL.DCD file (I used NAMD). I think its better to order
the text files by serial number of atoms in order to have same id for atoms
in both position file and velocity file. I know maybe my method is not the
best, in fact Im completely messed up! Do you have any idea how arranging
these files?

Thank you again

Best,

Marzieh

On Thu, Feb 21, 2013 at 2:13 PM, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:

> On Thu, Feb 21, 2013 at 10:26 AM, Marzieh Alishahi
> <alishahi.mar_at_gmail.com> wrote:
> > Dear VMD users
> >
> > I know it might be a simple question, but I will be so grateful if you
> help
> > me.
>
>
> > I want to put all the serial id of ion atoms in an array, I tried the
> > following commands;
> >
> > set ion [atomselect top ion]
> >
> > $ion get serial
> >
> > The second line gives me the serial number of all atoms, which are not in
> > array format. Can you help me how I can put this sequence of numbers in
> > array format?
>
> you get a list. what do you need an array for? by what do you want to
> index it?
> please note that arrays in Tcl are "associative arrays" or "maps" and
> not "vectors" or "sequential arrays" like in programming languages
> like C, C++ or Fortran, that is that data is stored in pairs and
> indexed via a hash table. that makes random access faster, but
> sequential access slower than with lists. lists much more resemble
> "sequential arrays"
> thus lists are generally much more efficient and convenient to handle
> when looping over its elements.
> which is the typical case in vmd/tcl scripts. it is trivial Tcl coding
> to convert a list into an array, e.g. via:
>
> set i 0
> foreach a $list {
> set array($i) $a
> incr i
> }
>
> please provide an example of how you want to use the data. it is
> highly likely, that things can be done differently and more
> efficiently.
>
> axel.
>
> axel.
>
> >
> > Thanks in advance
> >
> >
> > Marzieh Alishahi
>
>
>
> --
> Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0
> International Centre for Theoretical Physics, Trieste. Italy.
>