CPPTRAJ one-liners


Detailed description for most of these examples is available in the Running CPPTRAJ page.

Create a PDB file from a topology and a coordinate file. cpptraj -p topology-file.prmtop -y coordinate-file.coords -x output-file.pdb
Review how many frames are in a trajectory file cpptraj -p topology-file.prmtop -y coordinate-file.coords -tl
To read a file that contains CPPTRAJ commands cpptraj -i INPUTFILE
To inspect residue number one from a topology. This also works for atoms using @1 instead of :1 cpptraj -p topology-file.prmtop --mask :1
To view more information (#Res, Name, First atom, Last atom, number of atoms, #Orig and #Mol) for residues one through ten. cpptraj -p topology-file.prmtop --resmask :1-10
To extract a single frame from a trajectory file, use the -ya keyword to send arguments to trajin cpptraj -p topology-file.prmtop -y trajectory-file.nc -ya 'lastframe' -x output-file.pdb
Quickly print the residues that are in a topology file cpptraj -p topology-file.prmtop --resmask \* This will print all the residues in the topology file

cpptraj -p topology-file.prmtop --resmask :100 This will print information about residue ID 100

Run a loop inside CPPTRAJ
parm A.prmtop
for FRAME in 1,78,100,101,170
  trajin A.nc $FRAME $FRAME