Gromacs gmxdemo
这是Gromacs的第一个demo。
目录 |
1 第一步 介绍
Welcome to the GROMACS demo.
This is a script that takes about 10 min to run.
In this demo we will demonstrate how to simulate Molecular Dynamics (MD) using the GROMACS software package.
The demo will perform a complete molecular dynamics (MD) simulation of a small peptide in water. The only input file we need to do this is a pdb file of a small peptide.
If you have any problems or remarks with respect to this demonstration, please mail to: gromacs@gromacs.org , or check the resources on our website http://www.gromacs.org .
本示例程序将要说明怎么使用Gromacs去进行分子动力学模拟,它将演示一个小的肽分子在水中全部的分子动态模拟过程。在这个过程中,输入文件只有一个包含小的肽分子的信息的pdb文件。
2 第二步 保证可执行程序路径的正确
Before we you can actually start the GROMACS demo, the programs must be present in your PATH. This might already be the case if they are linked to /usr/local/bin. If not, follow the instructions in the getting started section. If GROMACS is not installed properly on your computer, contact your system manager.
要保证gromacs的可执行程序在路径之内,如果您使用的是发行版直接安装的gromacs,那么它们应该在路径里面了,可以试一试,gromapp是否可以运行。
3 第三步 生成模拟所需的top和gro文件
Before we can start any simulation we need a molecular toplogy file. This topology file ( .top extension ) is generated by the program pdb2gmx. The only input file of the pdb2gmx program is the pdb file of our peptide ( .pdb extension ).
Because most pdb files do not contain all hydrogen atoms, the pdb2gmx program will also add them to our peptide. The output file which contains the structure of the peptide when hydrogen atoms are added is a gromos structure file ( .gro extension )
在开始模拟之前,我们需要一个分子的拓扑文件(.top),这个文件由 pdb2gmx 程序生成,程序的输入文件仅是一个包含需要模拟的分子的 pdb 文件。
因为大多数的 pdb 文件都不包含氢原子,因此 pdb2gmx 程序会帮助我们将氢原子添加到肽分子里面;当氢原子被添加后,pdb2gmx的输出文件将会是 gromacs 结构文件(.gro)。
执行:pdb2gmx output.pdb2gmx
输入文件:cpeptide.pdb
输出文件:cpeptide.top cpeptide.gro output.pdb2gmx posre.itp
4 第四步 将肽分子添加到水盒里面
Because a simulation of a peptide in vacua is a bit unrealistic, we have to solvate our peptide in a box of water. genbox is the program we use to do this.
The genbox program reads the peptide structure file and an input file containing the sizes of the desired water box. The output of genbox is a gromacs structure file of a peptide solvated in a box of water. The genbox program also changes the topology file ( .top extension ) to include water. First we will use the program editconf to define the right box size for our system.
因为在真空中对一个肽分子进行模拟有一点不现实,因此,我们只能将肽分子放到一个盛有水的例子盒子里面。genbox 程序的作用就是这个。
genbox 程序读取肽的结构文件(.pdb)和一个包含理想水盒子尺寸的输入文件;程序的输出文件是一个 gromacs 的结构文件,该文件描述了在水盒中肽分子的信息;程序同时修改拓扑文件,使其包含水的信息。
首先,我们先要使用 editconf 程序去定义一个适合我们系统的一定尺寸的盒子。
执行:
editconf genbox output.genbox
输入文件:cpeptide.pdb
输出文件:cpeptide_b4em.gro #cpeptide.gro.1# #cpeptide.top.1# output.genbox
5 第五步 能量最小化前的预处理
In principle we can start a Molecular Dynamics simulation now. However it is not very wise to do so, because our system is full of close contacts. These close contacts are mainly a result of the genbox program. The added solvent might have some close contacts with the peptide resulting in very high repulsive energies. If we would start a Molecular Dynamics (MD) simulation without energy minimisation the system would not be stable because of these high energies.
The standard procedure to remove these close contacts is Energy Minimisation (EM). Energy minimisation slightly changes the coordinates of our system to remove high energies from our system.
Before we can start the Energy Minimisation we have to preprocess all the input files with the GROMACS preprocessor named grompp. grompp preprocesses the topology file (.top), the structure file (.gro) and a parameter file (.mdp) resulting in a binary topology file (.tpr extension). This binary topology file contains all information for a simulation (in this case an energy minimisation).
原则上我们已经开始进行模拟了。然而这么做并不明智,因为现在我们的系统里充满了 close contacts。这些 close contacts 主是是由于 genbox 程序执行的结果。添加进行的溶剂可能和肽分子有很多的 close contacts,这会造成体系内有很高的起排斥作用的能量。如果我们现在就开始进行模拟而不进行能量最小化的话,体系可能会因为这些较高的能量而变得不稳定。
去除这些 close contacts 的标准程序是 Energy Minimisation(EM)(能量最小化),EM 能稍微改变体系中分子原子的坐标值以去除这些高能量。
在开始 EM 以前,我们必须使用Gromacs的预处理程序 grompp 来预处理所有的输入文件。该程序预处理拓扑文件(.top),结构文件(.gro)和参数文件(.mdp),生成一个二进制的拓扑文件(.tpr)。这个二进制的拓扑文件(.tpr)包含一个模拟所需要的所有信息(在这种情况下是一个能量最小化过程)。
执行:grompp
输入文件:
输出文件:mdout.mdp cpeptide_em.tpr em.mdp output.grompp_em
6 第六步 能量最小化
Now the binary topology file is generated, we can start the energy minimisation (EM). The program which performs the EM is called mdrun. In fact all simulations are performed by the same program: mdrun.
As the Energy Minimisation is running, watch the output of the program. The first number ( from left to right ) is the number of the iteration step. The second number is the step size, which gives an indication of the change in the system. The third number is the potential energy of the system. This number starts at a high value and rapidly drops down, and converges, to a large negative value.
现在拓扑文件已经生成了,我们可以开始进行能量最小化(EM)了。执行能量最小化的程序叫做 mdrun。实际上,所有的模拟都是 mdrun 来执行的。
当能量最小化在运行的时候,查看程序的输出:第一个数字(从左到右)是重复的步骤数;第二个数字是每步的尺寸,它提供了体系变化的指标;第三个数字是体系的势能,这个数字开始的时候值很高,然后急速下降,之后汇于一点,然后变为一个很大的负数。
执行:mdrun output.mdrun_em
输入文件:
输出文件:
7 第七步 生成二进制的拓扑文件
Once all close contacts are removed from the system, we want to do molecular dynamics of the water molecules, and keep the peptide fixed. This is called position restrained (PR) MD.
Position Restrained MD keeps the peptide fixed and lets all water molecules equilibrate around the peptide in order to fill holes etc. which were not filled by the genbox program.
We are first going to preprocess the input files to generate the binary topology. The input files are the topology file, the structure file ( output of the EM ) a paremeter file, and an index file.
By default our system is split into several groups. In this case we use two of those groups: Protein and SOL(vent). We use these groups to put position restraints on all the atoms of the peptide.
The parameter file ( .mdp extension ) contains all information about the PR-MD like: step size, number of steps, temperature, etc. This Paramter file also tells GROMACS what kind of simulation should be performed ( like EM, PR-MD and MD etc. )
一旦所有的 close contacts 从体系里移除,我们希望开始进行水分子的动态模拟,并固定肽分子,这个过程叫做 position restrained(PR) MD.
Position Restrained MD 固定肽分子并且使肽分子周围的水分子平衡以 fill holes 等等。
我们首先去预处理一些输入文件来生成一个二进制的拓扑文件,这些输入文件分别是:拓扑文件(.top),结构文件(由 EM 生成),参数文件(.mdp),和一个索引文件。
我们的体系默认分为几个组,在现在这个情况下我们使用两个组:蛋白质和溶胶(SOL(vent))。我们使用这些组来在所有的肽原子上放置 position restraints。
参数文件(.mdp)包含关于 PR-MD 的所有信息,例如:每步的尺寸,步数,温度等等;这个参数文件告诉Gromacs应该进行什么样的模拟(像 EM, PR-MD 和 MD 等等)。
执行:grompp
输入文件:
输出文件:#mdout.mdp.1# cpeptide_pr.tpr ener.edr pr.mdp md.log output.grompp_pr output.mdrun_em
8 第八步 PR-MD
Now we start the Position restrained Molecular Dynamics simulation. It is important to note that in this example the simulated time is too short (1 ps) to equilibrate our system completely, but that would simple take too much time. ( about one day ).
现在我们开始 PR-MD。我们需要在此特别提醒的是在这个例子里,完全平衡我们的体系的模拟的时间太短(1 ps),但是以后我们的模拟会花费很长的时间(大约一天)。
执行:mdrun output.mdrun_pr
输入文件:
输出文件:output.mdrun_pr cpeptide_b4pr.gro cpeptide_pr.trr #ener.edr.1# state.cpt #md.log.1#
9 第九步 再次生成二进制拓扑文件
Now our complete system is finally ready for the actual Molecular Dynamics simulation. We start again by preprocessing the input files by the grompp program to generate the binary topology file (.tpb/.tpr extension).
现在我们的整个系统终于准备好实际的分子动力学模拟了。我们再次使用 grompp 程序对输入文件进行预处理以生成二进制的拓扑文件(.tpb/.tpr)。
执行:grompp
输入文件:
输出文件:cpeptide_md.tpr #mdout.mdp.2# output.grompp_md #cpeptide.gro.1#
10 第十步 实际模拟
Now we can start the MD simualtion. Watch the number of steps increasing ( the total number of steps is 2500, for 5 ps ).
现在我们开始实际的分子动力学模拟。请查看步数的增加(总的步数为2500,每步为5 ps)。
执行:mdrun output.mdrun_md
输入文件:
输出文件:cpeptide_after_md.gro #ener.edr.2# #md.log.2# state_prev.cpt
11 第十一步 结束并查看轨迹
We are finished simulating, and we are going to view the calculated trajectory. The trajectory file ( .trj extension ) contains all coordinates, velocities and forces of all the atoms in our system.
The next program we are going run is ngmx. ngmx is a very simple trajectory viewer.
Once the ngmx program has been started you need to click on a few buttons to view your trajectory.
1. Once the program has been started a dialog box shows up. Click on the box on the left of the word Protein. ( This means that we want to view the peptide ). Then Click on the OK Button
2. Now we see the edges of the box with a lines drawing of the peptide we just simulated.
3. Select Animation in the Display menu. If you did this correctly. A dialog box at the bottom of the screen appears. This dialog box is used to move through your trajectory.
4. Click on the FastForward button (two triangles pointing to the right) and watch the peptide moving.
我们已经完成了模拟,现在我们可以查看计算出来的轨道了。轨道文件(.trj)包含体系内所有原子的坐标、速度和力。
下一个我们要执行的程序是 ngmx,它是一个简单的轨道查看工具。
ngmx 程序开始运行后,你需要点击一些按钮去查看轨道。
1. 程序开始的时候,一个复选对话框,点击Protein左边的复选框(表示我们将要查看蛋白质),然后点击OK按钮。
2. 现在我们看到盒子的边缘有一条描述我们刚刚模拟过的蛋白质的线。
3. 在Display菜单下选择 Animation,如果你操作的正确的话,在屏幕底部的对话框就会出现。这个对话框用来 操作(穿过)轨道。
4. 点击前进的按钮(有两个向右箭头的按钮),查看蛋白质的运动。
12 参见
- Gromacs tutor