# [gmx-users] Reordering of water molecules with Na+ ions coordinates in xtc file

Tsjerk Wassenaar tsjerkw at gmail.com
Mon Jan 3 18:57:40 CET 2011

```Hi Leila,

r.ndx would be the index file indeed. Sorry for not explicitly mentioning
that. For the rest, the most important question is 'did it work?' Knowing
python is not so important, unless you're determined to understand how it
works :) As for the numbers, python always goes up to, not including. So, to
get a series from 1 to 10, you'd do range(1,11). The line builds three
ranges, so I aliased the function 'range' to 'r' to shorten the line.
There's a lot of malpractice in that line ;) but it works, right?

By the way, Python is worth your while. It's actually renowned for it's
clarity. But anything can be obscured :p

Cheers,

Tsjerk

On Jan 3, 2011 6:39 PM, "leila karami" <karami.leila1 at gmail.com> wrote:

Dear Tsjerk

I have not experience in using python.

in [python -c
'r,a,b,c=range,1868,24086,24100;open("r.ndx","w").write("[x]\n"+"\n".join([str(i)
for i in r(1,a)+r(b,c)+r(a,b)]))'].

r.ndx contains all the atoms. is it true?

why did you use r,a,b,c=range,1868,24086,24100.

is r,a,b,c=range,1867,24085,24099 wrong?

--

Leila Karami
Ph.D. student of Physical Chemistry
K.N. Toosi University of Technology
Theoretical Physical Chemistry Group
--
gmx-users mailing list    gmx-users at gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
Please don't post (un)subscribe requests to the list. Use the
www interface or send it to gmx-users-request at gromacs.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-users/attachments/20110103/66a57205/attachment.html>
```