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 extract the charge from a residue. cpptraj -p topology-file.prmtop --charge :1

 Do RMSD analysis of the first molecule (which presumably is chain A) use the ^ operator.
Then do RMSD of chain B (molecule 2) but still using the previous fit (to molecule 1) you would add the nofit keyword

rms R0 first ^1&@C,CA,N out rms.R0.dat

rms R1 first ^2&@C,CA,N nofit out rms.R1.dat
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
done