Set up an output trajectory or ensemble for writing during a Run.

trajout <filename> [<format>] [append] [nobox] [novelocity] [notemperature] [notime] [noforce] [noreplicadim] [parm <parmfile> | parmindex <#>] [onlyframes <range>] [title <title>] [onlymembers <memberlist>] [start <start>] [stop <stop>] [offset <offset>] [ <Format Options> ]

<filename> Trajectory file to write to.
[<format>] Keyword specifying output format (see Table of formats). If not specified format will be determined from extension, otherwise default to Amber trajectory.
[append] If <filename> exists, frames will be appended to <filename>.
[nobox] Do not write box coordinates to trajectory.
[novelocity] Do not write velocities to trajectory.
[notemperature] Do not write temperature to trajectory.
[notime] Do not write time to trajectory.
[noreplicadim] Do not write replica dimensions to trajectory.
[parm <parmfile>] Topology filename/tag to associate with trajectory (default first topology).
[parmindex <#>] Index of Topology to associate with trajectory (default 0, first topology).
[onlyframes <range>] Write only the specified input frames to <filename>.
[title <title>] Output trajectory title.
[onlymembers <memberlist>] Ensemble processing only; only write from specified members (starting from 0).
[start <start>] Begin output at frame <start> (1 by default).
[stop <stop>] End output at frame <stop> (last frame by default).
[offset <offset>] Skip <offset> frames between each output (1 by default).

During a run, write frames to trajectory specified by filename in specified file format (Amber trajectory if none specified) after all Action processing has occurred. To write out trajectories within the Action queue see the outtraj Action. See  table of formats for currently recognized output trajectory formats and their associated keyword(s). Note that now the file type can be determined from the output extension if not specified by a keyword. Multiple output trajectories of any format can be specified.

Frames will be written to the output trajectory when the parameter file being processed matches the parameter file the output trajectory was set up with.

So given the input:

parm top0.parm7
parm top1.parm7 [top1]
trajin input0.crd
trajin input1.crd parm [top1]
trajout output.crd parm [top1]

only frames read in from input1.crd (which is associated with top1.parm7) will be written to output.crd. The trajectory input0.crd is associated with top0.parm7; since no output trajectory is associated with top0.parm7 no frames will be written when processing top0.parm7/input0.crd.

If onlyframes is specified, only input frames matching the specified range will be written out. For example, given the input:

trajin input.crd 1 10
trajout output.crd onlyframes 2,5-7

only frames 2, 5, 6, and 7 from input.crd will be written to output.crd.

Cell not X-aligned Warning
Certain Actions (e.g. align, rms, principal, etc.) can rotate the unit cell vectors (i.e. the box) if they are present. Some trajectory formats do not support writing out box coordinates if the unit cell is not X-aligned; in other words, if the unit cell “A” vector is not aligned with the coordinate X-axis and the “B” vector is not in the X-Y plane. If this is the case, the following warnings may appear

Warning: Unit cell is not X-aligned. Box cannot be properly stored as <format>. 
Warning: Set <#>; unit cell is not X-aligned. Box cannot be properly stored as <format>

This means that the frame will be written with the X-aligned unit cell instead of the actual unit cell. Imaging will not be possible with a trajectory written this way. Currently the only trajectory formats that support writing non-X-aligned cells are the Gromacs TRR and XTC formats. If unit cell information is no longer needed, it can be removed (via e.g. the box action, the strip action with the nobox keyword, etc.) to prevent these warnings from triggering.

Options for pdb format:

[dumpq | parse | vdw] [pdbres] [pdbatom] [pdbv3] [teradvance] [terbyres | pdbter | noter] [model | multi] [chainid <ID>] [sg <group>] [include_ep] [conect] [conectmode <m>] [keepext] [usecol21] [bfacdefault <#>] [occdefault <#>] [bfacdata <set>] [occdata <set>] [bfacbyres] [occbyres] [bfacscale] [occscale] [bfacmax <max>] [occmax <max>] [adpdata <set>]

dumpq PQR format; write charges (in units of e-) and GB radii to occupancy and B-factor columns respectively.
parse PQR format; write charges and PARSE radii to occupancy/B-factor columns.
vdw PQR format; write charges and vdW radii to occupancy/B-factor columns.
pdbres Use PDB V3 residue names. Will write a default chain ID (‘Z’) for each residue if the corresponding topology does not have chain ID information.
pdbatom Use PDB V3 atom names.
pdbv3 Use PDB V3 residue/atom names. Same as specifying ‘pdbres’ and ‘pdbatom’.
topresnum Use topology residue numbers; otherwise use original residue numbers.
teradvance Increment record (atom) number for TER records (not done by default).
terbyres Print TER cards based on residue sequence instead of molecules.
pdbter Print TER cards according to original PDB TER (if available).
noter Do not write TER cards.
model (Default) Frames will be written to a single PDB file separated by MODEL/ENDMDL keywords.
multi Each frame will be written to a separate file with the frame # appended to <filename>.
chainid <ID> Write PDB file with chain ID <ID>.
sg <group> Space group for CRYST1 record; only used if box coordinates written.
include_ep Include extra points.
conect Write CONECT records for all bonds.
conectmode <m> Write CONECT records for <m>=’all’ (all bonds), ‘het‘ (HETATM only), ‘none‘ (no CONECT).
keepext Keep filename extension; write ‘<name>.<num>.<ext>’ instead (implies ‘multi’).
usecol21 Use column 21 for 4-letter residue names.
bfacdefault <#> Default value to use in B-factor column (default 0.0)
occdefault <#> Default value to use in occupancy column (default 1.0).
bfacdata <set> Use data in <set> for B-factor column.
occdata <set> Use data in <set> for occupancy column.
bfacbyres If specified assume X values in B-factor data set are residue numbers.
occbyres If specified assume X values in occupancy data set are residue numbers.
bfacscale If specified scale values in B-factor column between 0 and <bfacmax>.
occscale If specified scale values in occupancy column between 0 and <occmax>.
bfacmax <max> Max value for bfacscale.
occmax <max> Max value for occscale.
adpdata <set> Use data in <set> (e.g. from the atomicfluct command) for anisotropic B-factors.

Options for Amber ASCII format:
[remdtraj] [highprecision] [mdvel|mdfrc]
remdtraj Write REMD header to trajectory that includes temperature: ’REMD <Replica> <Step> <Total_Steps> <Temperature>’. Since CPPTRAJ has no concept of replica number, 0 is printed for <Replica>. <Step> and <Total_Steps> are set to the current frame #.
highprecision (EXPERT USE ONLY) Write with 8.6 precision instead of 8.3. Note that since the width does not change, the precision of large coords may be lower than 6.
mdvel Write velocities instead of coordinates.
mdfrc Write forces instead of coordinates.

Options for Amber NetCDF format:
[remdtraj] [mdvel] [mdfrc] [mdcrd]
remdtraj Write replica temperature to trajectory.
mdvel Write only velocity information in trajectory.
mdfrc Write only force information in trajectory.
mdcrd Write coordinates to trajectory (only required with mdvel/mdfrc).
hdf5 Create file as NetCDF4/HDF5 instead of NetCDF4 (classic).
compress Use compression in NetCDF4/HDF5 file.
icompress Use lossy compression in NetCDF4/HDF5 file via conversion to integers.

Options for Amber Restart/NetCDF Restart format:
[remdtraj] [novelocity] [notime] [time0 <initial time>] [dt <timestep>] [keepext]
remdtraj Write replica temperature to restart. Note that this will automatically include time in the restart file (see the time0 keyword).
time0 <initial time> Time for first frame (default 1.0).
dt <timestep> Time step between frames (default 1.0). Time is calculated as t=(time0+frame)*dt.
keepext Keep filename extension; write ’<name>.<num>.<ext>’ instead.

Options for CHARMM COORdinates:
[keepext] [ext] [segid <segid>] <segid> ...
keepext Keep filename extension; write ‘<name>.<num>.<ext>
ext Use ‘extended’ format (default when > 99999 atoms).
segid <segid> Use <segid> as segment ID for all atoms.
segmask <mask> <segid> Use <segid> as segment ID for atoms selected by <mask>. Can be specified more than once.

Options for CHARMM DCD:
[x64] [ucell] [veltraj]
x64 Use 8 byte block size (default 4 bytes).
ucell Write older (v21) format trajectory that stores unit cell params instead of shape matrix.
veltraj Write velocity trajectory instead of coordinates.

Note that by default CPPTRAJ will try to write the symmetric shape matrix if box information is present. If this is not possible, CPPTRAJ will fall back to writing unit cell parameters (lengths and angles) as long as the cell is X-aligned.

Options for GROMACS TRX/XTC format:
[dt <time step>]
dt Time step tp multiply set numbers by (default 1.0). Ignored if time already present.

Note: these formats can write rotated (i.e. non-X-aligned) unit cells.

Options for mol2 format:
[single | multi] [sybyltype] [sybylatom <file>] [sybylbond <file>] [keepext]
single (Default) Frames will be written to a single Mol2 file separated by MOLECULE keywords.
multi Each frame will be written to a separate file with the frame # appended to <filename>.
sybyltype Convert Amber atom types (if present) to SYBYL types. Requires $AMBERHOME is set.
sybylatom File containing Amber to SYBYL atom type correspondance (optional).
sybylbond File containing Amber to SYBYL bond type correspondance (optional).
keepext Keep filename extension; write ’<name>.<num>.<ext>’ instead (implies ’multi’).

Options for SQM input format:
[charge <c>]
charge <c> Set total integer charge. If not specified it will be calculated from atomic charges.

Options for XYZ format:
[ftype {namexyz|atomxyz|xyz}] [titletype {none|single|perframe}] [width <#>] [prec <#>]
ftype {atomxyz|xyz} Choose either ‘NAME X Y Z’ (default), ‘ATOM X Y Z’, or ‘X Y Z’ output format. ‘namexyz’ format is the standard XYZ format, where each frame is preceded by the number of atoms and a comment. The comment written by CPPTRAJ will include the set number and box information (if present).
titletype {none|single|perframe} No title, one title (default), or title before every frame. Only applies if not ‘namexyz’.
width <#> Output format width.
prec <#> Output format precision.