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

From: Jean-Marc Billod <>
Date: Thu, 14 Jan 2016 16:40:35 +0100

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 >
ls -tr *.mdcrd | awk '{print "trajin "$0" 1 1 1"}' >> // if you want to list all the .mdcrd file in the current working directory for example.
then cpptraj -i

Hope it can be of any help.

> On 14 Jan 2016, at 13:25, Falko Jähnert <> 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
> 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 mailing list
Received on Thu Jan 14 2016 - 08:00:05 PST
Custom Search