Re: [AMBER] Split a trajectory into frames

From: Daniel Roe <>
Date: Thu, 26 Jan 2017 10:09:47 -0500

Certain output formats (amber restart/netcdf restart, mol2, pdb)
support doing this automatically. For restart files this is the
default behavior. For PDB/Mol2 files you need to use the 'multi'
keyword with trajout.

On Thu, Jan 26, 2017 at 9:50 AM, Kenneth Huang
<> wrote:
> I'd also be curious if there's a faster way that doesn't require reloading
> the trajectory every single time, though.

For formats that don't have an option for splitting into individual
files (like Amber ASCII trajectory etc), the solution is to have your
script create one input file and do it within the script (example in

lastframe=`cpptraj -p myparm.parm7 -y -tl | awk '{print $2}'`
cat > <<EOF
parm myparm.parm7
for ((frame=1; frame <= $lastframe; frame++)) ; do
  echo "trajout snapshot.$frame.crd onlyframes $frame" >>
cpptraj -i

Hope this helps,


Daniel R. Roe
Laboratory of Computational Biology
National Institutes of Health, NHLBI
5635 Fishers Ln, Rm T900
Rockville MD, 20852
AMBER mailing list
Received on Thu Jan 26 2017 - 07:30:02 PST
Custom Search