Re: [AMBER] Howto cpptraj - multiple trajin-commands in one line

From: Falko Jähnert <falko.jaehnert.biochemtech.uni-halle.de>
Date: Wed, 20 Jan 2016 16:37:09 +0100

Dear Jean-Marc,

your message was, what I am looking for. I've implemented this in my lil script and it worked! Thanks a lot from a linux (bash shell) newbie ;)

> Von: Jean-Marc Billod [mailto:jmbillod.cib.csic.es]
> Gesendet: Donnerstag, 14. Januar 2016 16:41
> An: AMBER Mailing List <amber.ambermd.org>
> Betreff: Re: [AMBER] Howto cpptraj - multiple trajin-commands in one line
>
> May I suggest another way of doing it:
> cpptraj can take a file as input using the following command :
> cpptraj -i INPUTFILE
> Then one way of doing it would be to create a bash script that produces the required INPUTFILE which should contain the following informations:
>“parm TOPOLOGY (e.g. .prmtop file)
> trajin xxx_1.mdcrd
> trajin xxx_2.mdcrd
> trajin xxx_3.mdcrd
>...
> ##analysis commands##”
>
> For instance:
> echo “parm FILE.prmtop > trajin.in
> ls -tr *.mdcrd | awk '{print "trajin "$0" 1 1 1"}' >> trajin.in // if you want to list all the .mdcrd file in the current working directory for example.
>...
> then cpptraj -i trajin.in
>
> Hope it can be of any help.
> Jean-Marc


Dear Chris,

wildcards would be nice, but as I am not that fit at shell programming I didnt understand your solution. But nevertheless thanks a lot!


> Von: Chris Moth [mailto:cmoth08.gmail.com]
> Gesendet: Donnerstag, 14. Januar 2016 16:40
> An: AMBER Mailing List <amber.ambermd.org>
> Betreff: Re: [AMBER] Howto cpptraj - multiple trajin-commands in one line
>
> Today, you need a shell script which create the .ptraj script. The ptraj script may have 100s of lines of trajin commands. Such is life. Your shell script will use your shell's "foreach" loop capability to read the output from `echo ~/wherever/xxx_*.mdcrd | sort -nk whatever', and then "echo trajin $filename >> ptrajfilename"
>
> I have often thought that a "wildcard" input to trajin would be quite convenient to avoid the need to create the .ptraj files from a script.
> However, wildcards are not enough.. We'd also need to be able to tell trajin to start a particular filename-number and stop at one.
>

>>> On 14 Jan 2016, at 13:25, Falko Jähnert
>>> <falko.jaehnert.biochemtech.uni-halle.de>>> wrote:
>>>
>>> Dear AMBER-experts,
>>>
>>> I want to automatise my trajectory analysis. For that I use a bash
>>> script to read them in using:
>>>
>>> cpptraj prmtop <<EOF
>>> trajin xxx_1.mdcrd
>>> trajin xxx_2.mdcrd
>>> trajin xxx_3.mdcrd
>>> ##analysis commands##
>>> go
>>> EOF
>>>
>>> My filenames and my mdcrd counts differ a bit from run to run so I
>>> like to fill them in using variables. Filenames are not a problem, but
>>> the number of mdcrd files I would like to determine via checking if a
>>> filename-variable is setted. In this case I attach the trajin command
>>> for that file to an array.
>>>
>>> if [ -n "$xxx_1" ]; then
>>> Array+=('##necessary command##)
>>> fi
>>>
>>> Now I have the problem of using this array to call all the trajins.
>>> Is there a way in cpptraj to call multiple files with one trajin command?
>>> (i.e.: trajin xxx1.mdcrd xxx2.mdcrd xxx3.mdcrd) Alternative, is it
>>> possible to get those trajin commands in a single line?
>>> (i.e.: trajin xxx1.mdcrd; trajin xxx2.mdcrd; trajin xxx3.mdcrd)
>>>
>>> This will enforce the way I have to use for implementing the array
>>> filling function.
>>>
>>> Thanks in advance for your help! Hope, I didn't oversee these question
>>> in the Mailing Archive...
>>> Falko.
>>>
>>>
>>>
>>> _______________________________________________
>>> AMBER mailing list
>>> AMBER.ambermd.org
>>>>>>>>> http://lists.ambermd.org/mailman/listinfo/amber


_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber


_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Wed Jan 20 2016 - 08:00:04 PST
Custom Search