Re: [gmx-users] Re:Shell scripts

2012-07-06 Thread lloyd riggs
Thanks,

and thanks to Tsjerk.

Stephan

 Original-Nachricht 
> Datum: Fri, 06 Jul 2012 20:04:48 +1000
> Von: Mark Abraham 
> An: Discussion list for GROMACS users 
> Betreff: Re: [gmx-users] Re:Shell scripts

> On 6/07/2012 6:27 PM, lloyd riggs wrote:
> > Yes,
> >
> > I was just going over them individually, then cat into a single spread
> sheet, which I can use awk to do combos, $1+$2+$16+$233...etc...
> 
> With Tsjerk's suggestion, and g_energy -xvg none, you can have such a 
> "spread sheet" from one .edr file written in one go.
> 
> Mark
> 
> >
> > Its still alot of files but easier to manipulate with complex .ndx files
> than just using g_energy every time...mostly time saving when you exceed
> 10 simulation or more.  Still, having to re-learn some basic awk, gawk, cat
> and piping skills from 12 years ago is a pain, but the simple things are
> invaluable with gromacs I would say.  Without them you would become so bogged
> one might hit insanity levels...
> >
> >
> > Thanks
> >
> > Stephan Watkins
> > University of Bern-Inselspital
> >
> >
> >  Original-Nachricht ----
> >> Datum: Fri, 6 Jul 2012 07:09:16 +0200
> >> Von: Tsjerk Wassenaar 
> >> An: Discussion list for GROMACS users 
> >> Betreff: Re: [gmx-users] Re:Shell scripts
> >> Hey,
> >>
> >> I'd probably go for something like:
> >>
> >> for ((i=1; i<...; i++)); do echo $i 0 | g_energy ...; done
> >>
> >> Note the additional 0 to make g_energy exit. The (( )) has been in
> >> bash for ages, so that shouldn't be a problem.
> >>
> >> I notice that in the working construct you used 'traj_x.edr', while in
> >> the earlier ones, you used 'traj_${i}.edr'. If you try to extract all
> >> energy terms from a single .edr file, you can also use
> >>
> >> echo $(seq 1321) 0 | g_energy -f traj_x.edr -o stuff.xvg
> >>
> >> and then parse the columns out of the .xvg file.
> >>
> >> Cheers,
> >>
> >> Tsjerk
> >> On Fri, Jul 6, 2012 at 1:11 AM, Mark Abraham 
> >> wrote:
> >>> On 6/07/2012 7:25 AM, lloyd riggs wrote:
> >>>> Dear All,
> >>>>
> >>>> Thank you,
> >>>>
> >>>> I finally got this to work on the other PC after four hours...
> >>>>
> >>>> i=1
> >>>> while [ $i -le 1322 ]
> >>>> do
> >>>> g_energy -f traj_x.edr -o ${i}.xvg << EOF
> >>>> ${i}
> >>>>
> >>>> EOF
> >>>> i=$(($i+1))
> >>>> done
> >>>>
> >>>> Still can not figure out the difference, or why one works on one PC
> and
> >>>> not the other?
> >>>
> >>> Probably different bash versions, as your Ubuntu could well be more
> >> recent
> >>> than some version on a server at work. Try bash --version. If so, poke
> >> your
> >>> system admins to make an up-to-date bash available for you, even if
> not
> >> as
> >>> the system default.
> >>>
> >>> Mark
> >>>
> >>>
> >>>> Stephan (in Rainy Switzerland)
> >>>>
> >>>>  Original-Nachricht 
> >>>>> Datum: Thu, 5 Jul 2012 22:25:06 +0200
> >>>>> Von: Elton Carvalho 
> >>>>> An: Discussion list for GROMACS users 
> >>>>> Betreff: Re: [gmx-users] Re:Shell scripts
> >>>>> On Thu, Jul 5, 2012 at 6:03 PM, lloyd riggs 
> >> wrote:
> >>>>>> Does any one know why, or have some other scripts...
> >>>>>>
> >>>>> My suggestion would be something in the lines of
> >>>>>
> >>>>> #!/bin/bash
> >>>>>
> >>>>> for i in $(seq 2121) ; do
> >>>>> g_energy -f traj_${i}.edr -o ${i}.xvg <<< "${i} 0"
> >>>>> done
> >>>>>
> >>>>> ===
> >>>>>
> >>>>> Notice the "in" keyword right after 'i'.
> >>>>>
> >>>>> I used a subshell to invoke the program 'seq', which generates a
> >>>>> sequence from 1 to the given argument, so we don't depent om how
> these
> >>>>> other constructs with ((; ; )) work among

Re: [gmx-users] Re:Shell scripts

2012-07-06 Thread Mark Abraham

On 6/07/2012 6:27 PM, lloyd riggs wrote:

Yes,

I was just going over them individually, then cat into a single spread sheet, 
which I can use awk to do combos, $1+$2+$16+$233...etc...


With Tsjerk's suggestion, and g_energy -xvg none, you can have such a 
"spread sheet" from one .edr file written in one go.


Mark



Its still alot of files but easier to manipulate with complex .ndx files than 
just using g_energy every time...mostly time saving when you exceed 10 
simulation or more.  Still, having to re-learn some basic awk, gawk, cat and 
piping skills from 12 years ago is a pain, but the simple things are invaluable 
with gromacs I would say.  Without them you would become so bogged one might 
hit insanity levels...


Thanks

Stephan Watkins
University of Bern-Inselspital


 Original-Nachricht 

Datum: Fri, 6 Jul 2012 07:09:16 +0200
Von: Tsjerk Wassenaar 
An: Discussion list for GROMACS users 
Betreff: Re: [gmx-users] Re:Shell scripts
Hey,

I'd probably go for something like:

for ((i=1; i<...; i++)); do echo $i 0 | g_energy ...; done

Note the additional 0 to make g_energy exit. The (( )) has been in
bash for ages, so that shouldn't be a problem.

I notice that in the working construct you used 'traj_x.edr', while in
the earlier ones, you used 'traj_${i}.edr'. If you try to extract all
energy terms from a single .edr file, you can also use

echo $(seq 1321) 0 | g_energy -f traj_x.edr -o stuff.xvg

and then parse the columns out of the .xvg file.

Cheers,

Tsjerk
On Fri, Jul 6, 2012 at 1:11 AM, Mark Abraham 
wrote:

On 6/07/2012 7:25 AM, lloyd riggs wrote:

Dear All,

Thank you,

I finally got this to work on the other PC after four hours...

i=1
while [ $i -le 1322 ]
do
g_energy -f traj_x.edr -o ${i}.xvg << EOF
${i}

EOF
i=$(($i+1))
done

Still can not figure out the difference, or why one works on one PC and
not the other?


Probably different bash versions, as your Ubuntu could well be more

recent

than some version on a server at work. Try bash --version. If so, poke

your

system admins to make an up-to-date bash available for you, even if not

as

the system default.

Mark



Stephan (in Rainy Switzerland)

 Original-Nachricht 

Datum: Thu, 5 Jul 2012 22:25:06 +0200
Von: Elton Carvalho 
An: Discussion list for GROMACS users 
Betreff: Re: [gmx-users] Re:Shell scripts
On Thu, Jul 5, 2012 at 6:03 PM, lloyd riggs 

wrote:

Does any one know why, or have some other scripts...


My suggestion would be something in the lines of

#!/bin/bash

for i in $(seq 2121) ; do
g_energy -f traj_${i}.edr -o ${i}.xvg <<< "${i} 0"
done

===

Notice the "in" keyword right after 'i'.

I used a subshell to invoke the program 'seq', which generates a
sequence from 1 to the given argument, so we don't depent om how these
other constructs with ((; ; )) work among different versions of bash.

I also suggest replacing the here-document by a here-string, but
that's personal taste. You may or may not have problems with older
versions of bash

Greetings from a foggy Groningen,
--
Elton Carvalho
Tel.: +55 11 3091-6985/6922
Dept Física dos Materiais e Mecânica
Instituto de Física
Universidade de São Paulo
P.O. Box 66318 - 05314-970 São Paulo-SP, Brazil
--
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
* Only plain text messages are allowed!
* Please search the archive at
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-requ...@gromacs.org.
* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists



--
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
* Only plain text messages are allowed!
* Please search the archive at
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-requ...@gromacs.org.
* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists



--
Tsjerk A. Wassenaar, Ph.D.

post-doctoral researcher
Molecular Dynamics Group
* Groningen Institute for Biomolecular Research and Biotechnology
* Zernike Institute for Advanced Materials
University of Groningen
The Netherlands
--
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
* Only plain text messages are allowed!
* Please search the archive at
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-requ...@gromacs.org.
* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists



--
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-u

RE: [gmx-users] Re:Shell scripts

2012-07-06 Thread hannes.loeffler
The question was what version of _ bash_ you are using.  If this is your login 
shell a Ctrl-x-v would tell you.  Other wise execture /bin/bash and see what 
you are really using.

But what you should have done first is search your particular error message 
with a search engine of your choice.  The first hits with Google for example 
suggest that you are not using bash at all on that other machine.



From: gmx-users-boun...@gromacs.org [gmx-users-boun...@gromacs.org] on behalf 
of lloyd riggs [lloyd.ri...@gmx.ch]
Sent: 06 July 2012 09:32
To: Discussion list for GROMACS users
Subject: Re: [gmx-users] Re:Shell scripts

Yes,

One is a newer 12. version Vs. 11.10.  The one PC at home just ignores the for 
loop, and uses it as an infanite loop over everything while the other complains 
of syntax (vs.12).  The one "while" loop I posted works on both, and you can 
also catch averidges well by $> sh script.sh >> outterminaloutput.txt  If 
somone is interested in averidges.  For me they're not that important, except 
mayby solvent  wise.  I looked at it with terminal output and realized it went 
on for 10,000 or more steps/iterations over g_energy but didnt notice before is 
why it threw me off.

Thanks
--
Scanned by iCritical.
--
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
* Only plain text messages are allowed!
* Please search the archive at 
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-requ...@gromacs.org.
* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists


Re: [gmx-users] Re:Shell scripts

2012-07-06 Thread lloyd riggs
Yes,

One is a newer 12. version Vs. 11.10.  The one PC at home just ignores the for 
loop, and uses it as an infanite loop over everything while the other complains 
of syntax (vs.12).  The one "while" loop I posted works on both, and you can 
also catch averidges well by $> sh script.sh >> outterminaloutput.txt  If 
somone is interested in averidges.  For me they're not that important, except 
mayby solvent  wise.  I looked at it with terminal output and realized it went 
on for 10,000 or more steps/iterations over g_energy but didnt notice before is 
why it threw me off.

Thanks

Stephan Watkins
University of Bern-Inselspital

 Original-Nachricht 
> Datum: Fri, 06 Jul 2012 09:11:22 +1000
> Von: Mark Abraham 
> An: Discussion list for GROMACS users 
> Betreff: Re: [gmx-users] Re:Shell scripts

> On 6/07/2012 7:25 AM, lloyd riggs wrote:
> > Dear All,
> >
> > Thank you,
> >
> > I finally got this to work on the other PC after four hours...
> >
> > i=1
> > while [ $i -le 1322 ]
> > do
> > g_energy -f traj_x.edr -o ${i}.xvg << EOF
> > ${i}
> >
> > EOF
> > i=$(($i+1))
> > done
> >
> > Still can not figure out the difference, or why one works on one PC and
> not the other?
> 
> Probably different bash versions, as your Ubuntu could well be more 
> recent than some version on a server at work. Try bash --version. If so, 
> poke your system admins to make an up-to-date bash available for you, 
> even if not as the system default.
> 
> Mark
> 
> >
> > Stephan (in Rainy Switzerland)
> >
> >  Original-Nachricht 
> >> Datum: Thu, 5 Jul 2012 22:25:06 +0200
> >> Von: Elton Carvalho 
> >> An: Discussion list for GROMACS users 
> >> Betreff: Re: [gmx-users] Re:Shell scripts
> >> On Thu, Jul 5, 2012 at 6:03 PM, lloyd riggs  wrote:
> >>> Does any one know why, or have some other scripts...
> >>>
> >>
> >> My suggestion would be something in the lines of
> >>
> >> #!/bin/bash
> >>
> >> for i in $(seq 2121) ; do
> >> g_energy -f traj_${i}.edr -o ${i}.xvg <<< "${i} 0"
> >> done
> >>
> >> ===
> >>
> >> Notice the "in" keyword right after 'i'.
> >>
> >> I used a subshell to invoke the program 'seq', which generates a
> >> sequence from 1 to the given argument, so we don't depent om how these
> >> other constructs with ((; ; )) work among different versions of bash.
> >>
> >> I also suggest replacing the here-document by a here-string, but
> >> that's personal taste. You may or may not have problems with older
> >> versions of bash
> >>
> >> Greetings from a foggy Groningen,
> >> -- 
> >> Elton Carvalho
> >> Tel.: +55 11 3091-6985/6922
> >> Dept Física dos Materiais e Mecânica
> >> Instituto de Física
> >> Universidade de São Paulo
> >> P.O. Box 66318 - 05314-970 São Paulo-SP, Brazil
> >> -- 
> >> gmx-users mailing listgmx-users@gromacs.org
> >> http://lists.gromacs.org/mailman/listinfo/gmx-users
> >> * Only plain text messages are allowed!
> >> * Please search the archive at
> >> 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-requ...@gromacs.org.
> >> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
> 
> 
> -- 
> gmx-users mailing listgmx-users@gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-users
> * Only plain text messages are allowed!
> * Please search the archive at
> 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-requ...@gromacs.org.
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
-- 
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
* Only plain text messages are allowed!
* Please search the archive at 
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-requ...@gromacs.org.
* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists


Re: [gmx-users] Re:Shell scripts

2012-07-06 Thread lloyd riggs
Yes,

I was just going over them individually, then cat into a single spread sheet, 
which I can use awk to do combos, $1+$2+$16+$233...etc...

Its still alot of files but easier to manipulate with complex .ndx files than 
just using g_energy every time...mostly time saving when you exceed 10 
simulation or more.  Still, having to re-learn some basic awk, gawk, cat and 
piping skills from 12 years ago is a pain, but the simple things are invaluable 
with gromacs I would say.  Without them you would become so bogged one might 
hit insanity levels...


Thanks

Stephan Watkins
University of Bern-Inselspital


 Original-Nachricht 
> Datum: Fri, 6 Jul 2012 07:09:16 +0200
> Von: Tsjerk Wassenaar 
> An: Discussion list for GROMACS users 
> Betreff: Re: [gmx-users] Re:Shell scripts

> Hey,
> 
> I'd probably go for something like:
> 
> for ((i=1; i<...; i++)); do echo $i 0 | g_energy ...; done
> 
> Note the additional 0 to make g_energy exit. The (( )) has been in
> bash for ages, so that shouldn't be a problem.
> 
> I notice that in the working construct you used 'traj_x.edr', while in
> the earlier ones, you used 'traj_${i}.edr'. If you try to extract all
> energy terms from a single .edr file, you can also use
> 
> echo $(seq 1321) 0 | g_energy -f traj_x.edr -o stuff.xvg
> 
> and then parse the columns out of the .xvg file.
> 
> Cheers,
> 
> Tsjerk
> On Fri, Jul 6, 2012 at 1:11 AM, Mark Abraham 
> wrote:
> > On 6/07/2012 7:25 AM, lloyd riggs wrote:
> >>
> >> Dear All,
> >>
> >> Thank you,
> >>
> >> I finally got this to work on the other PC after four hours...
> >>
> >> i=1
> >> while [ $i -le 1322 ]
> >> do
> >> g_energy -f traj_x.edr -o ${i}.xvg << EOF
> >> ${i}
> >>
> >> EOF
> >> i=$(($i+1))
> >> done
> >>
> >> Still can not figure out the difference, or why one works on one PC and
> >> not the other?
> >
> >
> > Probably different bash versions, as your Ubuntu could well be more
> recent
> > than some version on a server at work. Try bash --version. If so, poke
> your
> > system admins to make an up-to-date bash available for you, even if not
> as
> > the system default.
> >
> > Mark
> >
> >
> >>
> >> Stephan (in Rainy Switzerland)
> >>
> >>  Original-Nachricht 
> >>>
> >>> Datum: Thu, 5 Jul 2012 22:25:06 +0200
> >>> Von: Elton Carvalho 
> >>> An: Discussion list for GROMACS users 
> >>> Betreff: Re: [gmx-users] Re:Shell scripts
> >>> On Thu, Jul 5, 2012 at 6:03 PM, lloyd riggs 
> wrote:
> >>>>
> >>>> Does any one know why, or have some other scripts...
> >>>>
> >>>
> >>> My suggestion would be something in the lines of
> >>>
> >>> #!/bin/bash
> >>>
> >>> for i in $(seq 2121) ; do
> >>> g_energy -f traj_${i}.edr -o ${i}.xvg <<< "${i} 0"
> >>> done
> >>>
> >>> ===
> >>>
> >>> Notice the "in" keyword right after 'i'.
> >>>
> >>> I used a subshell to invoke the program 'seq', which generates a
> >>> sequence from 1 to the given argument, so we don't depent om how these
> >>> other constructs with ((; ; )) work among different versions of bash.
> >>>
> >>> I also suggest replacing the here-document by a here-string, but
> >>> that's personal taste. You may or may not have problems with older
> >>> versions of bash
> >>>
> >>> Greetings from a foggy Groningen,
> >>> --
> >>> Elton Carvalho
> >>> Tel.: +55 11 3091-6985/6922
> >>> Dept Física dos Materiais e Mecânica
> >>> Instituto de Física
> >>> Universidade de São Paulo
> >>> P.O. Box 66318 - 05314-970 São Paulo-SP, Brazil
> >>> --
> >>> gmx-users mailing listgmx-users@gromacs.org
> >>> http://lists.gromacs.org/mailman/listinfo/gmx-users
> >>> * Only plain text messages are allowed!
> >>> * Please search the archive at
> >>> 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-requ...@gromacs.org.
> >>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
> &g

Re: [gmx-users] Re:Shell scripts

2012-07-05 Thread Tsjerk Wassenaar
Hey,

I'd probably go for something like:

for ((i=1; i<...; i++)); do echo $i 0 | g_energy ...; done

Note the additional 0 to make g_energy exit. The (( )) has been in
bash for ages, so that shouldn't be a problem.

I notice that in the working construct you used 'traj_x.edr', while in
the earlier ones, you used 'traj_${i}.edr'. If you try to extract all
energy terms from a single .edr file, you can also use

echo $(seq 1321) 0 | g_energy -f traj_x.edr -o stuff.xvg

and then parse the columns out of the .xvg file.

Cheers,

Tsjerk
On Fri, Jul 6, 2012 at 1:11 AM, Mark Abraham  wrote:
> On 6/07/2012 7:25 AM, lloyd riggs wrote:
>>
>> Dear All,
>>
>> Thank you,
>>
>> I finally got this to work on the other PC after four hours...
>>
>> i=1
>> while [ $i -le 1322 ]
>> do
>> g_energy -f traj_x.edr -o ${i}.xvg << EOF
>> ${i}
>>
>> EOF
>> i=$(($i+1))
>> done
>>
>> Still can not figure out the difference, or why one works on one PC and
>> not the other?
>
>
> Probably different bash versions, as your Ubuntu could well be more recent
> than some version on a server at work. Try bash --version. If so, poke your
> system admins to make an up-to-date bash available for you, even if not as
> the system default.
>
> Mark
>
>
>>
>> Stephan (in Rainy Switzerland)
>>
>>  Original-Nachricht 
>>>
>>> Datum: Thu, 5 Jul 2012 22:25:06 +0200
>>> Von: Elton Carvalho 
>>> An: Discussion list for GROMACS users 
>>> Betreff: Re: [gmx-users] Re:Shell scripts
>>> On Thu, Jul 5, 2012 at 6:03 PM, lloyd riggs  wrote:
>>>>
>>>> Does any one know why, or have some other scripts...
>>>>
>>>
>>> My suggestion would be something in the lines of
>>>
>>> #!/bin/bash
>>>
>>> for i in $(seq 2121) ; do
>>> g_energy -f traj_${i}.edr -o ${i}.xvg <<< "${i} 0"
>>> done
>>>
>>> ===
>>>
>>> Notice the "in" keyword right after 'i'.
>>>
>>> I used a subshell to invoke the program 'seq', which generates a
>>> sequence from 1 to the given argument, so we don't depent om how these
>>> other constructs with ((; ; )) work among different versions of bash.
>>>
>>> I also suggest replacing the here-document by a here-string, but
>>> that's personal taste. You may or may not have problems with older
>>> versions of bash
>>>
>>> Greetings from a foggy Groningen,
>>> --
>>> Elton Carvalho
>>> Tel.: +55 11 3091-6985/6922
>>> Dept Física dos Materiais e Mecânica
>>> Instituto de Física
>>> Universidade de São Paulo
>>> P.O. Box 66318 - 05314-970 São Paulo-SP, Brazil
>>> --
>>> gmx-users mailing listgmx-users@gromacs.org
>>> http://lists.gromacs.org/mailman/listinfo/gmx-users
>>> * Only plain text messages are allowed!
>>> * Please search the archive at
>>> 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-requ...@gromacs.org.
>>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
>
>
> --
> gmx-users mailing listgmx-users@gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-users
> * Only plain text messages are allowed!
> * Please search the archive at
> 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-requ...@gromacs.org.
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists



-- 
Tsjerk A. Wassenaar, Ph.D.

post-doctoral researcher
Molecular Dynamics Group
* Groningen Institute for Biomolecular Research and Biotechnology
* Zernike Institute for Advanced Materials
University of Groningen
The Netherlands
--
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
* Only plain text messages are allowed!
* Please search the archive at 
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-requ...@gromacs.org.
* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists


Re: [gmx-users] Re:Shell scripts

2012-07-05 Thread Mark Abraham

On 6/07/2012 7:25 AM, lloyd riggs wrote:

Dear All,

Thank you,

I finally got this to work on the other PC after four hours...

i=1
while [ $i -le 1322 ]
do
g_energy -f traj_x.edr -o ${i}.xvg << EOF
${i}

EOF
i=$(($i+1))
done

Still can not figure out the difference, or why one works on one PC and not the 
other?


Probably different bash versions, as your Ubuntu could well be more 
recent than some version on a server at work. Try bash --version. If so, 
poke your system admins to make an up-to-date bash available for you, 
even if not as the system default.


Mark



Stephan (in Rainy Switzerland)

 Original-Nachricht 

Datum: Thu, 5 Jul 2012 22:25:06 +0200
Von: Elton Carvalho 
An: Discussion list for GROMACS users 
Betreff: Re: [gmx-users] Re:Shell scripts
On Thu, Jul 5, 2012 at 6:03 PM, lloyd riggs  wrote:

Does any one know why, or have some other scripts...



My suggestion would be something in the lines of

#!/bin/bash

for i in $(seq 2121) ; do
g_energy -f traj_${i}.edr -o ${i}.xvg <<< "${i} 0"
done

===

Notice the "in" keyword right after 'i'.

I used a subshell to invoke the program 'seq', which generates a
sequence from 1 to the given argument, so we don't depent om how these
other constructs with ((; ; )) work among different versions of bash.

I also suggest replacing the here-document by a here-string, but
that's personal taste. You may or may not have problems with older
versions of bash

Greetings from a foggy Groningen,
--
Elton Carvalho
Tel.: +55 11 3091-6985/6922
Dept Física dos Materiais e Mecânica
Instituto de Física
Universidade de São Paulo
P.O. Box 66318 - 05314-970 São Paulo-SP, Brazil
--
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
* Only plain text messages are allowed!
* Please search the archive at
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-requ...@gromacs.org.
* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists



--
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
* Only plain text messages are allowed!
* Please search the archive at 
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-requ...@gromacs.org.

* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists


Re: [gmx-users] Re:Shell scripts

2012-07-05 Thread lloyd riggs
Dear All,

Thank you,

I finally got this to work on the other PC after four hours...

i=1
while [ $i -le 1322 ] 
do
g_energy -f traj_x.edr -o ${i}.xvg << EOF
${i}

EOF
i=$(($i+1))
done

Still can not figure out the difference, or why one works on one PC and not the 
other? 

Stephan (in Rainy Switzerland)

 Original-Nachricht 
> Datum: Thu, 5 Jul 2012 22:25:06 +0200
> Von: Elton Carvalho 
> An: Discussion list for GROMACS users 
> Betreff: Re: [gmx-users] Re:Shell scripts

> On Thu, Jul 5, 2012 at 6:03 PM, lloyd riggs  wrote:
> >
> > Does any one know why, or have some other scripts...
> >
> 
> 
> My suggestion would be something in the lines of
> 
> #!/bin/bash
> 
> for i in $(seq 2121) ; do
> g_energy -f traj_${i}.edr -o ${i}.xvg <<< "${i} 0"
> done
> 
> ===
> 
> Notice the "in" keyword right after 'i'.
> 
> I used a subshell to invoke the program 'seq', which generates a
> sequence from 1 to the given argument, so we don't depent om how these
> other constructs with ((; ; )) work among different versions of bash.
> 
> I also suggest replacing the here-document by a here-string, but
> that's personal taste. You may or may not have problems with older
> versions of bash
> 
> Greetings from a foggy Groningen,
> -- 
> Elton Carvalho
> Tel.: +55 11 3091-6985/6922
> Dept Física dos Materiais e Mecânica
> Instituto de Física
> Universidade de São Paulo
> P.O. Box 66318 - 05314-970 São Paulo-SP, Brazil
> -- 
> gmx-users mailing listgmx-users@gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-users
> * Only plain text messages are allowed!
> * Please search the archive at
> 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-requ...@gromacs.org.
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
-- 
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
* Only plain text messages are allowed!
* Please search the archive at 
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-requ...@gromacs.org.
* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists


Re: [gmx-users] Re:Shell scripts

2012-07-05 Thread Elton Carvalho
On Thu, Jul 5, 2012 at 6:03 PM, lloyd riggs  wrote:
>
> Does any one know why, or have some other scripts...
>


My suggestion would be something in the lines of

#!/bin/bash

for i in $(seq 2121) ; do
g_energy -f traj_${i}.edr -o ${i}.xvg <<< "${i} 0"
done

===

Notice the "in" keyword right after 'i'.

I used a subshell to invoke the program 'seq', which generates a
sequence from 1 to the given argument, so we don't depent om how these
other constructs with ((; ; )) work among different versions of bash.

I also suggest replacing the here-document by a here-string, but
that's personal taste. You may or may not have problems with older
versions of bash

Greetings from a foggy Groningen,
-- 
Elton Carvalho
Tel.: +55 11 3091-6985/6922
Dept Física dos Materiais e Mecânica
Instituto de Física
Universidade de São Paulo
P.O. Box 66318 - 05314-970 São Paulo-SP, Brazil
--
gmx-users mailing listgmx-users@gromacs.org
http://lists.gromacs.org/mailman/listinfo/gmx-users
* Only plain text messages are allowed!
* Please search the archive at 
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-requ...@gromacs.org.
* Can't post? Read http://www.gromacs.org/Support/Mailing_Lists