[{"page": 1, "text": "CPPTRAJ\nDaniel R. Roe\nJanuary 27, 2026\nhttps://github.com/Amber-MD/cpptraj\nContents\n1 Introduction 8\n1.1 Manual Syntax Format. . . . . . . . . . . . . . . . . . . . . . . . 9\n1.2 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9\n1.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9\n2 Running Cpptraj 9\n2.1 Command Line Syntax . . . . . . . . . . . . . . . . . . . . . . . . 9\n2.2 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11\n2.3 Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12\n2.4 Batch mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12\n2.5 Interactive mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 12\n2.6 Trajectory Processing “Run” . . . . . . . . . . . . . . . . . . . . . 13\n2.6.1 Actions and multiple topologies . . . . . . . . . . . . . . . 13\n2.7 Parallelization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13\n2.7.1 MPI Trajectory Parallelization . . . . . . . . . . . . . . . 13\n2.7.2 OpenMP Parallelization . . . . . . . . . . . . . . . . . . . 14\n2.7.3 CUDA Parallelization . . . . . . . . . . . . . . . . . . . . 15\n3 General Concepts 15\n3.1 Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15\n3.2 Atom Mask Selection Syntax . . . . . . . . . . . . . . . . . . . . 16\n3.3 Ranges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18\n3.4 Parameter/Reference Tagging . . . . . . . . . . . . . . . . . . . . 18\n4 Variables and Control Structures 19\n4.1 for . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20\n4.2 set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21\n4.3 show . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22\n1"}, {"page": 2, "text": "5 Data Sets and Data Files 23\n5.1 Data Set Selection Syntax . . . . . . . . . . . . . . . . . . . . . . 25\n5.2 Data Set Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25\n6 Data File Options 27\n6.1 Standard Data File Options . . . . . . . . . . . . . . . . . . . . . 28\n6.2 Grace Data File Options . . . . . . . . . . . . . . . . . . . . . . . 31\n6.3 Gnuplot Data File Options . . . . . . . . . . . . . . . . . . . . . 31\n6.4 Amber REM Log Options . . . . . . . . . . . . . . . . . . . . . . 32\n6.5 Amber MDOUT Options . . . . . . . . . . . . . . . . . . . . . . 32\n6.6 Evecs File Options . . . . . . . . . . . . . . . . . . . . . . . . . . 33\n6.7 Vector psuedo-traj Options . . . . . . . . . . . . . . . . . . . . . 33\n6.8 OpenDX file options . . . . . . . . . . . . . . . . . . . . . . . . . 33\n6.9 CCP4 file options . . . . . . . . . . . . . . . . . . . . . . . . . . . 34\n6.10 Charmm REPD log options . . . . . . . . . . . . . . . . . . . . . 34\n6.11 Amber Constant pH Out options . . . . . . . . . . . . . . . . . . 34\n7 Coordinates (COORDS) Data Set Commands 34\n7.1 catcrd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36\n7.2 combinecrd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36\n7.3 crdaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37\n7.4 crdout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37\n7.5 crdtransform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37\n7.6 createcrd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38\n7.7 emin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38\n7.8 extendedcomp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40\n7.9 graft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40\n7.10 loadcrd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41\n7.11 loadtraj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42\n7.12 permutedihedrals . . . . . . . . . . . . . . . . . . . . . . . . . . . 42\n7.13 prepareforleap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44\n7.14 reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48\n7.15 rotatedihedral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48\n7.16 sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49\n7.17 splitcoords. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50\n7.18 zmatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50\n8 General Commands 51\n8.1 activeref . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52\n8.2 calc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53\n8.3 clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53\n8.4 create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53\n8.5 createset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53\n8.6 datafile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54\n8.7 datafilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54\n8.8 dataset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55\n2"}, {"page": 3, "text": "8.9 debug | prnlev. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59\n8.10 ensextension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59\n8.11 exit | quit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59\n8.12 flatten . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59\n8.13 go | run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60\n8.14 help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60\n8.15 list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61\n8.16 noexitonerror . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61\n8.17 noprogress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61\n8.18 parallelanalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61\n8.19 parsedata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62\n8.20 precision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63\n8.21 random . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63\n8.22 readdata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64\n8.23 readensembledata . . . . . . . . . . . . . . . . . . . . . . . . . . . 65\n8.24 readinput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65\n8.25 removedata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65\n8.26 rst . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65\n8.27 runanalysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66\n8.28 select. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67\n8.29 selectds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67\n8.30 sortensembledata . . . . . . . . . . . . . . . . . . . . . . . . . . . 67\n8.31 usediskcache. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67\n8.32 write | writedata . . . . . . . . . . . . . . . . . . . . . . . . . . . 67\n8.33 System Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 68\n9 Topology File Commands 68\n9.1 angleinfo | angles | printangles. . . . . . . . . . . . . . . . . . . . 69\n9.2 atominfo | atoms | printatoms . . . . . . . . . . . . . . . . . . . . 70\n9.3 bondinfo | bonds | printbonds . . . . . . . . . . . . . . . . . . . . 70\n9.4 bondparminfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71\n9.5 change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71\n9.6 charge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73\n9.7 comparetop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73\n9.8 dihedralinfo | dihedrals | printdihedrals . . . . . . . . . . . . . . . 74\n9.9 hmassrepartition . . . . . . . . . . . . . . . . . . . . . . . . . . . 74\n9.10 improperinfo | impropers | printimpropers . . . . . . . . . . . . . 75\n9.11 mass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75\n9.12 molinfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76\n9.13 parm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76\n9.13.1 PDB format: . . . . . . . . . . . . . . . . . . . . . . . . . 77\n9.13.2 Charmm PSF: . . . . . . . . . . . . . . . . . . . . . . . . 78\n9.13.3 Gromacs Top . . . . . . . . . . . . . . . . . . . . . . . . . 78\n9.14 parmbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78\n9.15 parminfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79\n9.16 parmstrip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79\n3"}, {"page": 4, "text": "9.17 parmwrite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79\n9.17.1 Amber Topology . . . . . . . . . . . . . . . . . . . . . . . 80\n9.17.2 Charmm PSF . . . . . . . . . . . . . . . . . . . . . . . . . 80\n9.18 printub | ubinfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80\n9.19 resinfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81\n9.20 scaledihedralk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81\n9.21 solvent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82\n9.22 updateparameters . . . . . . . . . . . . . . . . . . . . . . . . . . 82\n10 Trajectory File Commands 82\n10.1 ensemble . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84\n10.2 ensemblesize. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85\n10.3 reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86\n10.4 trajin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87\n10.4.1 Options for Amber NetCDF, Amber NC Restart, Amber\nRestart: . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89\n10.4.2 Options for CHARMM DCD: . . . . . . . . . . . . . . . . 89\n10.4.3 Options for PDB files: . . . . . . . . . . . . . . . . . . . . 90\n10.5 trajout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90\n10.5.1 Options for pdb format . . . . . . . . . . . . . . . . . . . 92\n10.5.2 Options for Amber ASCII format: . . . . . . . . . . . . . 93\n10.5.3 Options for Amber NetCDF format: . . . . . . . . . . . . 94\n10.5.4 Options for Amber Restart/NetCDF Restart format: . . . 94\n10.5.5 Options for CHARMM COORdinates: . . . . . . . . . . . 94\n10.5.6 Options for CHARMM DCD: . . . . . . . . . . . . . . . . 95\n10.5.7 Options for GROMACS TRX/XTC format: . . . . . . . . 95\n10.5.8 Options for mol2 format: . . . . . . . . . . . . . . . . . . 95\n10.5.9 Options for SQM input format: . . . . . . . . . . . . . . . 96\n10.5.10Options for XYZ format: . . . . . . . . . . . . . . . . . . 96\n11 Action Commands 96\n11.1 addatom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101\n11.2 align . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101\n11.3 angle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102\n11.4 areapermol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103\n11.5 atomiccorr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103\n11.6 atomicfluct | rmsf . . . . . . . . . . . . . . . . . . . . . . . . . . . 104\n11.7 atommap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106\n11.8 autoimage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107\n11.9 average . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109\n11.10avgbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110\n11.11avgcoord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110\n11.12bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110\n11.13box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111\n11.14center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112\n11.15check | checkoverlap | checkstructure . . . . . . . . . . . . . . . . 113\n4"}, {"page": 5, "text": "11.16checkchirality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114\n11.17closest | closestwaters. . . . . . . . . . . . . . . . . . . . . . . . . 115\n11.18cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116\n11.19clusterdihedral . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116\n11.20contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117\n11.21createcrd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118\n11.22createreservoir . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118\n11.23density . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118\n11.24diffusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120\n11.25dihedral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122\n11.26dihedralrms | dihrms . . . . . . . . . . . . . . . . . . . . . . . . . 123\n11.27dihedralscan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124\n11.28dipole . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124\n11.29distance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125\n11.30drms | drmsd (distance RMSD) . . . . . . . . . . . . . . . . . . . 126\n11.31dssp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127\n11.32enedecomp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127\n11.33energy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129\n11.34esander . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132\n11.35filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133\n11.36fixatomorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134\n11.37fiximagedbonds . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135\n11.38gist (Grid Inhomogeneous Solvation Theory) . . . . . . . . . . . 136\n11.39grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149\n11.40hbond . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152\n11.41image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157\n11.42jcoupling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158\n11.43keep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159\n11.44lessplit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161\n11.45lie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161\n11.46lipidorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161\n11.47lipidscd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163\n11.48makestructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163\n11.49mask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166\n11.50matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167\n11.51mindist/maxdist . . . . . . . . . . . . . . . . . . . . . . . . . . . 169\n11.52minimage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169\n11.53molsurf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170\n11.54multidihedral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171\n11.55multipucker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172\n11.56multivector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173\n11.57nastruct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174\n11.58nativecontacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180\n11.59outtraj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184\n11.60pairdist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184\n11.61pairwise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185\n5"}, {"page": 6, "text": "11.62principal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186\n11.63projection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187\n11.64pucker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188\n11.65radgyr | rog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189\n11.66radial | rdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190\n11.67randomizeions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192\n11.68remap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192\n11.69replicatecell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193\n11.70rms | rmsd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194\n11.71rms2d | 2drms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197\n11.72rmsavgcorr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197\n11.73rmsf | atomicfluct . . . . . . . . . . . . . . . . . . . . . . . . . . . 197\n11.74rotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197\n11.75rotdif. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199\n11.76runavg | runningaverage . . . . . . . . . . . . . . . . . . . . . . . 199\n11.77scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199\n11.78secstruct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199\n11.79setvelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203\n11.80spam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204\n11.81stfcdiffusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205\n11.82strip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206\n11.83surf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207\n11.84symmrmsd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208\n11.85temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209\n11.86time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210\n11.87tordiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210\n11.88trans | translate . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211\n11.89unstrip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212\n11.90unwrap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212\n11.91vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214\n11.92velocityautocorr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216\n11.93volmap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217\n11.94volume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218\n11.95watershell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219\n11.96xtalsymm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219\n12 Analysis Commands 221\n12.1 autocorr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223\n12.2 avg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224\n12.3 calcdiffusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225\n12.4 calcstate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226\n12.5 cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229\n12.6 cphstats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242\n12.7 corr | correlationcoe . . . . . . . . . . . . . . . . . . . . . . . . . 243\n12.8 crank | crankshaft . . . . . . . . . . . . . . . . . . . . . . . . . . 244\n12.9 crdfluct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244\n6"}, {"page": 7, "text": "12.10crosscorr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245\n12.11curvefit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245\n12.12diagmatrix. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246\n12.13divergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249\n12.14evalplateau . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249\n12.15fft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250\n12.16hausdorff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250\n12.17hist | histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252\n12.18integrate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254\n12.19ired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254\n12.20kde . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256\n12.21lifetime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257\n12.22lowestcurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260\n12.23meltcurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260\n12.24modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260\n12.25multicurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263\n12.26multihist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264\n12.27phipsi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265\n12.28projectdata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266\n12.29regress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266\n12.30remlog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267\n12.31rms2d | 2drms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268\n12.32rmsavgcorr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269\n12.33rotdif. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271\n12.34runningavg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274\n12.35slope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275\n12.36spline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275\n12.37statistics | stat . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276\n12.37.1Torsion Analysis . . . . . . . . . . . . . . . . . . . . . . . 277\n12.37.2Distance Analysis . . . . . . . . . . . . . . . . . . . . . . 277\n12.37.3Pucker Analysis. . . . . . . . . . . . . . . . . . . . . . . . 277\n12.38ti . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278\n12.39tica. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279\n12.40timecorr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280\n12.41vectormath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281\n12.42wavelet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282\n13 Analysis Examples 286\n13.1 Cartesian covariance matrix calculation and projection (PCA). . 286\n13.2 Dihedral covariance matrix calculation and projection for back-\nbone phi/psi (PCA) . . . . . . . . . . . . . . . . . . . . . . . . . 286\n7"}, {"page": 8, "text": "1 Introduction\nCpptraj[1](thesuccessortoptraj)isthemainprograminAmberforprocessing\ncoordinatetrajectoriesanddatafiles. Cpptraj hasawiderangeoffunctionality,\nand makes use of OpenMP/MPI to speed up many calculations, including pro-\ncessingensemblesoftrajectoriesand/orconductingmultipleanalysesinparallel\nwith MPI.[2]\nHere are several notable features of cpptraj:\n1. Trajectories with different topologies can be processed in the same run.\n2. Several actions/analyses in cpptraj are OpenMP parallelized; see section\n2.7.2 for more details.\n3. Trajectory and ensemble reads can be MPI parallelized.\n4. Almostanyfilereadorwrittenbycpptraj canbecompressed(withtheex-\nceptionoftheNetCDFtrajectoryformat). Soforexamplegzipped/bzipped\ntopology files can be read, and data files can be written out as gzip/bzip2\nfiles. Compression is detected automatically when reading, and is deter-\nmined by the filename extension (.gz and .bz2 respectively) on writing.\n5. Theformatofoutputdatafilescanbespecifiedbyextension. Forexample,\ndata files can be written in xmgrace format if the filename given has a\n’.agr’ extension. A trajectory can be written in DCD format if the ’.dcd’\nextension is used.\n6. Multiple output trajectories can be specified, and can be written during\naction processing (as opposed to only after) via the outtraj command.\nInaddition, outputfilescanbedirectedtowriteonlyspecificframesfrom\nthe input trajectories.\n7. Multiple reference structures can be specified. Specific frames from tra-\njectories may be used as a reference structure.\n8. The rmsd action allows specification of a separate mask for the reference\nstructure. In addition, per-residue RMSD can be calculated easily.\n9. Actions that modify coordinates and topology such as the strip/closest\nactionscanoftenwriteanaccompanyingfully-functionalstrippedtopology\nfile.\n10. Usersusuallyareabletofine-tunetheoutputformatofdatafilesdeclared\nin actions using the “out” keyword (for example, the precision of the\nnumbers can be changed). In addition, users can control which data sets\nare written to which files (e.g. if two actions specify the same data file\nwith the ’out’ keyword, data from both actions will be written to that\ndata file).\n8"}, {"page": 9, "text": "11. Userscanmanipulatedatasetsusingmathematicalexpressions(withsome\nlimitations), see 5.2 on page 25 for details.\n12. There is some support for creating internal loops over e.g. mask expres-\nsions and setting internal variables (see for, set, and show commands).\nSeetheREADME.mdfileinthecpptraj homedirectoryforinformationonhow\nto build, authors, and so on.\n1.1 Manual Syntax Format\nThe syntax presented in this manual uses the following conventions:\n<> Denotes a variable.\n[] Denotes something is optional.\n{|} Denotes several choices separated by the ’|’ character; one of the choices\nmust be specified.\n... Denotes the preceding option can be repeated.\nEverything else is as printed.\n1.2 Installation\nSee instructions in the CPPTRAJ GitHub repository README.md file under\n’Installation & Testing’: https://github.com/Amber-MD/cpptraj\n1.3 Examples\nSome examples of running CPPTRAJ are available in the examples subdirec-\ntory. There are also many tests in the test subdirectory which can serve as\nsimple examples.\n2 Running Cpptraj\nCpptraj can be run in either “interactive mode” or in “batch mode”.\n2.1 Command Line Syntax\ncpptraj [-p ] [-i ] [-y ] [-x ]\n[-ya ] [-xa ] []\n[-c ] [-d ] [-w ] [-o ]\n[-h | --help] [-V | --version] [--defines] [-debug <#>]\n[--interactive] [--log ] [-tl]\n[-ms ] [-mr ] [--mask ] [--resmask ]\n9"}, {"page": 10, "text": "[--rng {marsaglia|stdlib|mt|pcg32|xo128}] [--charge ]\n* denotes a flag may be specified multiple times.\n-p * Load as a topology file.\n-i * Read input from .\n-y * Read from trajectory file ; same\nas input ’trajin ’.\n-x * Write trajectory file ; same as\ninput ’trajout ’.\n-ya * Input trajectory file arguments.\n-xa * Output trajectory file arguments.\n* A topology, input trajectory, or file\ncontaining cpptraj input.\n-c * Read as reference\ncoordinates; same as input ’reference ’.\n-d * Read data in from file (’readdata\n’).\n-w Write data from as file\n (’writedata ).\n-o Write CPPTRAJ STDOUT output to file\n.\n-h | –help Print command line help and exit.\n-V | –version Print version and exit.\n–defines Print compiler defines and exit.\n-debug <#> Set global debug level to <#>; same as\ninput ’debug <#>’.\n–interactive Force interactive mode.\n–log Record commands to (interactive\nmode only). Default is ’cpptraj.log’.\n-tl Print length of trajectories specified with ’-y’ to\nSTDOUT. The total number of frames is written out as\n’Frames: ’\n-ms Print selected atom numbers to STDOUT.\nSelected atoms are written out as ’Selected= 1 2 3\n...’\n-mr : Print selected residue numbers to\nSTDOUT. Selected residues are written out as\n’Selected= 1 2 3 ...’\n–mask Print detailed atom selection to STDOUT.\n10"}, {"page": 11, "text": "–resmask Print detailed residue selection to\nSTDOUT.\n--rng Change default random number generator.\n--charge Print total charge (in e-) of atoms\nselected by to STDOUT.\nNote that unlike ptraj, in cpptraj it is not required that a topology file be\nspecified on the command line as long as one is specified in the input file with\nthe ’parm’ keyword. Multiple topology/input files can be specified by use of\nmultiple ’-p’ and ’-i’ flags. All topology and coordinate flags will be processed\nbefore any input flags.\n2.2 Commands\nInput to cpptraj is in the form of commands, which can be categorized in to 2\ntypes: immediate and queued. Immediate commands are executed as soon as\nthey are encountered. Queued commands are initialized when they are encoun-\ntered, but are not executed until a Run is executed via a run or go command.\nActions, Analyses, and Trajectory commands (except reference) are queued\ncommands; however, they can also be run immediately via commands such as\ncrdaction, runanalysis, loadcrd, etc. See 7 on page 34 for more details.\nCommands fall into seven categories:\nGeneral (Immediate) These commands are executed immediately when en-\ntered.\nSystem (Immediate) These are unix system commands (e.g. ’ls’, ’pwd’, etc).\nCoords (Immediate) These commands are used to manipulate COORDS data\nsets; see 7 on page 34 for more details.\nTrajectory (Queued) These commands prepare cpptraj for reading or writing\ntrajectories during a Run.\nTopology (Immediate) These commands are used to read, write, and modify\ntopology information.\nAction (Queued) These commands specify actions that will be performed on\ncoordinate frames read in from trajectories during a Run.\nAnalysis (Queued) These commands specify analyses that will be performed\non data that has been either generated from a Run or read in from an\nexternal source.\nControl (Immediate) These commands set up control blocks that can be used\nto e.g. loop over a set of commands.\n11"}, {"page": 12, "text": "Inadditiontonormalcommands,cpptraj nowhastheabilitytoperformcertain\nbasic math operations, even on data sets. See 5.2 on page 25 for more details.\nCommandsincpptraj canbereadinfromaninputfileorfromtheinteractive\ncommandprompt. A’#’anywhereonalinedenotesacomment;anythingafter\n’#’ will be ignored no matter where it occurs. A ’\\’ allows the continuation of\none line to another. For example, the input:\n# Sample input\ntrajin mdcrd # This is a trajectory\nrms first out rmsd.dat \\\n:1-10\nTranslates to:\ntrajin mdcrd\nrms first out rmsd.dat :1-10\n2.3 Getting Help\nIf in interactive mode, the ’help’ command can be used to list recognized com-\nmands and topics; topics (such as mask syntax) start with uppercase letters.\n’help ’ can be used to get the associated keywords as well as an\nabbreviated description of the command. Most commands have a correspond-\ning test which also serves as an example of how to use the command. See\n$AMBERHOME/AmberTools/test/cpptraj/README for more details.\n2.4 Batch mode\nIn “batch” mode, cpptraj is executed from the command line with one or more\ninput files containing commands to be processed or STDIN. The syntax of is similar to that of ptraj. Keywords specifying different commands\naregivenoneperline. Linesbeginningwith’#’areignoredascomments. Lines\ncan also be continued through use of the ’\\’ character. This is the only allowed\nmode for cpptraj.MPI.\n2.5 Interactive mode\nIn“interactivemode” userscanentercommandsinaUNIX-likeshell. Interactive\nmodeisusefulforrunningshortandsimpleanalysesorfortryingoutnewkinds\nof analyses. If cpptraj is run with ’–interactive’, no arguments, or no specified\ninput file:\ncpptraj\ncpptraj --interactive\ncpptraj \ncpptraj -p \n12"}, {"page": 13, "text": "this brings up the interactive interface. This interface supports command his-\ntory (via the up and down arrows) and tab completion for commands and file\nnames. Ifnologfilenamehasbeengiven(with’–log’), allcommands\nused in interactive mode will be logged to a file named ’cpptraj.log’, which can\nsubsequently be used as input if desired. When starting cpptraj, command\nhistories will be read from any existing logs.\n2.6 Trajectory Processing “Run”\nLike ptraj, a trajectory processing “Run” is one of the main ways to run cpp-\ntraj. First the Run is set up via commands read in from an input file or the\ninteractive prompt. Trajectories are then read in one frame at a time (or in\nthe case of ensemble processing all frames from a given step are read). Actions\nare performed on the coordinates stored in the frame, after which any output\ncoordinates are written. At the end of the run, any data sets generated are\nwritten, and any queued Analyses are performed.\n2.6.1 Actions and multiple topologies\nSince cpptraj supports multiple topology files, during a Run actions are set up\nevery time the topology changes in order to recalculate things like what atoms\nareinamasketc. Actionsthatarenotvalidforthecurrenttopologyareskipped\nfor that topology. So for example given two topology files with 100 residues, if\nthe first topology file processed includes a ligand named MOL and the second\none does not, the action:\ndistance :80 :MOL out D_80-to-MOL.dat\nwill be valid for the first topology but not for the second, so it will be skipped\nas long as the second topology is active.\n2.7 Parallelization\nCpptraj has many levels of parallelization that can be enabled via the ’-mpi’,\n’-openmp’, and/or ’-cuda’ configure flags for MPI, OpenMP, and CUDA paral-\nlelization respectively. At the highest level, trajectory and ensemble reads are\nparallelized with MPI. In addition, certain time consuming actions have been\nparallelized with OpenMP and/or CUDA.\nNote that any combination of the ’-openmp’, ’-cuda’, and ’-mpi’ flags may\nbe used to generate a hybrid MPI/OpenMP/CUDA binary; however this may\nrequire additional runtime setup (e.g. setting OMP_NUM_THREADS for\nOpenMP) to work properly and not oversubscribe cores.\n2.7.1 MPI Trajectory Parallelization\nCpptraj has two levels of MPI parallelization for reading input trajectories.\nThefirstisfor’trajin’trajectoryinput, wherethetrajectoryreadisdividedas\n13"}, {"page": 14, "text": "evenly as possible among all input frames (across-trajectory parallelism). For\nexample, if given two trajectories of 1000 frames each and 4 MPI processes,\nprocess 0 reads frames 1-500 of trajectory 1, process 1 reads frames 501-1000\nof trajectory 1, process 2 reads frames 1-500 of trajectory 2, and process 3\nreads frames 501-1000 of trajectory 2. Most Actions will work with across-\ntrajectory parallelization with the exception of the following: ’clusterdihe-\ndral’, ’contacts’, ’createreservoir’, ’lipidorder’, ’pairwise’, ’stfcdiffu-\nsion’, ’tordiff’, ’unwrap’, and ’xtalsymm’. The ’diffusion’ Action will\nonly work with across-trajectory parallelism if no imaging is to be performed.\nIn addition to across-trajectory parallelism, the ’gist’ command will also\nMPI-parallelize the entropy calculation that occurs after trajectory processing.\nThesecondisfor’ensemble’ trajectoryinput,wherethereading/processing/writing\nof each member of the ensemble is divided up among MPI processes. The num-\nber of MPI processes must be a multiple of the ensemble size. If the number of\nprocessesisgreaterthantheensemblesizethentheprocessingofeachensemble\nmemberwillbedividedamongMPIprocesses(i.e. across-trajectoryparallelism\nwill be used). For example, given an ensemble of 4 trajectories and 8 processes,\nprocesses0and1areassignedtothefirstensembletrajectory,processes2and3\nareassignedtothesecondensembletrajectory,andsoon. Whenusingensemble\nmode in parallel it is recommended that the ensemblesize command be used\nprior to any ensemble command as this will make set up far more efficient.\nNotethatmostAnalysesarenotMPI-parallelized,withtheexceptionofthe\ncalcdiffusion Analysis (12.3 on page 225).\nIn order to use the MPI version, Amber/cpptraj should be configured with\nthe ’-mpi’ flag. You can tell if cpptraj has been compiled with MPI as it will\nprint ’MPI’ in the title, and/or by calling ’cpptraj —defines’ and looking for\n’-DMPI’.\n2.7.2 OpenMP Parallelization\nSome of the more time-consuming actions/analyses in cpptraj have been paral-\nlelized with OpenMP to take advantage of machines with multiple cores. In or-\ndertouseOpenMPparallelizationAmber/cpptraj shouldbeconfiguredwiththe\n’-openmp’ flag. You can easily tell if cpptraj has been compiled with OpenMP\nas it will print ’OpenMP’ in the title, and/or by calling ’cpptraj —defines’ and\nlookingfor’-D_OPENMP’.Thefollowingactions/analyseshavebeenOpenMP\nparallelized:\n2drms/rms2d\natomiccorr\ncalcdiffusion\ncheckstructure\nclosest\ncluster (pair-wise distance calculation and sieved frame restore only)\ndiffusion\ndssp/secstruct\n14"}, {"page": 15, "text": "energy\ngist (non-bonded calculation)\nhbond\nkde\nlipidscd\nmask (distance-based masks only)\nmatrix (coordinate covariance matrices only)\nminimage\nradial\nreplicatecell\nrotdif\nrmsavgcorr\nspam\nsurf\ntordiff\nunwrap\nvelocityautocorr\nvolmap\nwatershell\nwavelet\nBydefaultOpenMPcpptraj willuseallavailablecores. ThenumberofOpenMP\nthreadscanbecontrolledbysettingtheOMP_NUM_THREADSenvironment\nvariable.\n2.7.3 CUDA Parallelization\nSome time-consuming actions in cpptraj have been parallelized with CUDA\nto take advantage of machines with NVIDIA GPUs. In order to use CUDA\nparallelization Amber/cpptraj should be configured with the ’-cuda’ flag. You\ncan easily tell if cpptraj has been compiled with CUDA as it will print ’CUDA’\nanddetailsonthecurrentgraphicsdeviceinthetitle,and/orbycalling’cpptraj\n—defines’ and looking for ’-DCUDA’. The following actions have been CUDA\nparallelized:\nclosest\nwatershell\ngist\nradial\n3 General Concepts\n3.1 Units\nCpptraj uses the AKMA system of units. The execption is time, which is\ntypically expressed in ps (except where noted).\n15"}, {"page": 16, "text": "Variable Unit\nLength Angstrom\nEnergy kcal/mol\nMass AMU\nCharge electron\nTime ps (typically)\nForce kcal/mol*Angstrom\n3.2 Atom Mask Selection Syntax\nThe mask syntax is similar to ptraj. Note that the characters ’:’, ’@’, and ’*’\nare reserved for masks and should not be used in output file or data set names.\nAll masks are case-sensitive. Either names or numbers can be used. Masks\ncan contain ranges (denoted with ’-’) and comma separated lists. The logical\noperands ’&’ (and), ’|’ (or), and ’!’ (not) are also supported.\nThe syntax for elementary selections is the following:\n@{atom numlist} e.g. ’@12,17’, ’@54-85’, ’@12,54-85,90’\n@{atom namelist} e.g. ’@CA’, ’@CA,C,O,N,H’\n@%{atom type name} e.g. ’@%CT’\n@/{atom_element_name} e.g. ’@/N’\n:{residue numlist} e.g. ’:1-10’, ’:1,3,5’, ’:1-3,5,7-9’\n:{residue namelist} e.g. ’:LYS’, ’:ARG,ALA,GLY’\n::{chain id} e.g. ’::B’, ’::A,D’. Requires chain ID information be present in\nthe topology.\n:;{pdb residue number} e.g. ’:;2-4,8’. Requires a PDB loaded as topology,\nor Amber topology with embedded PDB information (see ?? on page ??).\n^{molecule numlist} e.g. ’^1-10’, ’:23,84,111’\n Selection by distance, see be-\nlow.\nSeveral wildcard characters are supported:\n’*’ Zero or more characters.\n’=’ Same as ’*’\n’?’ One character.\nThe wildcards can also be used with numbers or other mask characters, e.g.\n’:?0’ means “:10,20,30,40,50,60,70,80,90”, ’:*’ means all residues and ’@*’ means\nall atoms. If the atom name (or type name) contains a wildcard character like\nanasterisk,itcanbeexplictlyselectedbyescaping(i.e. preceding)thewildcard\ncharacter with a backslash ’\\’. So for example:\n16"}, {"page": 17, "text": "atoms @C?*\nwould select atoms named C5, C4*, C422, etc., but:\natoms @C?\\*\nwould only select C4* out of the above 3 atoms.\nCompound expressions of the following type are allowed:\n:{residue numlist | namelist}@{atom namelist | numlist}\nand are processed as:\n:{residue numlist | namelist} & @{atom namelist | numlist}\ne.g. ’:1-10@CA’ is equivalent to “:1-10 & @CA”.\nMore examples:\n:ALA,TRP All alanine and tryptophan residues.\n:5,10@CA CA carbon in residues 5 and 10.\n:*&!@H= All non-hydrogen atoms (equivalent to \"!@H=\").\n@CA,C,O,N,H All backbone atoms.\n!@CA,C,O,N,H All non-backbone atoms (=sidechains for proteins only).\n:1-500@O&!(:WAT|:LYS,ARG) Allbackboneoxygensinresidues1-500but\nnot in water, lysine or arginine residues.\n^1-2:ASP All residues named ’ASP’ in the first two molecules.\n::A,D@CA All atoms named ’CA’ in chains A and D.\nDistance-based Masks\n\n Atoms to consider.\n Distance operator. {<|>}{@|:|;|^}\n< Distances less than will be selected.\n> Distances greater than or equal to will be selected.\n@ Any atom.\n: Any atom within a residue.\n; Residue geometric center.\n^ Any atom within a molecule.\n The distance criteria in Angstroms.\n17"}, {"page": 18, "text": "Therearetwoveryimportantthingstokeepinmindwhenusingdistancebased\nmasks:\n1. Distance-basedmasksthatupdateeachframearecurrentlyonlysupported\nby the mask action.\n2. Selectionbydistanceforeverythingbutthemask actionrequiresdefining\nareference framewith reference; distancesare thencalculatedusing the\nspecified reference frame only. This reference frame can be changed using\nthe activeref command.\nThe syntax for selection by distance is a expression followed by a\n followed by a (which is in Angstroms).\nTheconsistsof2characters: ’<’(within)or’>’(with-\nout) followed by either ’^’ (molecules), ’:’ (residues), ’;’ (residue centers), or\n’@’ (atoms). For example, ’<:3.0’ means “residues within 3.0 Angstroms” etc.\nFor ’:’ residue- and ’^’ molecule-based distance selection, if any atom in that\nresidue/moleculemeetsthegivendistancecriterion,theentireresidue/molecule\nis selected. For ’;’ residue center, the geometric center of the residue must meet\nthe given distance criterion in order to be selected.\nInplainlanguage,theentiredistancemaskcanbereadas“Select of ”. So for example, the mask expression:\n:11-17<@2.4\nMeans“Selectatomswithin2.4Ådistanceofatomsselectedby’:11-17’(residues\nnumbered 11 through 17)”.\nTo strip everything outside 3.0 Å (i.e. without 3.0 Å) from residue 4 using\nspecified reference coordinates:\nreference mol.rst7\ntrajin mol.rst7\nstrip !(:4<:3.0)\n3.3 Ranges\nFor several commands some arguments are ranges (e.g. ’trajout onlyframes\n’,’nastructresrange’,’rmsdperresrange’);THESE\nARENOTATOMMASKS.Theyaresimplenumberrangesusing’-’tospec-\nify a range and ’,’ to separate different ranges. For example 1-2,4-6,9 specifies\n1 to 2, 4 to 6, and 9, i.e. ’1 2 4 5 6 9’.\n3.4 Parameter/Reference Tagging\nParameterandreferencefilesmaybe’tagged’(i.e. givenanickname);thesetags\ncan then be used in place of the file name itself. A tag in cpptraj is recognized\nbybeingboundedbybrackets(’[’and’]’). Thiscanbeparticularlyusefulwhen\nreading in many parameter or reference files. For example, when reading in\nmultiple reference structures:\n18"}, {"page": 19, "text": "trajin Test1.crd\nreference 1LE1.NoWater.Xray.rst7 [xray]\nreference Test1.crd lastframe [last]\nreference Test2.crd 225 [open]\nrms Xray ref [xray] :2-12@CA out rmsd.dat\nrms Last ref [last] :2-12@CA out rmsd.dat\nrms Open ref [open] :2-12@CA out rmsd.dat\nThis defines three reference structures and gives them tags [xray], [last], and\n[open]. These reference structures can then be referred to by their tags instead\nof their filenames by any action that uses reference structures (in this case the\nRMSD action).\nSimilarly, this can be useful when reading in multiple parameter files:\nparm tz2.ff99sb.tip3p.truncoct.parm7 [tz2-water]\nparm tz2.ff99sb.mbondi2.parm7 [tz2-nowater]\ntrajin tz2.run1.explicit.nc parm [tz2-water]\nreference tz2.dry.rst7 parm [tz2-nowater] [tz2]\nrms ref [tz2] !(:WAT) out rmsd.dat\nThis defines two parm files and gives them tags [tz2-water] and [tz2-nowater],\nthen reads in a trajectory associated with one, and a reference structure associ-\nated with the other. Note that in the ’reference’ command there are two tags;\nthe first goes along with the ’parm’ keyword and specifies what parameter file\nthe reference should use, the second is the tag given to the reference itself (as\nin the previous example) and is referred to in the subsequent RMSD action.\n4 Variables and Control Structures\nAs of version 18, CPPTRAJ has limited support for “script” variables and ’for’\nloops. Script variables are referred to by a dollar sign (’$’) prefix and are\nreplaced when they are processed. These are stored in the master data set list\nlike other data and are assigned the type “string variable”. Note that to use\nscript variables in CPPTRAJ input that is inside another script (e.g.\na BASH script), they must be escaped with the ’\\’ character, e.g.\n#!/bin/bash\nTOP=MyTop.parm7\ncpptraj <‌ inmask [parm | parmindex <#> | <#>] |\n in |\n indata |\n oversets |\n datasetblocks blocksize <#> [blockoffset <#>]\n[cumulative [firstblock <#>]] |\n=;[;][] ... }\nEND KEYWORD: ’done’\nAvailable ’end OP’ : ’<’ ’>’ ’<=’ ’>=’\nAvailable ’increment OP’ : ’++’, ’--’, ’+=’, ’-=’\natoms|residues|molecules|molfirstres|mollastres inmask \nLoop over atoms/residues/molecules/first residue in\nmolecules/last residue in molecules selected by the\ngiven mask expression, set as script variable .\nparm | parmindex <#> <#> Select\ntopology that should be based on (default\nfirst topology).\n in Loop over a comma-separated list of\nstrings. File name wildcards can be used.\n in Loop over elements of\nspecified data set. Currently only 1D scalar sets\nand string sets can be specified.\n oversets Loop over sets selected by\ncomma-separated list of names. Data set wildcards\ncan be used.\n datasetblocks Loop over blocks in\nspecified DataSet.\nblocksize <#> Size of blocks to use.\n[blockoffset <#>] Offset between blocks.\n[cumulative] Instead of blocks of fixed size, use\nblocks of increasing size incremented by\nblocksize.\n[firstblock <#>] When cumulative, the size of\nthe first block (default is first data set\nelement).\n20"}, {"page": 21, "text": "=;[;][]\nLoop over integer script variable starting\nfrom , optionally ending at , increment\nby .\nData Sets Created (datasetblocks loops):\n[block]: (Data set blocks only) Data\nset block of blocksize starting at .\n[cumul]: (Cumulative data set blocks\nonly) Data set block starting at firstblock and\nending at .\nCreate a for loop using one or more mask expressions, integers, etc. Loops\ncan be nested inside each other. Integer loops may be used without an end\ncondition, but in that case at least one descriptor in the loop should have an\nend condition or refer to a mask. Loops are ended by the done keyword.\nNote that non-integer variables (e.g. ’inmask’ loops) are NOT incremented\nafter the final loop iteration, i.e. these loop variables always retain their final\nvalue.\nFor example:\nfor atoms A0 inmask :1-3@CA i=1;i++\ndistance d$i :TCS $A0 out $i.dat\ndone\nThis loops over all atoms in the mask expression ’:1-3@CA’ (all atoms named\nCAinresidues1to3)andcreatesavariablenamed’i’thatstartsfrom1andis\nincrementedby1eachiteration. Insidetheloop,themaskselectionisreferredto\nby $A0andtheintegerby $i. Thisisequivalenttodoing3distancecommands\nlike so:\ndistance d1 :TCS :1@CA out 1.dat\ndistance d2 :TCS :2@CA out 2.dat\ndistance d3 :TCS :3@CA out 3.dat\nTo loop over files named trajA*.nc and trajB*.nc:\nfor TRAJ in trajA*.nc,trajB*.nc\ntrajin $TRAJ 1 last 10\ndone\n4.2 set\nset { |\n {atoms|residues|molecules|atomnums|\nresnums|oresnums|molnums|\ncharge|mass} inmask \n21"}, {"page": 22, "text": "[parm | crdset | parmindex <#> | <#>]\n trajinframes }\nAvailable : ’=’, ’+=’\n Set or append a script\nvariable.\n {atoms|residues|molecules|atomnums|resnums\n|oresnums|molnums} inmask Set/append a\nscript variable to/by the total number of\natoms/residues/molecules in, a range expression of\nselected atom #s/residue #s/original residue\n#s/molecule #s in, or the total charge/mass of atoms\nselected by the given mask expression.\nparm | parmindex <#> | <#> Topology to\nwhich mask should correspond (default first).\n trajinframes Set/append a script\nvariable to/by the total number of frames in\ntrajectories currently loaded by trajin commands.\nSet(=’=’)orappend(=’+=’)ascriptvariable. Scriptvariables\nare character strings, and are referred to in CPPTRAJ input by using a dollar\nsign ’$’ prefix.\nFor example, the following input will load files my.parm7 and my.rst7:\nset PREFIX = my\ntrajin $PREFIX.parm7\ntrajin $PREFIX.rst7\nForexample,thefollowinginputwillprintinfoforthelast10atomsinatopology\nto ’last10.dat’:\nset Natom = atoms inmask *\nlast10 = $Natom - 10\nshow\natoms \"@$last10 - $Natom\" out last10.dat\nThe following input will put a range of residues selected by :LYS:\n> set SELECTED1 = resnums inmask :1-183&:LYS\nUsing topology: FtuFabI.NAD.TCL.parm7\nVariable ’SELECTED1’ set to ’7-8,18,26,44,49,71,79,128,135,151,163,183’\n4.3 show\nshow [ ...]\nIfnovariablenamesspecified,showallcurrentscriptvariablesandtheirvalues.\nOtherwise, show the values of the specified script variables.\n22"}, {"page": 23, "text": "5 Data Sets and Data Files\nIn cpptraj, Actions and Analyses can generate one or more data sets which are\navailable for further processing. For example, the distance command creates\na data set containing distances vs time. The data set can be named by the\nuser simply by specifying a non-keyword string as an additional argument. If\nno name is given, a default one will be generated based on the action name and\ndata set number. For example:\ndistance d1-2 :1 :2 out d1-2.dat\nwill create a data set named “d1-2”. If a name is not specified, e.g.:\ndistance :1 :2 out d1-2.dat\nthe data set will be named “Dis_00000”.\nData files are created automatically by most commands, usually via the\n“out” keyword. Datafilescanalsobeexplicitlycreatedwiththewrite/writedata\nand create commands. Data can also be read in from files via the readdata\ncommand. Cpptrajcurrentlyrecognizestheformatslistedin1,althoughitcan-\nnot write in all formats. In addition, a data set must be valid for the data file\nformat. For example, 3D data (such as a grid) can be written to an OpenDX\nformat file but not a Grace format file.\nThedefaultfileformatiscalled’Standard’,whichsimplyhasdataincolumns,\nlike ptraj, although multiple data sets can be directed to the same output file.\nThe format of a file can be changed either by specifying a recognized keyword\n(eitheronthecommandlineitselforlaterviaa’datafile’command)orbygiving\nthe file an extension corresponding to te format, so ’filename.agr’ will output\nin Grace format, and ’filename.gnu’ will output in Gnuplot contour, and so on.\nThe xmgrace/gnuplot output is particularly nice for the secstruct sumout and\nrmsd perresout files. Additional options for data files can be found in 6 on\npage 27.\nAny action using the “out” keyword will allow data sets from separate com-\nmands to be written into the same file. For example, the commands:\ndihedral phi :1@C :2@N :2@CA :2@C out phipsi.dat\ndihedral psi :2@N :2@CA :2@C :3@N out phipsi.dat\nwill assign the “phi” and “psi” data sets generated from each action to the stan-\ndard data output file “phipsi.dat”:\n#Frame phi psi\nNote that when reading the Amber Prep and Amber OFF Library formats, a\nCOORDS data set will be created for each unit present in these files.\n23"}, {"page": 24, "text": "Format Filename Keyword Valid Notes\nExtensions Dimensions\nStandard .dat dat 1D, 2D, 3D\nGrace .agr, .xmgr grace 1D\nGnuplot .gnu gnu 1D, 2D\nXplor .xplor, .grid xplor 3D\nOpenDX .dx opendx 3D\nAmber REM .log remlog - Read Only\nlog\nAmber .mdout mdout - Energy\nMDOUT information,\nRead Only\nAmber Energy .ene amberene 1D Read Only\nFile\nAmber Evecs .evecs evecs Modes data set\nonly\nAmber .cpout cpout pH data only\nConstant pH\noutput\nDensity Peaks .peaks peaks 3D density\npeaks\n(spam/volmap)\nVector .vectraj vectraj Vector data set Write Only\npseudo-traj only.\nGromacs XVG .xvg xvg - Read Only\nCCP4 .ccp4 ccp4 3D\nCharmm .exch charmmrepd - Read Only\nREPD log\nCharmm .charmmout charmmout - Energy\nOutput information,\nRead Only\nPairwise Cache .cmatrix cmatrix pairwise Used for cluster\n(binary) distances analysis.\nPairwise Cache .nccmatrix nccmatrix pairwise Used for cluster\n(NetCDF) distances analysis.\nNetCDF Data .nc netcdf All data Only state info\nsaved for pH\ndata.\nAmber Prep .prepin prepin COORDS Read Only\nFile\nAmber OFF .off, .lib off,lib COORDS Read Only\nLibrary File\nTable1: DataFileformatsrecognizedbycpptraj. ’ValidDimensions’showswhat\ndimensions the format is valid for (e.g. you cannot write a 1D data set with\nOpenDX format).\n24"}, {"page": 25, "text": "5.1 Data Set Selection Syntax\nManyanalysiscommandscanbeusedtoanalyzemultipledatasets. Thegeneral\nformat for selecting data sets is:\n[]:\nThe ’*’ character can be used as a wild-card for entire names (no partial\nmatches).\n• : The data set name, usually specified in the action (e.g. in\n’distance d0 @1 @2’ the data set name is “d0”).\n• : Optional; this is set for certain data sets internally in or-\nder to easily select subsets of data. The brackets are required. For\nexample, when using ’hbond series’, both solute-solute and solute-solvent\nhydrogen bond time series may be generated. To select all solute-solute\nhydrogen bonds one would use the aspect “[solutehb]”; to select solute-\nsolvent hydrogen bonds the aspect “[solventhb]” would be used. Aspects\nare hard-coded and are listed in the commands that use them.\n• : Optional; for actions that generate many data sets (such as\n’rmsd perres’) an index is used. Depending on the action, the index may\ncorrespond to atom #s, residue #s, etc. A number range (comma and/or\ndash separated) may be used.\nFor example: to select all data sets with aspect “[shear]” named NA_00000:\nNA_00000[shear]\nTo select all data sets with aspect “[stagger]” with any name, indices 1 and 3:\n*[stagger]:1,3\nIn ensemble mode, data set selection has additional syntax:\n[]:%\nWhere is the ensemble member number starting from 0.\n5.2 Data Set Math\nAs of version 15, cpptraj can perform basic math operations, even on data sets\n(with some limitations). Currently recognized operations are:\nOperation Symbol\nMinus -\nPlus +\nDivide /\nMultiply *\nPower ^\nNegate -\nAssign =\n25"}, {"page": 26, "text": "Several functions are also supported:\nFunction Form\nSquare Root sqrt()\nExponential exp()\nNatural Logarithm ln()\nAbsolute Value abs()\nSine sin()\nCosine cos()\nTangent tan()\nSummation sum()\nAverage avg()\nStandard Deviation stdev()\nMinimum min()\nMaximum max()\nNumberscanbeexpressedinscientificnotationusing“E” notation,e.g. 1E-5\n=0.00001. TheparseralsorecognizesPIasthenumberpi. Expressionscanalso\nbe enclosed in parentheses. So for example, the following expression is valid:\n> 1 - ln(sin(PI/4) * 2)^2\nResult: 0.879887\nResults of numerical calculations like the above can be assigned to a variable\n(essentially a data set of size 1) for use in subsequent calculations, e.g.\n> R = 1 - ln(sin(PI/4) * 2)^2\nResult stored in ’R’\n> R + 1 Result: 1.879887\nData sets can be specified in expressions as well. Currently data sets in an\nexpression must be of the same type and only 1D, 2D, and 3D data sets are\nsupported. Functions are applied to each member of the data set. So for exam-\nple, given two 1D data sets of the same size named D0 and D1, the following\nexpression:\n> D2 = sqrt( D0 ) + D1\nwould take the square root of each member of D0, add it to the corresponding\nmember of D1, and assign the result to D2. The following table lists which\noperationsarevalidfordatasettypes. Ifatypeisnotlisteditisnotsupported:\n26"}, {"page": 27, "text": "Data Set Type Supported Ops Supported Funcs Notes\n1D (integer, All All\ndouble, float)\n1D (vector) +, -, *, /, = None ’*’ is dot product\n2D (matrices) +, -, /, *, = sum, avg, stdev,\nmin, max\n3D (grids) +, -, /, *, = sum, avg, stdev,\nmin, max\n6 Data File Options\nDatafileoutputcanbehandledmultiplewaysincpptraj. Outputdatafilescan\nbe created by Actions/Analyses/Commands, or can be explicitly created with\nwritedata (8.32 on page 67) or create (8.4 on page 53) commands. Reading\ndata from files is only done via the readdata command (8.22 on page 64).\nIn general, data files which have been declared with an ’out’ keyword will\nrecognize data file write keywords on the same command line. For example,\nthe ’time’ argument can be passed directly to the output from a distance\ncommand:\ndistance d0 :1 :2 out d0.agr time 0.001\nThe data file format can be changed from standard implicitly by using specific\nfilenameextensionsorkeywords. Iftheextensionisnotrecognizedornokeyword\nis give the default format is ’Standard’. Keywords and extensions for data file\nformats recognized by cpptraj are shown in 1. Note that the use of certain\noptions may be restricted for certain data file formats. These options can also\nbe passed to data files via the datafile command (8.6 on page 54).\n[]\n[{xlabel|ylabel|zlabel}