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

From: Hai Nguyen <>
Date: Thu, 14 Jan 2016 18:08:25 -0500

(addition to others' answers): If you also like writing code in Python, you
can check pytraj (python binding to cpptraj) to automatise your analysis. I
myself prefer to write code in Python to bash script since python has nicer
And it has powerful builtin regular expression too (

By the way, you can check a demo with pytraj here for loading trajectories:


On Thu, Jan 14, 2016 at 7:25 AM, 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 - 15:30:04 PST
Custom Search