4.2 Distance, angle, dihedral angle

Files for this tutorial (tutorial-4.2.tar.gz)

In this tutorial, we use trj_analysis in GENESIS analysis tool sets to analyze the variation of structural parameters as a function of simulation time.

In this tutorial, we use the output files obtained in tutorial 1.1. (Please work on tutorial 1.1 first if you have not done it yet.) Untar tutorial-4.2.tar.gz in the same directory as tutorial-1.1:

$ ls 
tutorial-1.1
$ tar -zxf ~/Download/tutorial-4.2.tar.gz
$ ls
tutorial-1.1 tutorial-4.2
$ cd tutorial-4.2
$ ls
run.inp run.sh

In tutorial-1.1, we carried out an MD simulation of a small protein, BPTI, in solution. The MD simulation was performed for 500,000 steps with crdout_period = 500, resulting in a trajectory file containing 1,000 snapshots. Here, we analyze a distance between Cα atoms of the first and the last residues (resid = 1 and 58, respectively), and an angle defined by Cα atoms of residues 1, 25, and 58 of BPTI in each snapshot of the trajectory. Although these parameters do not have biological importance, the purpose of this section is to learn how to use trj_analysis.

In this tutorial, run.inp is the control file. Let’s look into this file.

[INPUT]
reffile = ../tutorial-1.1/1_setup/ionize.pdb # PDB file

[OUTPUT]
disfile = run.dis          # distance file
angfile = run.ang          # angle file

In [INPUT] section, reffile option is the reference structure. In [OUTPUT] section, we specify the name of the output files where the distance and angle are written.

[TRAJECTORY]
trjfile1 = ../tutorial-1.1/5_production/run.dcd  # trajectory file
md_step1       = 500000    # number of MD steps
mdout_period1  =    500    # MD output period
ana_period1    =    500    # analysis period
repeat1 = 1
trj_format = DCD           # (PDB/DCD)
trj_type = COOR            # (COOR/COOR+BOX)
trj_natom = 0              # (0:uses reference PDB atom count)

Input trajectory file is specified with trjfile1 in the [TRAJECTORY] section. md_step1 and mdout_period1 are, respectively, nsteps and crdout_period specified in the MD simulation.

[OPTION]
check_only = NO            # (YES/NO) 
distance1 = BPTI:1:ARG:CA BPTI:58:ALA:CA # atom pair
angle1    = BPTI:1:ARG:CA BPTI:25:ALA:CA BPTI:58:ALA:CA # bond angl

In the [OPTION] section, distance1 and angle1 specify the atoms to define the distance and angle, respectively. Here, the atoms are selected by the following expression:

[segment id:]residue number:residue name:atom name

trj_analysis is executed by run.sh script:

$ cat run.sh
#!/bin/bash

rm -i run.dis run.ang

# set the number of OpenMP threads
export OMP_NUM_THREADS=1

# perform trajectory analysis
trj_analysis run.inp | tee run.out

Note that the output file is not overwritten as in other GENESIS programs. So, a file with the same name must NOT exist in the same directory.

Now, let’s run trj_analysis:

$ chmod +x run.sh
$ ./run.sh
$ ls
run.ang  run.dis  run.inp  run.out  run.sh

We obtain run.ang and run.dis. In these file, the first column is the index of a snapshot, and the second column is the distance or angle values. These data can be plotted with gnuplot:

$ gnuplot 
gnuplot> set xlabel "Time [ps]"
gnuplot> set ylabel "Ca1-Ca58 [angstrom]"
gnuplot> plot "run.dis" w lp
gnuplot> set ylabel "Ca1-Ca25-Ca58 [angle]"
gnuplot> plot "run.ang" w lp

run_dis run_ang

We can see from these figures that the structure has changed around 280 ps.

Quiz: Can you tell what kind of change has happened? The following is the first and last snapshot of the trajectory.

fist_snapshot last_snapshot

To analyze additional atom pairs, we can specify distance2, distance3, ….  By using the trj_analysis tool, we can also analyze various other parameters, such as dihedral angles, center of mass distances,etc. To get the detailed format of the control file, type:

$ trj_analysis -h ctrl

Written by Kiyoshi Yagi@RIKEN Theoretical molecular science laboratory
July, 17, 2016