average

Calculate an average structure.

Not to be confused with the avg command.

average {crdset <set name> | <filename>} [<mask>] [start <start>] [stop <stop>] [offset <offset>] [Trajout Args]

<filename> If specified, write averaged coordinates to <filename> (not compatible with crdset).
crdset <set name> If specified, save averaged coordinates to COORDS set <set name> (not compatible with <filename>).
[<mask>] Average coordinates in <mask> (all atoms if not specified).
[<start>] Frame to begin calculation at (default 1).
[<stop>] Frame to end calculation at (default last).
[<offset>] Frames to skip between calculations (default 1).
[Trajout args] Output trajectory format argument(s) (default Amber Trajectory).

Calculate the average of input coordinates and write out to file named <filename> or save to COORDS set named <set name> in any trajectory format CPPTRAJ recognizes (Amber Trajectory if not specified). If the number of atoms in <mask> are less than the total number of atoms, the topology will be stripped to match <mask>.

Note that since coordinates are being averaged over many frames, resulting structures may appear distorted. For example, if one averages the coordinates of a freely rotating methyl group the average position of the hydrogen atoms will be close to the center of rotation. Also note that typically one will want to remove global rotational and translation movement prior to this command by using e.g. the rms command.

Any arguments that are valid for the trajout command can be passed to this command in order to control the format of the output coordinates. For example, to write out a PDB file containing the averaged coordinates over all frames:

average test.pdb pdb

To write out a mol2 file containing only the averaged coordinates of residues 1 to 10 for frames 1 to 100:

average test.mol2 mol2 start 1 stop 100 :1-10

To create an average structure of atoms named CA and then use it as a reference for an rms command in a subsequent run:

trajin Input.nc
average crdset MyAvg @CA
run
rms ref MyAvg @CA out RmsToAvg.dat
run