3 # this is the demo molecule
11 -----------------------------------------------------------------
12 -----------------------------------------------------------------
13 Welcome to the GROMACS demo.
15 This is a script that takes about 10 min to run.
17 In this demo we will demonstrate how to simulate Molecular
18 Dynamics (MD) using the GROMACS software package.
20 The demo will perform a complete molecular dynamics (MD) simulation
21 of a small peptide in water. The only input file we need to do this
22 is a pdb file of a small peptide.
24 If you have any problems or remarks with respect to this demonstration,
25 please mail to: gromacs@gromacs.org , or check the resources on
26 our website http://www.gromacs.org .
27 -----------------------------------------------------------------
28 -----------------------------------------------------------------
30 echo -n "Press <enter>"
33 #########################
34 ### CHECK ENVIRONMENT ###
35 #########################
38 -----------------------------------------------------------------
39 -----------------------------------------------------------------
40 Before we you can actually start the GROMACS demo, the programs
41 must be present in your PATH. This might already be the case if
42 they are linked to /usr/local/bin. If not, follow the instructions
43 in the getting started section. If GROMACS is not installed
44 properly on your computer, contact your system manager.
45 -----------------------------------------------------------------
46 -----------------------------------------------------------------
48 echo -n "Press <enter>"
57 -----------------------------------------------------------------
58 -----------------------------------------------------------------
59 Before we can start any simulation we need a molecular toplogy
60 file. This topology file ( .top extension ) is generated by the
61 program pdb2gmx. The only input file of the pdb2gmx program is the pdb
62 file of our peptide ( .pdb extension ).
64 Because most pdb files do not contain all hydrogen atoms, the pdb2gmx
65 program will also add them to our peptide. The output file which
66 contains the structure of the peptide when hydrogen atoms are added is a
67 gromos structure file ( .gro extension )
69 -----------------------------------------------------------------
70 -----------------------------------------------------------------
74 echo "You seem to have the DISPLAY variable is set, so we will"
75 echo "pop up a window with the output of the pdb2gmx program"
77 echo -n "Press <enter>"
81 echo "Starting pdb2gmx"
83 xterm -title pdb2gmx -sb -e tail +0f output.pdb2gmx &
85 pdb2gmx -f ${MOL}.pdb -o ${MOL}.gro -p ${MOL}.top >& ! output.pdb2gmx << KOKO
90 echo "pdb2gmx finished"
91 echo -n "Press <enter>"
99 -----------------------------------------------------------------
100 -----------------------------------------------------------------
101 Because a simulation of a peptide in vacua is a bit unrealistic, we
102 have to solvate our peptide in a box of water. genbox is the program
105 The genbox program reads the peptide structure file and an input file
106 containing the sizes of the desired water box. The output of genbox is
107 a gromos structure file of a peptide solvated in a box of water. The
108 genbox program also changes the topology file ( .top extension ) to
109 include water. First we will use the program editconf to define the
110 right boxsize for our system.
112 -----------------------------------------------------------------
113 -----------------------------------------------------------------
116 if ( $?DISPLAY ) then
117 echo "The output of the genbox program should appear"
118 echo "in a separate xterm window"
121 echo -n "Press <enter>"
124 echo "Starting editconf and genbox..."
125 if ( $?DISPLAY ) then
126 xterm -title genbox -sb -e tail +0f output.genbox &
128 editconf -f ${MOL}.gro -o ${MOL}.gro -d 0.5 >& ! output.genbox
130 genbox -cp ${MOL}.gro -cs -o ${MOL}_b4em.gro -p ${MOL}.top >>& ! output.genbox
132 echo "editconf and genbox finished"
133 echo -n "Press <enter>"
141 -----------------------------------------------------------------
142 -----------------------------------------------------------------
143 In principle we can start a Molecular Dynamics simulation now. However
144 it is not very wise to do so, because our system is full of close
145 contacts. These close contacts are mainly a result of the genbox
146 program. The added solvent might have some close contacts with the
147 peptide resulting in very high repulsive energies. If we would start a
148 Molecular Dynamics (MD) simulation without energy minimisation the
149 system would not be stable because of these high energies.
151 The standard procedure to remove these close contacts is
152 Energy Minimisation (EM). Energy minimisation slightly changes the
153 coordinates of our system to remove high energies from our system.
155 Before we can start the Energy Minimisation we have to preprocess all
156 the input files with the GROMACS preprocessor named grompp. grompp
157 preprocesses the topology file (.top), the structure file (.gro) and a
158 parameter file (.mdp) resulting in a binary topology file (.tpr
159 extension). This binary topology file contains all information for a
160 simulation (in this case an energy minimisation).
161 -----------------------------------------------------------------
162 -----------------------------------------------------------------
165 if ( $?DISPLAY ) then
166 echo "The output of the grompp program should appear"
167 echo "in a separate xterm window"
170 echo -n "Press <enter>"
173 echo generating energy minimisation parameter file...
174 cat > em.mdp << _EOF_
188 ; Energy minimizing stuff
194 echo "Starting grompp..."
195 if ( $?DISPLAY ) then
196 xterm -title grompp -sb -e tail +0f output.grompp_em &
198 grompp -f em -c ${MOL}_b4em -p ${MOL} -o ${MOL}_em >& ! output.grompp_em
200 echo "grompp finished"
201 echo -n "Press <enter>"
209 -----------------------------------------------------------------
210 -----------------------------------------------------------------
211 Now the binary topology file is generated, we can start the energy
212 minimisation (EM). The program which performs the EM is called
213 mdrun. In fact all simulations are performed by the same program:
216 As the Energy Minimisation is running, watch the output of the
217 program. The first number ( from left to right ) is the number of the
218 iteration step. The second number is the step size, which gives an
219 indication of the change in the system. The third number is the
220 potential energy of the system. This number starts at a high value and
221 rapidly drops down, and converges, to a large negative value.
222 -----------------------------------------------------------------
223 -----------------------------------------------------------------
226 if ( $?DISPLAY ) then
227 echo "The output of the mdrun program should appear"
228 echo "in a separate xterm window"
231 echo -n "Press <enter>"
234 echo "starting energy minimisation mdrun..."
236 if ( $?DISPLAY ) then
237 xterm -title mdrun -sb -e tail +0f output.mdrun_em &
239 mdrun -nice 4 -s ${MOL}_em -o ${MOL}_em -c ${MOL}_b4pr -v >& ! output.mdrun_em
241 echo "mdrun finished"
242 echo -n "Press <enter>"
250 -----------------------------------------------------------------
251 -----------------------------------------------------------------
252 Once all close contacts are removed from the system, we want to do
253 molecular dynamics of the water molecules, and keep the peptide
254 fixed. This is called position restrained (PR) MD.
256 Position Restrained MD keeps the peptide fixed and lets all water
257 molecules equilibrate around the peptide in order to fill holes
258 etc. which were not filled by the genbox program.
260 We are first going to preprocess the input files to generate the
261 binary topology. The input files are the topology file, the structure
262 file ( output of the EM ) a paremeter file, and an index file.
264 By default our system is split into several groups. In this case we
265 use two of those groups: Protein and SOL(vent). We use these groups to
266 put position restraints on all the atoms of the peptide.
268 The parameter file ( .mdp extension ) contains all information about
269 the PR-MD like: step size, number of steps, temperature, etc. This
270 Paramter file also tells GROMACS what kind of simulation should be
271 performed ( like EM, PR-MD and MD etc. )
272 -----------------------------------------------------------------
273 -----------------------------------------------------------------
276 if ( $?DISPLAY ) then
277 echo "The output of the grompp program should appear"
278 echo "in a separate xterm window"
281 echo -n "Press <enter>"
284 echo "generating parameter file..."
285 cat > pr.mdp << _EOF_
286 title = ${MOL} position restraining
289 constraints = all-bonds
292 nsteps = 500 ; total 1.0 ps.
304 ; Berendsen temperature coupling is on in two groups
307 tc-grps = protein sol
309 ; Pressure coupling is not on
312 compressibility = 4.5e-5
314 ; Generate velocites is on at 300 K.
321 echo "Starting grompp..."
322 if ( $?DISPLAY ) then
323 xterm -title grompp -sb -e tail +0f output.grompp_pr &
325 grompp -f pr -c ${MOL}_b4pr -r ${MOL}_b4pr -p ${MOL} -o ${MOL}_pr >& ! output.grompp_pr
326 echo "grompp finished"
328 echo -n "Press <enter>"
336 -----------------------------------------------------------------
337 -----------------------------------------------------------------
338 Now we start the Position restrained Molecular Dynamics simulation. It
339 is important to note that in this example the simulated time is too
340 short (1 ps) to equilibrate our system completely, but that would simple take
341 too much time. ( about one day ).
343 -----------------------------------------------------------------
344 -----------------------------------------------------------------
347 if ( $?DISPLAY ) then
348 echo "Because your DISPLAY variable is set, I will pop up a"
349 echo "window with the output of the mdrun program"
352 echo -n "Press <enter>"
355 echo "starting mdrun..."
356 if ( $?DISPLAY ) then
357 xterm -title mdrun -sb -e tail +0f output.mdrun_pr &
359 mdrun -nice 4 -s ${MOL}_pr -o ${MOL}_pr -c ${MOL}_b4md -v >& ! output.mdrun_pr
361 echo "mdrun finished"
362 echo -n "Press <enter>"
370 -----------------------------------------------------------------
371 -----------------------------------------------------------------
372 Now our complete system is finally ready for the actual Molecular
373 Dynamics simulation. We start again by preprocessing the input files
374 by the grompp program to generate the binary topology file (.tpb/.tpr
377 -----------------------------------------------------------------
378 -----------------------------------------------------------------
381 if ( $?DISPLAY ) then
382 echo "The output of the grompp program should appear"
383 echo "in a separate xterm window"
386 echo -n "Press <enter>"
389 echo "generating parameter file..."
390 cat > md.mdp << _EOF_
393 constraints = all-bonds
396 nsteps = 5000 ; total 5 ps.
406 ; Berendsen temperature coupling is on in two groups
409 tc-grps = protein sol
411 ; Pressure coupling is not on
414 compressibility = 4.5e-5
416 ; Generate velocites is on at 300 K.
422 echo "Starting grompp..."
423 if ( $?DISPLAY ) then
424 xterm -title grompp -sb -e tail +0f output.grompp_md &
426 grompp -f md -c ${MOL}_b4md -p ${MOL} -o ${MOL}_md >& ! output.grompp_md
428 echo "grompp finished"
429 echo -n "Press <enter>"
437 -----------------------------------------------------------------
438 -----------------------------------------------------------------
439 Now we can start the MD simualtion. Watch the number of steps
440 increasing ( the total number of steps is 2500, for 5 ps ).
442 -----------------------------------------------------------------
443 -----------------------------------------------------------------
446 if ( $?DISPLAY ) then
447 echo "The output of the mdrun program should appear"
448 echo "in a separate xterm window"
451 echo -n "Press <enter>"
454 echo "starting mdrun..."
455 if ( $?DISPLAY ) then
456 xterm -title mdrun -sb -e tail +0f output.mdrun_md &
458 mdrun -nice 4 -s ${MOL}_md -o ${MOL}_md -c ${MOL}_after_md -v >& ! output.mdrun_md
460 echo "mdrun finished"
461 echo -n "Press <enter>"
469 -----------------------------------------------------------------
470 -----------------------------------------------------------------
471 We are finished simulating, and we are going to view the calculated
472 trajectory. The trajectory file ( .trj extension ) contains all
473 coordinates, velocities and forces of all the atoms in our system.
475 The next program we are going run is ngmx. ngmx is a very simple
478 Once the ngmx program has been started you need to click on a few
479 buttons to view your trajectory.
481 1. Once the program has been started a dialog box shows up. Click on
482 the box on the left of the word Protein. ( This means that we want to
483 view the peptide ). Then Click on the OK Button
485 2. Now we see the edges of the box with a lines drawing of the peptide
488 3. Select Animation in the Display menu. If you did this correctly. A
489 dialog box at the bottom of the screen appears. This dialog box is
490 used to move through your trajectory.
492 4. Click on the FastForward button (two triangles pointing to the
493 right) and watch the peptide moving.
494 -----------------------------------------------------------------
495 -----------------------------------------------------------------
498 if ( $?DISPLAY ) then
499 echo Starting Trajectory viewer...
500 ngmx -f ${MOL}_md -s ${MOL}_md &