Re: Loop

From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Thu Oct 01 2009 - 16:56:45 CDT

On Thu, 2009-10-01 at 12:59 +0000, Andres Morales N wrote:
>
> Dear NAMD users:

dear andres,

> I have used NMAD for windows so I am new using NAMD for Linux. I need
> to run 100 simulations in NAMD, I have .conf files for that. I know
> that I should write in the console: ./namd2 file.conf > file.log, for
> each file, so I do not know how to run all of them with somo loop.
> When I worked in Windows, I wrote : FOR %i IN(*.conf) DO namd2 %i > %
> i.log.
>
> Do you have any ideas to do this in Linux? (Files are named like:
> File_1.conf, file_2.conf....., file_100.conf)

this is something you should look up in a "shell script" tutorial.
you windows example is quoting the windows command interpreter
syntax. in linux or unix machines, you have a choice of command
interpreters and that determines the syntax. if this interpreter
is bash (the most common), the syntax would be:

for i in *.conf; do namd2 $i > $i.log ; done

this will however, not execute those in numerical sequence,
but sorted with ASCII string sorting. to get this work in sequence,
you need to:

for i in `seq 1 100` ; do namd2 file_${i}.conf > file_${i}.log ; done

HTH,
   axel.
> Thank for your suggestion.
>
>
> Andres
>
>
>
> ______________________________________________________________________
>
> Get news, entertainment and everything you care about at Live.com.
> Check it out!

-- 
Dr. Axel Kohlmeyer  akohlmey_at_gmail.com 
Institute for Computational Molecular Science
College of Science and Technology
Temple University, Philadelphia PA, USA.

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 05:22:25 CST