6. Trajectory visualization

Analysis are normally performed locally on a workstation, i.e. copy back all the files from the supercomputer to your local directory.

A typical analysis tasks reads the trajectory (XTC) or energy (EDR) file, computes quantities, and produces data files that can be plotted or processed further, e.g. using Python scripts. A strength of Gromacs is that it comes with a wide range of tools that each do one particular analysis task well (see the Gromacs manual and the Gromacs documentation).

6.1. Keeping the protein in one piece

If you just look at the output trajectory md.xtc in VMD then you will see that the protein can be split across the periodic boundaries and that the simulation cell just looks like a distorted prism. You should recenter the trajectory so that the protein is at the center, remap the water molecules (and ions) to be located in a more convenient unitcell representation.

We will use the trjconv tool in Gromacs to center and remap our system.


trjconv prompts the user with a number of questions that depend on the selected options. In the command line snippets below, the user input is directly fed to the standard input of trjconv with the printf TEXT | trjconv “pipe” construct. In order to better understand the command, run it interactively without the pipe construct and manually provide the required information.

Center (-center) on the Protein and remap all the molecules (-pbc mol) of the whole System:

printf "Protein\nSystem\n" | gmx trjconv -s md.tpr -f md.xtc -center -ur compact -pbc mol -o md_center.xtc

6.2. Pinning down a tumbling protein

It is often desirable to RMS-fit the protein on a reference structure (such as the first frame in the trajectory) to remove overall translation and rotation. In Gromacs, the trjconv tool can also do more “trajectory conversion tasks”. After (1) centering and remapping the system, we want to (2) RMS-fit (due to technical limitations in trjconv you cannot do both at the same time).

RMS-fit (-fit rot+trans) to the protein backbone atoms in the initial frame (supplied in the TPR file) and write out the whole System:

printf "Backbone\nSystem\n" | gmx trjconv -s md.tpr -f md_center.xtc -fit rot+trans -o md_fit.xtc

6.3. Check our modified trajectory

Visualize in VMD:

vmd ../posres/posres.pdb md_fit.xtc