6c4d9922e2d1190188e4a633bb61a7d126857c4e
[alexxy/gromacs.git] / manual / topology.tex
1 %
2 % This file is part of the GROMACS molecular simulation package.
3 %
4 % Copyright (c) 2013,2014, by the GROMACS development team, led by
5 % Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 % and including many others, as listed in the AUTHORS file in the
7 % top-level source directory and at http://www.gromacs.org.
8 %
9 % GROMACS is free software; you can redistribute it and/or
10 % modify it under the terms of the GNU Lesser General Public License
11 % as published by the Free Software Foundation; either version 2.1
12 % of the License, or (at your option) any later version.
13 %
14 % GROMACS is distributed in the hope that it will be useful,
15 % but WITHOUT ANY WARRANTY; without even the implied warranty of
16 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 % Lesser General Public License for more details.
18 %
19 % You should have received a copy of the GNU Lesser General Public
20 % License along with GROMACS; if not, see
21 % http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 % Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23 %
24 % If you want to redistribute modifications to GROMACS, please
25 % consider that scientific software is very special. Version
26 % control is crucial - bugs must be traceable. We will be happy to
27 % consider code for inclusion in the official distribution, but
28 % derived work must not be called official GROMACS. Details are found
29 % in the README & COPYING files - if they are missing, get the
30 % official version at http://www.gromacs.org.
31 %
32 % To help us fund GROMACS development, we humbly ask that you cite
33 % the research papers on the package. Check out http://www.gromacs.org.
34
35 \chapter{Topologies}
36 \label{ch:top}
37 \section{Introduction}
38 {\gromacs} must know on which atoms and combinations of atoms the
39 various contributions to the potential functions (see
40 \chref{ff}) must act. It must
41 also know what \normindex{parameter}s must be applied to the various
42 functions. All this is described in the {\em \normindex{topology}} file
43 {\tt *.top}, which lists the {\em constant attributes} of each atom.
44 There are many more atom types than elements, but only atom types
45 present in biological systems are parameterized in the force field,
46 plus some metals, ions and silicon. The bonded and special
47 interactions are determined by fixed lists that are included in the
48 topology file. Certain non-bonded interactions must be excluded (first
49 and second neighbors), as these are already treated in bonded
50 interactions.  In addition, there are {\em dynamic attributes} of
51 atoms - their positions, velocities and forces. These do not
52 strictly belong to the molecular topology, and are stored in the
53 coordinate file {\tt *.gro} (positions and velocities), or trajectory
54 file {\tt *.trr} (positions, velocities, forces).
55
56 This chapter describes the setup of the topology file, the
57 {\tt *.top} file and the database files: what the parameters
58 stand for and how/where to change them if needed.
59 First, all file formats are explained.
60 Section \ssecref{fffiles} describes the organization of
61 the files in each force field.
62
63 {\bf Note:} if you construct your own topologies, we encourage you
64 to upload them to our topology archive at {\wwwpage}! Just imagine
65 how thankful you'd have been if your topology had been available
66 there before you started. The same goes for new force fields or
67 modified versions of the standard force fields - contribute them
68 to the force field archive!
69
70 \section{Particle type}
71 \label{sec:parttype}
72
73 In {\gromacs}, there are three types of \normindex{particle}s, see
74 \tabref{ptype}. Only regular atoms and virtual interaction sites are used
75 in {\gromacs}; shells are necessary for
76 polarizable models like the Shell-Water models~\cite{Maaren2001a}.
77
78 \begin{table}
79 \centerline{
80 \begin{tabular}{|l|c|}
81 \dline
82 Particle                        & Symbol        \\
83 \hline
84 \seeindex{atom}{particle}s      & A   \\
85 \seeindex{shell}{particle}s     & S   \\
86 \normindex{virtual interaction sites}   & V (or D)   \\
87 \dline
88 \end{tabular}
89 }
90 \caption{Particle types in {\gromacs}}
91 \label{tab:ptype}
92 \end{table}
93
94 \subsection{Atom types}
95 \label{subsec:atomtype}
96
97 Each force field defines a set of \swapindex{atom}{type}s,
98 which have a characteristic name or number, and mass (in
99 a.m.u.). These listings are found in the {\tt atomtypes.atp}
100 file (.atp = {\bf a}tom {\bf t}ype {\bf p}arameter file).
101 Therefore, it is in this file that you can begin to change
102 and/or add an atom type. A sample from the deprecated
103 {\tt gmx.ff} force field is listed below.
104
105 {\small
106 \begin{verbatim}
107     O  15.99940 ;     carbonyl oxygen (C=O)
108    OM  15.99940 ;     carboxyl oxygen (CO-)
109    OA  15.99940 ;     hydroxyl oxygen (OH)
110    OW  15.99940 ;     water oxygen
111     N  14.00670 ;     peptide nitrogen (N or NH)
112    NT  14.00670 ;     terminal nitrogen (NH2)
113    NL  14.00670 ;     terminal nitrogen (NH3)
114   NR5  14.00670 ;     aromatic N (5-ring,2 bonds)
115  NR5*  14.00670 ;     aromatic N (5-ring,3 bonds)
116    NP  14.00670 ;     porphyrin nitrogen
117     C  12.01100 ;     bare carbon (peptide,C=O,C-N)
118   CH1  13.01900 ;     aliphatic CH-group
119   CH2  14.02700 ;     aliphatic CH2-group
120   CH3  15.03500 ;     aliphatic CH3-group
121 \end{verbatim}}
122
123 {\bf Note:} {\gromacs} makes use of the atom types as a name, {\em
124 not} as a number (as {\eg} in {\gromos}).
125
126 %Atomic detail is used except for hydrogen atoms bound to (aliphatic)
127 %carbon atoms, which are treated as {\em \swapindex{united}{atom}s}. No
128 %special \normindex{hydrogen-bond} term is included. {\bf Note} that other force field
129 %like OPLS/AA, CHARMM, and AMBER use all atoms.
130
131 %\subsection{Nucleus}
132 %{\em Necessary for \normindex{polarisability}, not implemented yet.}
133 %
134 %\subsection{Shell}
135 %{\em Necessary for polarisability, not implemented yet.}
136 %
137 %\subsection{Bond shell}
138 %{\em Necessary for polarisability, not implemented yet.}
139
140 \subsection{Virtual sites}
141 \label{sec:vsitetop}
142 Some force fields use \normindex{virtual interaction sites}
143 (interaction sites that are constructed from other particle positions)
144 on which certain interactions are located
145 ({\eg} on benzene rings, to reproduce the correct
146 \normindex{quadrupole}). This is described in~\secref{virtual_sites}.
147
148 To make virtual sites in your system, you should include a section
149 {\tt [~virtual_sites?~]} (for backward compatibility the old name
150 {\tt [~dummies?~]} can also be used) in your topology file,
151 where the `{\tt ?}' stands
152 for the number constructing particles for the virtual site. This will be
153 `{\tt 2}' for type 2, `{\tt 3}' for types 3, 3fd, 3fad and 3out and
154 `{\tt 4}' for type 4fdn. The last of these replace an older 4fd type (with the `type' value 1) 
155 that could occasionally be unstable; while it is still supported internally
156 in the code, the old 4fd type should not be used in new input files.
157  The different types are explained
158 in~\secref{virtual_sites}.
159
160 Parameters for type 2 should look like this:
161 {\small
162 \begin{verbatim}
163 [ virtual_sites2 ]
164 ; Site  from        funct  a
165 5       1     2     1      0.7439756
166 \end{verbatim}}
167
168 for type 3 like this:
169 {\small
170 \begin{verbatim}
171 [ virtual_sites3 ]
172 ; Site  from               funct   a          b
173 5       1     2     3      1       0.7439756  0.128012
174 \end{verbatim}}
175
176 for type 3fd like this:
177 {\small
178 \begin{verbatim}
179 [ virtual_sites3 ]
180 ; Site  from               funct   a          d
181 5       1     2     3      2       0.5        -0.105
182 \end{verbatim}}
183
184 for type 3fad like this:
185 {\small
186 \begin{verbatim}
187 [ virtual_sites3 ]
188 ; Site  from               funct   theta      d
189 5       1     2     3      3       120        0.5
190 \end{verbatim}}
191
192 for type 3out like this:
193 {\small
194 \begin{verbatim}
195 [ virtual_sites3 ]
196 ; Site  from               funct   a          b          c
197 5       1     2     3      4       -0.4       -0.4       6.9281
198 \end{verbatim}}
199
200 for type 4fdn like this:
201 {\small
202 \begin{verbatim}
203 [ virtual_sites4 ]
204 ; Site  from                      funct   a          b          c
205 5       1     2     3     4       2       1.0        0.9       0.105
206 \end{verbatim}}
207
208 This will result in the construction of a virtual site, number 5
209 (first column `{\tt Site}'), based on the positions of the atoms
210 whose indices are 1 and 2 or 1, 2 and 3 or 1, 2, 3 and 4 (next two,
211 three or four columns `{\tt from}') following the rules determined by the function number
212 (next column `{\tt funct}') with the parameters specified (last one,
213 two or three columns `{\tt a b} . .'). Obviously, the atom numbers
214 (including virtual site number) depend
215 on the molecule. It may be instructive to study the topologies for
216 TIP4P or TIP5P water models that are included with the {\gromacs} distribution.
217
218 {\bf Note} that if any constant bonded interactions are defined between
219 virtual sites and/or normal atoms, they will be removed by {\tt grompp}
220 (unless the option {tt -normvsbds} is used).
221 This removal of bonded interactions is done after generating exclusions,
222 as the generation of exclusions is based on ``chemically'' bonded interactions.
223
224 Virtual sites can be constructed in a more generic way using basic geometric
225 parameters.  The directive that can be used is {\tt [ virtual_sitesn ]}.  Required
226 parameters are listed in~\tabref{topfile2}.  An example entry for defining a virtual
227 site at the center of geometry of a given set of atoms might be:
228
229 {\small
230 \begin{verbatim}
231 [ virtual_sitesn ]
232 ; Site   funct    from
233 5        1        1     2     3     4
234 \end{verbatim}}
235
236 \section{Parameter files}
237
238 \label{sec:paramfiles}
239
240 \subsection{Atoms}
241 The {\em static} properties (see \tabref{statprop} assigned to the
242 atom types are assigned based on data in several places.
243 The mass is listed in {\tt atomtypes.atp}
244 (see~\ssecref{atomtype}), whereas the charge is listed in {\tt *.rtp}
245 (.rtp = {\bf r}esidue {\bf t}opology {\bf p}arameter file,
246 see~\ssecref{rtp}).  This implies that the charges are only defined in
247 the \normindex{building block}s of amino acids, nucleic acids or
248 otherwise, as defined by the user. When generating a topology
249 ({\tt *.top}) using the {\tt \normindex{pdb2gmx}} program, the
250 information from these files is combined.
251  
252 \begin{table}
253 \centerline{
254 \begin{tabular}{|l|c|c|}
255 \dline
256 Property        & Symbol        & Unit          \\
257 \hline
258 Type            & -             & -             \\
259 Mass            & m             & a.m.u.        \\
260 Charge          & q             & electron      \\
261 epsilon         & $\epsilon$    & kJ/mol        \\
262 sigma           & $\sigma$      & nm            \\
263 \dline
264 \end{tabular}
265 }
266 \caption{Static atom type properties in {\gromacs}}
267 \label{tab:statprop}
268 \end{table}
269
270 %The following {\em dynamic} quantities are associated with an atom
271 %\begin{itemize}
272 %\item   Position {\bf x}
273 %\item   Velocity {\bf v}
274 %\end{itemize}
275 %These quantities are listed in the coordinate file, {\tt *.gro}
276 %(see section~\ssecref{grofile}).
277
278 \subsection{Non-bonded parameters}
279 \label{subsec:nbpar}
280 The \swapindex{non-bonded}{parameter}s consist of the van der Waals 
281 parameters V ({\tt c6} or $\sigma$, depending on the combination rule) and W 
282 ({\tt c12} or $\epsilon$), as listed in the file {\tt ffnonbonded.itp}, where 
283 {\tt ptype} is the particle type (see \tabref{ptype}). As with the bonded parameters, entries in {\tt [~*type~]} directives 
284 are applied to their counterparts in the topology file.  Missing parameters 
285 generate warnings, except as noted below in section~\ssecref{pairinteractions}.
286
287 {\small
288 \begin{verbatim}
289 [ atomtypes ]
290 ;name   at.num      mass      charge   ptype         V(c6)        W(c12)
291     O        8  15.99940       0.000       A   0.22617E-02   0.74158E-06
292    OM        8  15.99940       0.000       A   0.22617E-02   0.74158E-06
293    .....
294
295 [ nonbond_params ]
296   ; i    j func       V(c6)        W(c12)
297     O    O    1 0.22617E-02   0.74158E-06
298     O   OA    1 0.22617E-02   0.13807E-05
299     .....
300 \end{verbatim}}
301
302 {\bf Note} that most of the included force fields also include the {\tt at.num.} column, 
303 but this same information is implied in the OPLS-AA {\tt bond_type} column.
304 The interpretation of the parameters V and W depends on the combination rule 
305 that was chosen in the {\tt [~defaults~]} section of the topology file 
306 (see~\ssecref{topfile}):
307 \begin{eqnarray}
308 \mbox{for combination rule 1}: & &
309 \begin{array}{llllll}
310   \mbox{V}_{ii} & = & C^{(6)}_{i}  & = & 4\,\epsilon_i\sigma_i^{6} &
311   \mbox{[ kJ mol$^{-1}$ nm$^{6}$ ]}\\
312   \mbox{W}_{ii} & = & C^{(12)}_{i} & = & 4\,\epsilon_i\sigma_i^{12} &
313   \mbox{[ kJ mol$^{-1}$ nm$^{12}$ ]}\\
314 \end{array}
315 \\
316 \mbox{for combination rules 2 and 3}: & &
317 \begin{array}{llll}
318   \mbox{V}_{ii} & = & \sigma_i   & \mbox{[ nm ]} \\
319   \mbox{W}_{ii} & = & \epsilon_i & \mbox{[ kJ mol$^{-1}$ ]}
320 \end{array}
321 \end{eqnarray}
322 Some or all combinations for different atom types can be given in the 
323 {\tt [~nonbond_params~]} section, again with parameters V and W as defined 
324 above. Any combination that is not given will be computed from the parameters 
325 for the corresponding atom types, according to the \normindex{combination rule}:
326 \begin{eqnarray}
327 \mbox{for combination rules 1 and 3}: & &
328 \begin{array}{lll}
329   C^{(6)}_{ij}  & = & \left(C^{(6)}_i\,C^{(6)}_j\right)^{\frac{1}{2}} \\
330   C^{(12)}_{ij} & = & \left(C^{(12)}_i\,C^{(12)}_j\right)^{\frac{1}{2}}
331 \end{array}
332 \\
333 \mbox{for combination rule 2}: & &
334 \begin{array}{lll}
335   \sigma_{ij}   & = & \frac{1}{2}(\sigma_i+\sigma_j) \\
336   \epsilon_{ij} & = & \sqrt{\epsilon_i\,\epsilon_j}
337 \end{array}
338 \end{eqnarray}
339 When $\sigma$ and $\epsilon$ need to be supplied (rules 2 and 3),
340 it would seem it is impossible to have a non-zero $C^{12}$ combined
341 with a zero $C^6$ parameter. However, providing a negative $\sigma$
342 will do exactly that, such that $C^6$ is set to zero and $C^{12}$ is
343 calculated normally. This situation represents a special case in reading
344 the value of $\sigma$, and nothing more.
345
346 There is only one set of \normindex{combination rule}s
347 for Buckingham potentials:
348 \beq
349 \begin{array}{rcl}
350 A_{ij}   &=& \left(A_{ii} \, A_{jj}\right)^{1/2}    \\
351 B_{ij}   &=& 2 / \left(\frac{1}{B_{ii}} + \frac{1}{B_{jj}}\right)        \\
352 C_{ij}   &=& \left(C_{ii} \, C_{jj}\right)^{1/2}
353 \end{array}
354 \eeq
355
356 \subsection{Bonded parameters}
357 \label{subsec:bondparam}
358 The \swapindex{bonded}{parameter}s ({\ie} bonds, bond angles, improper and proper
359 dihedrals) are listed in {\tt ffbonded.itp}.~
360 % The term {\tt func} is 1 for
361 % harmonic and 2 for \gromosv{96} bond and angle potentials.
362 % For the dihedral, this is explained after this listing.
363 The entries in this database describe, respectively, the atom types
364 in the interactions, the type of the interaction, and the parameters
365 associated with that interaction. These parameters are then read
366 by {\tt \normindex{grompp}} when processing a topology and applied
367 to the relevant bonded parameters, {\ie} {\tt bondtypes} are applied to
368 entries in the {\tt [~bonds~]} directive, etc. Any bonded parameter that is
369 missing from the relevant {\tt [~*type~]} directive generates a fatal error.
370 The types of interactions are listed in \tabref{topfile2}.
371 Example excerpts from such files follow:
372
373 {\small 
374 \begin{verbatim}
375 [ bondtypes ]
376   ; i    j func        b0          kb
377     C    O    1   0.12300     502080.
378     C   OM    1   0.12500     418400.
379     ......
380
381 [ angletypes ]
382   ; i    j    k func       th0         cth
383    HO   OA    C    1   109.500     397.480
384    HO   OA  CH1    1   109.500     397.480
385    ......
386
387 [ dihedraltypes ]
388   ; i    l func        q0          cq
389  NR5*  NR5    2     0.000     167.360
390  NR5* NR5*    2     0.000     167.360
391  ......
392
393 [ dihedraltypes ]
394   ; j    k func      phi0          cp   mult
395     C   OA    1   180.000      16.736      2
396     C    N    1   180.000      33.472      2
397     ......
398
399 [ dihedraltypes ]
400 ;
401 ; Ryckaert-Bellemans Dihedrals
402 ;
403 ; aj    ak      funct
404 CP2     CP2     3       9.2789  12.156  -13.120 -3.0597 26.240  -31.495
405 \end{verbatim}}
406
407 %Also in this file are the
408 %\normindex{Ryckaert-Bellemans}~\cite{Ryckaert78} parameters for the
409 %CP2-CP2 dihedrals in alkanes or alkane tails with the following
410 %constants:
411
412 %\begin{center}
413 %(kJ/mol)\\
414 %\begin{tabular}{llrllrllr}
415 %$C_0$ & $=$ & $~ 9.28$ & $C_2$ & $=$ & $-13.12$ & $C_4$ & $=$ & $ 26.24$ \\
416 %$C_1$ & $=$ & $ 12.16$ & $C_3$ & $=$ & $~-3.06$ & $C_5$ & $=$ & $-31.5 $ \\
417 %\end{tabular}
418 %\end{center}
419
420 %({\bf Note:} The use of this potential implies the exclusion of LJ interactions
421 %between the first and the last atom of the dihedral, and $\psi$ is defined
422 %according to the ``\swapindex{polymer}{convention}'' ($\psi_{trans}=0$)).
423
424 %So there are three types of dihedrals in the {\gromacs} force field:
425 %\begin{itemize}
426 %\item \swapindex{proper}{dihedral} : funct = 1, with mult = multiplicity, so the
427 %                                   number of possible angles
428 %\item \swapindex{improper}{dihedral} : funct = 2
429 %\item Ryckaert-Bellemans dihedral : funct = 3
430 %\end{itemize}
431
432 In the {\tt ffbonded.itp} file, you can add bonded parameters. If you
433 want to include parameters for new atom types, make sure you define
434 them in {\tt atomtypes.atp} as well.
435
436
437
438 \subsection{Intramolecular pair interactions\index{intramolecular pair interaction}}
439 \label{subsec:pairinteractions}
440 Extra Lennard-Jones and electrostatic interactions between pairs
441 of atoms in a molecule can be added in the {\tt [~pairs~]} section of
442 a molecule definition. The parameters for these interactions can
443 be set independently from the non-bonded interaction parameters.
444 In the {\gromos} force fields, pairs are only used
445 to modify the \normindex{1-4 interaction}s (interactions of atoms
446 separated by three bonds). In these force fields the 1-4 interactions
447 are excluded from the non-bonded interactions (see \secref{excl}).
448
449 {\small
450 \begin{verbatim}
451
452 [ pairtypes ]
453   ; i    j func         cs6          cs12 ; THESE ARE 1-4 INTERACTIONS
454     O    O    1 0.22617E-02   0.74158E-06
455     O   OM    1 0.22617E-02   0.74158E-06
456     .....
457 \end{verbatim}}
458
459 The pair interaction parameters for the atom types
460 in {\tt ffnonbonded.itp} are listed in the {\tt [~pairtypes~]} section.
461 The {\gromos} force fields list all these interaction parameters
462 explicitly, but this section might be empty for force fields like
463 OPLS that calculate the \normindex{1-4 interaction}s by uniformly scaling the parameters.
464 Pair parameters that are not present in the {\tt [~pairtypes~]} section
465 are only generated when {\tt gen-pairs} is set to ``yes'' in the {\tt [~defaults~]}
466 directive of {\tt forcefield.itp} (see \ssecref{topfile}). 
467 When {\tt gen-pairs} is set to ``no,'' {\tt \normindex{grompp}}
468 will give a warning for each pair type for which no parameters are given.
469
470 The normal pair interactions, intended for \normindex{1-4 interaction}s,
471 have function type 1. Function type 2 and the {\tt [~pairs_nb~]} are intended
472 for free-energy simulations. When determining hydration
473 free energies, the solute needs to be decoupled from the solvent.
474 This can be done by adding a B-state topology (see \secref{fecalc})
475 that uses zero for all solute non-bonded parameters, {\ie} charges and LJ parameters.
476 However, the free energy difference between the A and
477 B states is not the total hydration free energy.  One has to
478 add the free energy for reintroducing the internal Coulomb and 
479 LJ interactions in the solute when in vacuum. This second step can be combined with
480 the first step when the Coulomb and LJ interactions within
481 the solute are not modified. For this purpose, there is a pairs
482 function type 2, which is identical to function type 1, except
483 that the B-state parameters are always identical to the A-state
484 parameters. For searching the parameters in the {\tt [~pairtypes~]} section,
485 no distinction is made between function type 1 and 2.
486 The pairs section {\tt [~pairs_nb~]} is intended to replace the non-bonded interaction.
487 It uses the unscaled charges and the non-bonded LJ parameters;
488 it also only uses the A-state parameters. {\bf Note} that
489 one should add exclusions for all atom pairs listed in {\tt [~pairs_nb~]},
490 otherwise such pairs will also end up in the normal neighbor lists.
491
492 Alternatively, this same behavior can be achieved without ever
493 touching the topology, by using the {\tt couple-moltype}, {\tt
494   couple-lambda0}, {\tt couple-lambda1}, and {\tt couple-intramol}
495 keywords.  See sections \secref{fecalc} and \secref{dgimplement} for
496 more information.
497
498 All three pair types always use plain Coulomb interactions,
499 even when Reaction-field, PME, Ewald or shifted Coulomb interactions
500 are selected for the non-bonded interactions.
501 Energies for types 1 and 2 are written to the energy and log file
502 in separate ``LJ-14'' and ``Coulomb-14'' entries per energy group pair.
503 Energies for {\tt [~pairs_nb~]} are added to the ``LJ-(SR)'' and ``Coulomb-(SR)'' terms.
504
505 \subsection{Implicit solvation parameters\index{implicit solvation parameters}}
506 Starting with {\gromacs} 4.5, implicit solvent is supported. A section in the
507 topology has been introduced to list those parameters:
508
509 {\small
510 \begin{verbatim}
511 [ implicit_genborn_params ]
512 ; Atomtype  sar     st   pi      gbr      hct
513 NH1         0.155   1    1.028   0.17063  0.79 ; N
514 N           0.155   1    1       0.155    0.79 ; Proline backbone N
515 H           0.1     1    1       0.115    0.85 ; H
516 CT1         0.180   1    1.276   0.190    0.72 ; C
517 \end{verbatim}}
518
519 In this example the atom type is listed first, followed by five
520 numbers, and a comment (following a semicolon).
521
522 Values in columns 1-3 are not currently used. They pertain to more
523 elaborate surface area algorithms, the one from Qiu {\em et al.}~\cite{Still97} in
524 particular.  Column 4 contains the atomic van der Waals radii, which are used
525 in computing the Born radii. The dielectric offset is specified in
526 the {\tt *.mdp} file, and gets subtracted from the input van der Waals radii for the different
527 Born radii methods, as described by Onufriev {\em et al.}~\cite{Case04}.  Column 5 is the 
528 scale factor for the HCT and OBC models. The values are taken from the Tinker implementation of 
529 the HCT pairwise scaling method~\cite{Truhlar96}.  This method has been modified such that the
530 scaling factors have been adjusted to minimize differences between analytical surface areas and
531 GB using the HCT algorithm.  The scaling is further modified in that it is not applied pairwise
532 as proposed by Hawkins {\em et al.}~\cite{Truhlar96}, but on a per-atom (rather than a per-pair) 
533 basis.
534
535
536
537 \section{Exclusions}
538 \label{sec:excl}
539 The \normindex{exclusions} for non-bonded interactions are generated by {\tt
540 grompp} for neighboring atoms up to a certain number of bonds away, as
541 defined in the {\tt [~moleculetype~]} section in the topology file
542 (see \ssecref{topfile}). Particles are considered bonded when they are
543 connected by ``chemical'' bonds ({\tt [~bonds~]} types 1 to 5, 7 or 8)
544 or constraints ({\tt [~constraints~]} type 1).
545 Type 5 {\tt [~bonds~]} can be used to create a \normindex{connection}
546 between two atoms without creating an interaction.
547 There is a \normindex{harmonic interaction}
548 ({\tt [~bonds~]} type 6) that does not connect the atoms by a chemical bond.
549 There is also a second constraint type ({\tt [~constraints~]} type 2)
550 that fixes the distance, but does not connect
551 the atoms by a chemical bond.
552 For a complete list of all these interactions, see \tabref{topfile2}.
553
554 Extra exclusions within a molecule can be added manually
555 in a {\tt [~exclusions~]} section. Each line should start with one
556 atom index, followed by one or more atom indices. All non-bonded
557 interactions between the first atom and the other atoms will be excluded.
558
559 When all non-bonded interactions within or between groups of atoms need
560 to be excluded, is it more convenient and much more efficient to use
561 energy monitor group exclusions (see \secref{groupconcept}).
562
563 \section{Constraint algorithms\index{constraint algorithms}}
564 \label{sec:constraints}
565 Constraints are defined in the {\tt [~constraints~]} section.
566 The format is two atom numbers followed by the function type,
567 which can be 1 or 2, and the constraint distance.
568 The only difference between the two types is that type 1 is used
569 for generating exclusions and type 2 is not (see \secref{excl}).
570 The distances are constrained using the LINCS or the SHAKE algorithm,
571 which can be selected in the {\tt *.mdp} file.
572 Both types of constraints can be perturbed in free-energy calculations
573 by adding a second constraint distance (see \ssecref{constraintforce}).
574 Several types of bonds and angles (see \tabref{topfile2}) can
575 be converted automatically to constraints by {\tt grompp}.
576 There are several options for this in the {\tt *.mdp} file.
577
578 We have also implemented the \normindex{SETTLE} algorithm~\cite{Miyamoto92},
579 which is an analytical solution of SHAKE, specifically for water. 
580 SETTLE can be selected in the topology file. See, for instance, the
581 SPC molecule definition:
582
583 {\small
584 \begin{verbatim}
585 [ moleculetype ]
586 ; molname       nrexcl
587 SOL             1
588
589 [ atoms ]
590 ; nr    at type res nr  ren nm  at nm   cg nr   charge
591 1       OW      1       SOL     OW1     1       -0.82
592 2       HW      1       SOL     HW2     1        0.41
593 3       HW      1       SOL     HW3     1        0.41
594
595 [ settles ]
596 ; OW    funct   doh     dhh
597 1       1       0.1     0.16333
598
599 [ exclusions ]
600 1       2       3
601 2       1       3
602 3       1       2
603 \end{verbatim}}
604
605 The {\tt [~settles~]} directive defines the first atom of the water molecule.
606 The settle funct is always 1, and the distance between O-H and H-H distances
607 must be given. {\bf Note} that the algorithm can also be used
608 for TIP3P and TIP4P~\cite{Jorgensen83}.
609 TIP3P just has another geometry. TIP4P has a virtual site, but since 
610 that is generated it does not need to be shaken (nor stirred).
611
612 \section{\normindex{pdb2gmx} input files}
613 \label{sec:pdb2gmxfiles}
614 The {\gromacs} program {\tt pdb2gmx} generates a topology for
615 the input coordinate file. Several formats are supported for
616 that coordinate file, but {\tt *.pdb} is the most commonly-used format
617 (hence the name {\tt pdb2gmx}).
618 {\tt pdb2gmx} searches for force fields in sub-directories of the {\gromacs} {\tt share/top}
619 directory and your working directory. Force fields are recognized from
620 the file {\tt forcefield.itp} in a directory with the extension {\tt .ff}.
621 The file {\tt forcefield.doc} may be present, and if so, its first line
622 will be used by {\tt pdb2gmx} to present a short description to the
623 user to help in choosing a force field. Otherwise, the user can
624 choose a force field with the {\tt -ff xxx} command-line argument
625 to {\tt pdb2gmx}, which indicates that a force field in a
626 {\tt xxx.ff} directory is desired. {\tt pdb2gmx} will search first in the
627 working directory, then in the {\gromacs} {\tt share/top} directory, and
628 use the first matching {\tt xxx.ff} directory found.
629
630 Two general files are read by {\tt pdb2gmx}: an atom type file
631 (extension {\tt .atp}, see~\ssecref{atomtype}) from the force field directory,
632 and a file called {\tt residuetypes.dat} from either the working directory, or
633 the {\gromacs} {\tt share/top} directory. {\tt residuetypes.dat}
634 determines which residue names are considered protein, DNA, RNA,
635 water, and ions.
636
637 {\tt pdb2gmx} can read one or multiple databases with topological information
638 for different types of molecules. A set of files belonging to one database
639 should have the same basename, preferably telling something about the type
640 of molecules ({\eg} aminoacids, rna, dna). The possible files are:
641 \begin{itemize}
642 \item {\tt <basename>.rtp}
643 \item {\tt <basename>.r2b} (optional)
644 \item {\tt <basename>.arn} (optional)
645 \item {\tt <basename>.hdb} (optional)
646 \item {\tt <basename>.n.tdb} (optional)
647 \item {\tt <basename>.c.tdb} (optional)
648 \end{itemize}
649 Only the {\tt .rtp} file, which contains the topologies of the building
650 blocks, is mandatory. Information from other files will only be used 
651 for building blocks that come from an {\tt .rtp} file with the same base name.
652 The user can add building blocks to a force field by having additional
653 files with the same base name in their working directory. By default, only
654 extra building blocks can be defined, but calling {\tt pdb2gmx} with
655 the {\tt -rtpo} option will allow building blocks in a local file
656 to replace the default ones in the force field.
657
658
659 \subsection{Residue database}
660 \label{subsec:rtp}
661 The files holding the residue databases have the extension {\tt .rtp}.
662 Originally this file contained building blocks (amino acids) for proteins,
663 and is the {\gromacs} interpretation of the {\tt rt37c4.dat} file of {\gromos}.
664 So the residue database file contains information (bonds, charges, charge groups,
665 and improper dihedrals) for a frequently-used building block. It is
666 better {\em not} to change this file because it is standard input for
667 {\tt pdb2gmx}, but if changes are needed make them in the
668 {\tt *.top} file (see~\ssecref{topfile}), or in a {\tt .rtp} file
669 in the working directory as explained in \secref{pdb2gmxfiles}.
670 Defining topologies of new small molecules is probably easier
671 by writing an include topology file {\tt *.itp} directly.
672 This will be discussed in section~\ssecref{molitp}.
673 When adding a new protein residue to the database, don't forget to
674 add the residue name to the {\tt \normindex{residuetypes.dat}} file,
675 so that {\tt grompp}, {\tt make_ndx} and analysis tools can recognize
676 the residue as a protein residue (see \ssecref{defaultgroups}).
677
678 The {\tt .rtp} files are only used by {\tt pdb2gmx}.
679 As mentioned before, the only extra information this
680 program needs from the {\tt .rtp} database is bonds, charges of atoms,
681 charge groups, and improper dihedrals, because the rest is read from
682 the coordinate input file.
683 Some proteins contain residues that are not standard, but are
684 listed in the coordinate file. You have to construct a building block
685 for this ``strange'' residue, otherwise you will not obtain a
686 {\tt *.top} file. This also holds for molecules in the
687 coordinate file such as ligands, polyatomic ions, crystallization co-solvents, etc.
688 The residue database is constructed in the following way:
689
690 {\small
691 \begin{verbatim}
692 [ bondedtypes ]  ; mandatory
693 ; bonds  angles  dihedrals  impropers
694      1       1          1          2  ; mandatory
695
696 [ GLY ]  ; mandatory
697
698  [ atoms ]  ; mandatory 
699 ; name  type  charge  chargegroup 
700      N     N  -0.280     0
701      H     H   0.280     0
702     CA   CH2   0.000     1
703      C     C   0.380     2
704      O     O  -0.380     2
705
706  [ bonds ]  ; optional
707 ;atom1 atom2      b0      kb
708      N     H
709      N    CA
710     CA     C
711      C     O
712     -C     N
713
714  [ exclusions ]  ; optional
715 ;atom1 atom2
716
717  [ angles ]  ; optional
718 ;atom1 atom2 atom3    th0    cth
719
720  [ dihedrals ]  ; optional
721 ;atom1 atom2 atom3 atom4   phi0     cp   mult
722
723  [ impropers ]  ; optional
724 ;atom1 atom2 atom3 atom4     q0     cq
725      N    -C    CA     H
726     -C   -CA     N    -O
727
728 [ ZN ]
729
730  [ atoms ]
731     ZN    ZN   2.000     0
732 \end{verbatim}}
733
734 The file is free format; the only restriction is that there can be at
735 most one entry on a line.  The first field in the file is the
736 {\tt [~bondedtypes~]} field, which is followed by four numbers,
737 indicating the interaction type for bonds, angles, dihedrals, and
738 improper dihedrals.  The file contains residue entries, which consist
739 of atoms and (optionally) bonds, angles, dihedrals, and impropers.  The
740 charge group codes denote the charge group numbers. Atoms in the same
741 charge group should always be ordered consecutively. When using the
742 hydrogen database with {\tt pdb2gmx} for adding missing hydrogens
743 (see~\ssecref{hdb}), the atom names defined in the {\tt .rtp} entry
744 should correspond exactly to the naming convention used in the
745 hydrogen database. The atom names in the bonded interaction can be
746 preceded by a minus or a plus, indicating that the atom is in the
747 preceding or following residue respectively.  Explicit parameters added
748 to bonds, angles, dihedrals, and impropers override
749 the standard parameters in the {\tt .itp} files.  This should only be
750 used in special cases. Instead of parameters, a string can be added
751 for each bonded interaction.  This is used in \gromosv{96} {\tt .rtp}
752 files. These strings are copied to the topology file and can be
753 replaced by force field parameters by the C-preprocessor in {\tt grompp}
754 using {\tt \#define} statements.
755
756 {\tt pdb2gmx} automatically generates all angles. This means that for the
757 {\tt gmx.ff} force field,
758 the {\tt [~angles~]} field is only useful for overriding {\tt .itp}
759 parameters. For the \gromosv{96} force field the interaction number
760 of all angles need to be specified.
761
762 {\tt pdb2gmx} automatically generates one proper dihedral for every rotatable
763 bond, preferably on heavy atoms. When the {\tt [~dihedrals~]} field is used,
764 no other dihedrals will be generated for the bonds corresponding to the
765 specified  dihedrals. It is possible to put more than one dihedral
766 function on a rotatable bond. 
767
768 {\tt pdb2gmx} sets the number of exclusions to 3, which
769 means that interactions between atoms connected by at most 3 bonds are
770 excluded. Pair interactions are generated for all pairs of atoms that are
771 separated by 3 bonds (except pairs of hydrogens).
772 When more interactions need to be excluded, or some pair interactions should
773 not be generated, an {\tt [~exclusions~]} field can be added, followed by
774 pairs of atom names on separate lines. All non-bonded and pair interactions
775 between these atoms will be excluded.
776
777 \subsection{Residue to building block database}
778 Each force field has its own naming convention for residues.
779 Most residues have consistent naming, but some, especially those
780 with different protonation states, can have many different names.
781 The {\tt .r2b} files are used to convert standard residue names to
782 the force field build block names. If no {\tt .r2b} is present
783 in the force field directory or a residue is not listed, the building
784 block name is assumed to be identical to the residue name.
785 The {\tt .r2b} can contain 2 or 5 columns. The 2-column format
786 has the residue name in the first column and the building block name
787 in the second. The 5-column format has 3 additional columns with
788 the building block for the residue occurring in the N-terminus, C-terminus
789 and both termini at the same time (single residue molecule).
790 This is useful for, for instance, the AMBER force fields.
791 If one or more of the terminal versions are not present, a dash should be entered
792 in the corresponding column.
793
794 There is a {\gromacs} naming convention for residues which is only
795 apparent (except for the {\tt pdb2gmx} code) through the {\tt .r2b} file
796 and {\tt specbond.dat} files.
797 This convention is only of importance when you are adding residue types
798 to an {\tt .rtp} file. The convention is listed in \tabref{r2b}.
799 For special bonds with, for instance, a heme group, the {\gromacs} naming
800 convention is introduced through {\tt specbond.dat} (see~\ssecref{specbond}), which can
801 subsequently be translated by the {\tt .r2b} file, if required.
802
803 \begin{table}
804 \centerline{
805 \begin{tabular}{|ll|}
806 \dline
807 ARG  & protonated arginine \\
808 ARGN & neutral arginine \\
809 ASP  & negatively charged aspartic acid \\
810 ASPH & neutral aspartic acid \\
811 CYS  & neutral cysteine \\
812 CYS2 & cysteine with sulfur bound to another cysteine or a heme \\
813 GLU  & negatively charged glutamic acid \\
814 GLUH & neutral glutamic acid \\
815 HISD & neutral histidine with N$_\delta$ protonated \\
816 HISE & neutral histidine with N$_\epsilon$ protonated \\
817 HISH & positive histidine with both N$_\delta$ and N$_\epsilon$ protonated \\
818 HIS1 & histidine bound to a heme \\
819 LYSN & neutral lysine \\
820 LYS  & protonated lysine \\
821 HEME & heme \\
822 \dline
823 \end{tabular}
824 }
825 \caption{Internal {\gromacs} residue naming convention.}
826 \label{tab:r2b}
827 \end{table}
828
829 \subsection{Atom renaming database}
830 Force fields often use atom names that do not follow IUPAC or PDB convention.
831 The {\tt .arn} database is used to translate the atom names in the coordinate
832 file to the force field names. Atoms that are not listed keep their names.
833 The file has three columns: the building block name,
834 the old atom name, and the new atom name, respectively. The residue name
835 supports question-mark wildcards that match a single character.
836
837 An additional general atom renaming file called {\tt xlateat.dat} is present
838 in the {\tt share/top} directory, which translates common non-standard
839 atom names in the coordinate file to IUPAC/PDB convention. Thus, when writing
840 force field files, you can assume standard atom names and no further
841 atom name translation is required, except for translating from standard atom names
842 to the force field ones.
843
844 \subsection{Hydrogen database}
845 \label{subsec:hdb}
846 The \swapindex{hydrogen}{database} is stored in {\tt .hdb} files. It
847 contains information for the {\tt pdb2gmx} program on how to connect
848 hydrogen atoms to existing atoms. In versions of the database before
849 {\gromacs} 3.3, hydrogen atoms were named after the atom they are
850 connected to: the first letter of the atom name was replaced by an
851 `H.' In the versions from 3.3 onwards, the H atom has to be listed explicitly,
852 because the old behavior was protein-specific and hence could not
853 be generalized to other molecules.
854 If more than one hydrogen atom is connected to the same atom, a
855 number will be added to the end of the hydrogen atom name. For
856 example, adding two hydrogen atoms to \texttt{ND2} (in asparagine), the
857 hydrogen atoms will be named \texttt{HD21} and \texttt{HD22}. This is
858 important since atom naming in the \texttt{.rtp} file (see~\ssecref{rtp})
859 must be the same. The format of the hydrogen database is as follows:
860
861 {\small
862 \begin{verbatim}
863 ; res   # additions
864         # H add type    H       i       j       k
865 ALA     1
866         1       1       H       N       -C      CA
867 ARG     4
868         1       2       H       N       CA      C
869         1       1       HE      NE      CD      CZ
870         2       3       HH1     NH1     CZ      NE
871         2       3       HH2     NH2     CZ      NE
872 \end{verbatim}}
873
874 On the first line we see the residue name (ALA or ARG) and the number
875 of kinds of hydrogen atoms that may be added to this residue by the
876 hydrogen database. After that follows one line for each addition, on which
877 we see:
878 \begin{itemize}
879 \item The number of H atoms added
880 \item The method for adding H atoms, which can be any of:
881 \begin{enumerate}
882 \item[1]{\em one planar hydrogen, {\eg} rings or peptide bond}\\
883 One hydrogen atom (n) is generated, lying in the plane of atoms
884 (i,j,k) on the plane bisecting angle (j-i-k) at a distance of 0.1 nm
885 from atom i, such that the angles (n-i-j) and (n-i-k) are $>$ 90$^{\rm o}$.
886
887 \item[2]{\em one single hydrogen, {\eg} hydroxyl}\\
888 One hydrogen atom (n) is generated at a distance of 0.1 nm from atom
889 i, such that angle (n-i-j)=109.5 degrees and dihedral (n-i-j-k)=trans.
890
891 \item[3]{\em two planar hydrogens, {\eg} ethylene -C=CH{$_2$}, or amide -C(=O)NH{$_2$}}\\
892 Two hydrogens (n1,n2) are generated at a distance of 0.1 nm from atom
893 i, such that angle (n1-i-j)=(n2-i-j)=120 degrees and dihedral
894 (n1-i-j-k)=cis and (n2-i-j-k)=trans, such that names are according to
895 IUPAC standards~\cite{iupac70}.
896
897 \item[4]{\em two or three tetrahedral hydrogens, {\eg} -CH{$_3$}}\\
898 Three (n1,n2,n3) or two (n1,n2) hydrogens are generated at a distance
899 of 0.1 nm from atom i, such that angle
900 (n1-i-j)=(n2-i-j)=(n3-i-j)=109.47$^{\rm o}$, dihedral (n1-i-j-k)=trans,
901 (n2-i-j-k)=trans+120 and (n3-i-j-k)=trans+240$^{\rm o}$.
902
903 \item[5]{\em one tetrahedral hydrogen, {\eg} C{$_3$}CH}\\
904 One hydrogen atom (n$^\prime$) is generated at a distance of 0.1 nm from atom
905 i in tetrahedral conformation such that angle
906 (n$^\prime$-i-j)=(n$^\prime$-i-k)=(n$^\prime$-i-l)=109.47$^{\rm o}$.
907
908 \item[6]{\em two tetrahedral hydrogens, {\eg} C-CH{$_2$}-C}\\
909 Two hydrogen atoms (n1,n2) are generated at a distance of 0.1 nm from
910 atom i in tetrahedral conformation on the plane bisecting angle j-i-k
911 with angle (n1-i-n2)=(n1-i-j)=(n1-i-k)=109.47$^{\rm o}$.
912
913 \item[7]{\em two water hydrogens}\\
914 Two hydrogens are generated around atom i according to
915 SPC~\cite{Berendsen81} water geometry. The symmetry axis will
916 alternate between three coordinate axes in both directions.
917
918 \item[10]{\em three water ``hydrogens''}\\
919 Two hydrogens are generated around atom i according to
920 SPC~\cite{Berendsen81} water geometry. The symmetry axis will
921 alternate between three coordinate axes in both directions. In addition,
922 an extra particle is generated on the position of the oxygen with
923 the first letter of the name replaced by `M'. This is for
924 use with four-atom water models such as TIP4P~\cite{Jorgensen83}.
925
926 \item[11]{\em four water ``hydrogens''}\\
927 Same as above, except that two additional
928 particles are generated on the position of the oxygen, with names
929 `LP1' and `LP2.' This is for
930 use with five-atom water models such as TIP5P~\cite{Mahoney2000a}.
931 \end{enumerate}
932
933 \item
934 The name of the new H atom (or its prefix, {\eg} {\tt HD2} for
935 the asparagine example given earlier).
936
937 \item
938 Three or four control atoms (i,j,k,l), where the first always is the
939 atom to which the H atoms are connected. The other two or three depend
940 on the code selected. For water, there is only one control atom.
941 \end{itemize}
942
943 Some more exotic cases can be approximately constructed from the above tools,
944 and with suitable use of energy minimization are good enough for beginning
945 MD simulations. For example secondary amine hydrogen, nitrenyl hydrogen
946 (C\nolinebreak[4]=\nolinebreak[4]NH) and even ethynyl hydrogen could be
947 approximately constructed using method 2 above for hydroxyl hydrogen.
948
949 \subsection{Termini database}
950 \label{subsec:tdb}
951 The \swapindex{termini}{database}s are stored in {\tt aminoacids.n.tdb} and
952 {\tt aminoacids.c.tdb} for the N- and C-termini respectively. They contain
953 information for the {\tt pdb2gmx} program on how to connect new atoms
954 to existing ones, which atoms should be removed or changed, and which
955 bonded interactions should be added. The format of the is as follows
956 (from {\tt gmx.ff/aminoacids.c.tdb}):
957
958 {\small
959 \begin{verbatim}
960 [ COO- ]
961
962 [ replace ]
963 C       C       C       12.011  0.27
964
965 [ add ]
966 2       8       O       C       CA      N
967         OM      15.9994 -0.635
968
969 [ delete ]
970 O
971
972 [ impropers ]
973 C       O1      O2      CA
974
975 [ None ]
976 \end{verbatim}}
977
978 The file is organized in blocks, each with a header specifying the
979 name of the block. These blocks correspond to different types of
980 termini that can be added to a molecule. In this example {\tt [~COO-~]}
981 is the first block, corresponding to changing the terminal carbon
982 atom into a deprotonated carboxyl group. {\tt [~None~]} is the
983 second terminus type, corresponding to a terminus that leaves
984 the molecule as it is. Block names cannot be any of the following:
985 {\tt replace}, {\tt add}, {\tt delete}, {\tt bonds}, {\tt angles},
986 {\tt dihedrals}, {\tt impropers}.  Doing so would interfere with
987 the parameters of the block, and would probably also be very confusing
988 to human readers.
989
990 For each block the following options are present:
991 \begin{itemize}
992 \item {\tt [~replace~]} \\
993 Replace an existing atom by one with a different atom type, atom name,
994 charge, and/or mass. This entry can be used to replace an atom that is
995 present both in the input coordinates and in the {\tt .rtp} database,
996 but also to only rename an atom in the input coordinates such that
997 it matches the name in the force field. In the latter case, there
998 should also be a corresponding {\tt [~add~]} section present that
999 gives instructions to add the same atom, such that the position in the sequence
1000 and the bonding is known. Such an atom can be present in the input
1001 coordinates and kept, or not present and constructed by {\tt pdb2gmx}.
1002 For each atom to be replaced on line should be
1003 entered with the following fields:
1004 \begin{itemize}
1005 \item name of the atom to be replaced
1006 \item new atom name (optional)
1007 \item new atom type
1008 \item new mass
1009 \item new charge
1010 \end{itemize}
1011 \item {\tt [~add~]} \\
1012 Add new atoms. For each (group of) added atom(s), a two-line entry is
1013 necessary. The first line contains the same fields as an entry in the
1014 hydrogen database (name of the new atom, 
1015 number of atoms, type of addition, control atoms,
1016 see~\ssecref{hdb}), but the possible types of addition are extended
1017 by two more, specifically for C-terminal additions:
1018 \begin{enumerate}
1019 \item[8]{\em two carboxyl oxygens, -COO{$^-$}}\\
1020 Two oxygens (n1,n2) are generated according to rule 3, at a distance
1021 of 0.136 nm from atom i and an angle (n1-i-j)=(n2-i-j)=117 degrees
1022 \item[9]{\em carboxyl oxygens and hydrogen, -COOH}\\
1023 Two oxygens (n1,n2) are generated according to rule 3, at distances of
1024 0.123 nm and 0.125 nm from atom i for n1 and n2, respectively, and angles
1025 (n1-i-j)=121 and (n2-i-j)=115 degrees. One hydrogen (n$^\prime$) is generated
1026 around n2 according to rule 2, where n-i-j and n-i-j-k should be read
1027 as n$^\prime$-n2-i and n$^\prime$-n2-i-j, respectively.
1028 \end{enumerate}
1029 After this line, another line follows that specifies the details of
1030 the added atom(s), in the same way as for replacing atoms, {\ie}: 
1031 \begin{itemize}
1032 \item atom type
1033 \item mass
1034 \item charge
1035 \item charge group (optional)
1036 \end{itemize}
1037 Like in the hydrogen database (see~\ssecref{rtp}), when more than
1038 one atom is connected to an existing one, a number will be appended to
1039 the end of the atom name. {\bf Note} that, like in the hydrogen database, the
1040 atom name is now on the same line as the control atoms, whereas it was
1041 at the beginning of the second line prior to {\gromacs} version 3.3.
1042 When the charge group field is left out, the added atom will have
1043 the same charge group number as the atom that it is bonded to.
1044 \item {\tt [~delete~]}\\
1045 Delete existing atoms. One atom name per line.
1046 \item {\tt [~bonds~]}, {\tt [~angles~]}, {\tt [~dihedrals~]} and {\tt [~impropers~]}\\
1047 Add additional bonded parameters. The format is identical to that used
1048 in the {\tt *.rtp} file, see~\ssecref{rtp}.
1049 \end{itemize}
1050
1051 \subsection{Virtual site database}
1052 Since we cannot rely on the positions of hydrogens in input files, we need a special
1053 input file to decide the geometries and parameters with which to add virtual site
1054 hydrogens. For more complex virtual site constructs ({\eg} when entire aromatic side chains
1055 are made rigid) we also need information about the equilibrium bond lengths and angles
1056 for all atoms in the side chain. This information is specified in the {\tt .vsd} file for each force 
1057 field. Just as for the termini, there is one such file for each class of residues in 
1058 the {\tt .rtp} file. 
1059
1060 The virtual site database is not really a very simple list of information. The first couple of sections
1061 specify which mass centers (typically called MCH$_3$/MNH$_3$) to use for CH$_3$, NH$_3$, 
1062 and NH$_2$ groups. Depending on the 
1063 equilibrium bond lengths and angles between the hydrogens and heavy atoms we need to apply
1064 slightly different constraint distances between these mass centers. {\bf Note} that we do {\em not} have to
1065 specify the actual parameters (that is automatic), just the type of mass center to use. To accomplish this,
1066 there are three sections names \verb+[ CH3 ]+, \verb+[ NH3 ]+, and \verb+[ NH2 ]+. For each of these we
1067 expect three columns. The first column is the atom type bound to the 2/3 hydrogens, the second column
1068 is the next heavy atom type which this is bound, and the third column the type of mass center to use.
1069 As a special case, in the  \verb+[ NH2 ]+ section it is also possible to specify \verb+planar+ in the second
1070 column, which will use a different construction without mass center. There are currently different opinions
1071 in some force fields whether an NH$_2$ group should be planar or not, but we try hard to stick to the
1072 default equilibrium parameters of the force field.
1073
1074 The second part of the virtual site database contains explicit equilibrium bond lengths and angles
1075 for pairs/triplets of atoms in aromatic side chains. These entries are currently read by specific routines
1076 in the virtual site generation code, so if you would like to extend it {\eg} to nucleic acids you would also
1077 need to write new code there. These sections are named after the short amino acid names
1078 (\verb+[ PHE ]+, \verb+[ TYR ]+, \verb+[ TRP ]+, \verb+[ HID ]+, \verb+[ HIE ]+, \verb+[ HIP ]+), and simply
1079 contain 2 or 3 columns with atom names, followed by a number specifying the bond length (in nm) or angle
1080 (in degrees). {\bf Note} that these are approximations of the equilibrated geometry for the entire molecule, 
1081 which might not be identical to the equilibrium value for a single bond/angle if the molecule is strained.
1082
1083 \subsection{Special bonds}
1084 \label{subsec:specbond}
1085 The primary mechanism used by {\tt \normindex{pdb2gmx}} to generate
1086 inter-residue bonds relies on head-to-tail linking of backbone atoms
1087 in different residues to build a macromolecule. In some cases ({\eg}
1088 \normindex{disulfide bonds}, a \normindex{heme group},
1089 \normindex{branched polymers}), it is necessary to create
1090 inter-residue bonds that do not lie on the backbone. The file {\tt
1091   \normindex{specbond.dat}} takes care of this function. It is
1092 necessary that the residues belong to the same {\tt [~moleculetype~]}.
1093 The {\tt -merge} and {\tt -chainsep} functions of {\tt pdb2gmx} can be
1094 useful when managing special inter-residue bonds between different
1095 chains.
1096
1097 The first line of {\tt specbond.dat} indicates the number of entries that are in the file. If you
1098 add a new entry, be sure to increment this number. The remaining lines in the file provide the
1099 specifications for creating bonds. The format of the lines is as follows:
1100
1101 {\tt resA  atomA  nbondsA  resB  atomB  nbondsB  length  newresA  newresB }
1102
1103 The columns indicate:
1104 \begin{enumerate}
1105 \item {\tt resA} The name of residue A that participates in the bond.
1106 \item {\tt atomA} The name of the atom in residue A that forms the bond.
1107 \item {\tt nbondsA} The total number of bonds {\tt atomA} can form.
1108 \item {\tt resB} The name of residue B that participates in the bond.
1109 \item {\tt atomB} The name of the atom in residue B that forms the bond.
1110 \item {\tt nbondsB} The total number of bonds {\tt atomB} can form.
1111 \item {\tt length} The reference length for the bond. If {\tt atomA} and {\tt atomB} are not within
1112 {\tt length} $\pm$ 10\% in the coordinate file supplied to {\tt pdb2gmx}, no bond will be formed.
1113 \item {\tt newresA} The new name of residue A, if necessary. Some force fields use {\eg} CYS2 for 
1114 a cysteine in a disulfide or heme linkage.
1115 \item {\tt newresB} The new name of residue B, likewise.
1116 \end{enumerate}
1117
1118
1119 \section{File formats}
1120 \subsection{Topology file\swapindexquiet{topology}{file}}
1121 \label{subsec:topfile}
1122 The topology file is built following the {\gromacs} specification for a
1123 molecular topology.  A {\tt *.top} file can be generated by
1124 {\tt pdb2gmx}.
1125 All possible entries in the topology file are listed in
1126 Tables \ref{tab:topfile1} and \ref{tab:topfile2}.
1127 Also tabulated are: all the units
1128 of the parameters, which interactions can be perturbed for free energy
1129 calculations, which bonded interactions are used by {\tt grompp}
1130 for generating exclusions, and which bonded interactions can be converted
1131 to constraints by {\tt grompp}.
1132
1133 %\renewcommand\floatpagefraction{.2}
1134
1135 \newcommand{\tts}{\tt \small}
1136
1137 % move these figures so they end up on facing pages 
1138 % (first figure on even page)
1139 \newcommand{\kJmol}{kJ~mol$^{-1}$}
1140 \newcommand{\kJmolnm}[1]{\kJmol~nm$^{#1}$}
1141 \newcommand{\kJmolrad}[1]{\kJmol~rad$^{#1}$}
1142 \newcommand{\kJmoldeg}[1]{\kJmol~deg$^{#1}$}
1143
1144 \begin{table}[p]
1145 \centering{
1146 \begin{tabular}{|l|llllc|}
1147 \multicolumn{6}{c}{\bf \large Parameters} \\
1148 \dline
1149 interaction     & directive           & \#  & f. & parameters                           & F. E. \\
1150 type    &                             & at. & tp &                                      &       \\
1151 \dline
1152 {\em mandatory} & {\tts defaults}       & & &   non-bonded function type; & \\
1153                 &                       & & &   combination rule$^{(cr)}$; &\\
1154                 &                       & & &   generate pairs (no/yes); & \\
1155                 &                       & & &   fudge LJ (); fudge QQ () & \\
1156 \hline
1157 {\em mandatory} & {\tts atomtypes}      &   &   & atom type; m (u); q (e); particle type; & \\
1158                 &                       &   &   & V$^{(cr)}$; W$^{(cr)}$ & \\
1159 %\hline
1160                 & {\tts bondtypes}      & \multicolumn{3}{l}{(see \tabref{topfile2}, directive {\tts bonds})}           & \\
1161                 & {\tts pairtypes}      & \multicolumn{3}{l}{(see \tabref{topfile2}, directive {\tts pairs})}           & \\
1162                 & {\tts angletypes}     & \multicolumn{3}{l}{(see \tabref{topfile2}, directive {\tts angles})}          & \\
1163                 & {\tts dihedraltypes}$^{(*)}$ & \multicolumn{3}{l}{(see \tabref{topfile2}, directive {\tts dihedrals})}& \\
1164                 & {\tts constrainttypes}& \multicolumn{3}{l}{(see \tabref{topfile2}, directive {\tts constraints})}     & \\
1165 LJ              & {\tts nonbond_params} & 2 & 1 & $V^{(cr)}$; $W^{(cr)}$ & \\
1166 Buckingham      & {\tts nonbond_params} & 2 & 2 & $a$ (\kJmol); $b$ (nm$^{-1})$;  & \\
1167  & & & & $c_6$ (\kJmolnm{6}) & \\
1168 \dline
1169 \multicolumn{6}{c}{~} \\
1170 \multicolumn{6}{c}{\bf \large Molecule definition(s)} \\
1171 \dline
1172 {\em mandatory} & {\tts moleculetype}   & & &   molecule name; $n_{ex}^{(nrexcl)}$  &   \\
1173 \hline
1174 {\em mandatory} & {\tts atoms}          & 1 &   & atom type; residue number;    & type  \\
1175                 &                       &   &   & residue name; atom name;      &       \\
1176                 &                       &   &   & charge group number; $q$ (e); $m$ (u)         & $q,m$ \\
1177 \hline
1178 \multicolumn{6}{|c|}{} \\
1179 \multicolumn{6}{|c|}{intra-molecular interaction and geometry definitions as described
1180 in \tabref{topfile2}} \\
1181 \multicolumn{6}{|c|}{} \\
1182 \dline
1183 \multicolumn{6}{c}{~} \\
1184 \multicolumn{6}{c}{\bf \large System} \\
1185 \dline
1186 {\em mandatory} & {\tts system}         & & &   system name     &       \\
1187 \hline
1188 {\em mandatory} & {\tts molecules}      & & &   \multicolumn{2}{l|}{molecule name; number of molecules} \\
1189 \dline
1190 \multicolumn{6}{c}{~} \\
1191 \multicolumn{6}{l}{`\# at' is the required number of atom type indices for this directive} \\
1192 \multicolumn{6}{l}{`f. tp' is the value used to select this function type} \\
1193 \multicolumn{6}{l}{`F. E.' indicates which of the parameters for this interaction can be} \\
1194 \multicolumn{6}{l}{\phantom{`F. E.'} interpolated during free energy calculations} \\
1195 \multicolumn{6}{l}{~$^{(cr)}$ the combination rule determines the type of LJ parameters, see~\ssecref{nbpar}}\\
1196 \multicolumn{6}{l}{~$^{(*)}$ for {\tts dihedraltypes} one can specify 4 atoms or the inner (outer for improper) 2 atoms}\\
1197 \multicolumn{6}{l}{~$^{(nrexcl)}$ exclude neighbors $n_{ex}$ bonds away for non-bonded interactions}\\
1198 \multicolumn{6}{l}{For free energy calculations, type, $q$ and $m$  or no parameters should be added}\\
1199 \multicolumn{6}{l}{for topology `B' ($\lambda = 1$) on the same line, after the normal parameters.}
1200 \end{tabular}
1201 }
1202 \caption{The topology ({\tts *.top}) file.}
1203 \label{tab:topfile1}
1204 \end{table}
1205
1206 \newcommand{\fnm}[1]{\footnotemark[#1]}
1207 \renewcommand{\thefootnote}{\fnsymbol{footnote}}
1208 %\renewcommand{\tts}{\tt \small}
1209 \newcommand{\ttss}{\tt \scriptsize}
1210
1211 \begin{landscape}
1212 \begin{longtable}{|l|lcc>{\raggedright}p{2.5in}cc|}
1213 \caption{Details of {\tt [~moleculetype~]} directives}\\
1214 \dline
1215 Name of interaction              & Topology file directive          & num.  & func. & Order of parameters and their units                   & use in     & Cross- \\
1216                                  &                                  & atoms\fnm{1} & type\fnm{2} &                                          & F.E.?\fnm{3} & references \\
1217 \dline
1218 \endhead
1219 \dline
1220 \endfoot
1221 \label{tab:topfile2}\footnotetext[1]{The required number of atom indices for this directive}\footnotetext[2]{The index to use to select this function type}\footnotetext[3]{Indicates which of the parameters for this interaction can be interpolated during free energy calculations}\footnotetext[4]{This interaction type will be used by {{\tts grompp}} for generating exclusions}\footnotetext[5]{This interaction type can be converted to constraints by {{\tts grompp}}}\footnotetext[7]{The combination rule determines the type of LJ parameters, see~\ssecref{nbpar}}\footnotetext[6]{No connection, and so no exclusions, are generated for this interaction}bond
1222                                    & {\tts bonds}\fnm{4},\fnm{5}    & 2     & 1     & $b_0$ (nm); $k_b$ (\kJmolnm{-2})                      & all        & \ssecref{harmonicbond} \\
1223 G96 bond                           & {\tts bonds}\fnm{4},\fnm{5}    & 2     & 2     & $b_0$ (nm); $k_b$ (\kJmolnm{-4})                      & all        & \ssecref{G96bond} \\
1224 Morse                              & {\tts bonds}\fnm{4},\fnm{5}    & 2     & 3     & $b_0$ (nm); $D$ (\kJmol); $\beta$ (nm$^{-1}$)         & all        & \ssecref{Morsebond} \\
1225 cubic bond                         & {\tts bonds}\fnm{4},\fnm{5}    & 2     & 4     & $b_0$ (nm); $C_{i=2,3}$ (\kJmolnm{-i})                &            & \ssecref{cubicbond} \\
1226 connection                         & {\tts bonds}\fnm{4}            & 2     & 5     &                                                       &            & \tsecref{excl} \\
1227 harmonic potential                 & {\tts bonds}                   & 2     & 6     & $b_0$ (nm); $k_b$ (\kJmolnm{-2})                      & all        & \ssecref{harmonicbond},\tsecref{excl} \\
1228 FENE bond                          & {\tts bonds}\fnm{4}            & 2     & 7     & $b_m$ (nm); $k_b$ (\kJmolnm{-2})                      &            & \ssecref{FENEbond} \\
1229 tabulated bond                     & {\tts bonds}\fnm{4}            & 2     & 8     & table number ($\geq 0$); $k$ (\kJmol)                 & $k$        & \ssecref{tabulatedinteraction} \\
1230 tabulated bond\fnm{6}              & {\tts bonds}                   & 2     & 9     & table number ($\geq 0$); $k$ (\kJmol)                 & $k$        & \ssecref{tabulatedinteraction},\tsecref{excl} \\
1231 restraint potential                & {\tts bonds}                   & 2     & 10    & low, up$_1$, up$_2$ (nm); $k_{dr}$ (\kJmolnm{-2})     & all        & \ssecref{harmonicrestraint} \\
1232 extra LJ or Coulomb                & {\tts pairs}                   & 2     & 1     & $V$\fnm{7}; $W$\fnm{7}                                & all        & \ssecref{pairinteractions} \\
1233 extra LJ or Coulomb                & {\tts pairs}                   & 2     & 2     & fudge QQ (); $q_i$, $q_j$ (e), $V$\fnm{7}; $W$\fnm{7} &            & \ssecref{pairinteractions} \\
1234 extra LJ or Coulomb                & {\tts pairs_nb}                & 2     & 1     & $q_i$, $q_j$ (e); $V$\fnm{7}; $W$\fnm{7}              &            & \ssecref{pairinteractions} \\
1235 angle                              & {\tts angles}\fnm{5}           & 3     & 1     & $\theta_0$ (deg); $k_\theta$ (\kJmolrad{-2})          & all        & \ssecref{harmonicangle} \\
1236 G96 angle                          & {\tts angles}\fnm{5}           & 3     & 2     & $\theta_0$ (deg); $k_\theta$ (\kJmol)                 & all        & \ssecref{G96angle} \\
1237 cross bond-bond                    & {\tts angles}                  & 3     & 3     & $r_{1e}$, $r_{2e}$ (nm); $k_{rr'}$ (\kJmolnm{-2})     &            & \ssecref{bondbondcross} \\
1238 cross bond-angle                   & {\tts angles}                  & 3     & 4     & $r_{1e}$, $r_{2e}$ $r_{3e}$ (nm); $k_{r\theta}$ (\kJmolnm{-2}) &   & \ssecref{bondanglecross} \\
1239 Urey-Bradley                       & {\tts angles}\fnm{5}           & 3     & 5     & $\theta_0$ (deg); $k_\theta$ (\kJmolrad{-2}); $r_{13}$ (nm); $k_{UB}$ (\kJmolnm{-2}) & all & \ssecref{Urey-Bradley} \\
1240 quartic angle                      & {\tts angles}\fnm{5}           & 3     & 6     & $\theta_0$ (deg); $C_{i=0,1,2,3,4}$ (\kJmolrad{-i})   &            & \ssecref{quarticangle} \\
1241 tabulated angle                    & {\tts angles}                  & 3     & 8     & table number ($\geq 0$); $k$ (\kJmol)                 & $k$        & \ssecref{tabulatedinteraction} \\
1242 restricted bending potential       & {\tts angles}                  & 3     & 10    & $\theta_0$ (deg); $k_\theta$ (\kJmol)                 &            & \ssecref{ReB} \\
1243 proper dihedral                    & {\tts dihedrals}               & 4     & 1     & $\phi_s$ (deg); $k_\phi$ (\kJmol); multiplicity       & $\phi,k$   & \ssecref{properdihedral} \\
1244 improper dihedral                  & {\tts dihedrals}               & 4     & 2     & $\xi_0$ (deg); $k_\xi$ (\kJmolrad{-2})                & all        & \ssecref{harmonicimproperdihedral} \\
1245 Ryckaert-Bellemans dihedral        & {\tts dihedrals}               & 4     & 3     & $C_0$, $C_1$, $C_2$, $C_3$, $C_4$, $C_5$ (\kJmol)     & all        & \ssecref{RBdihedral} \\
1246 periodic improper dihedral         & {\tts dihedrals}               & 4     & 4     & $\phi_s$ (deg); $k_\phi$ (\kJmol); multiplicity       & $\phi,k$   & \ssecref{periodicimproperdihedral} \\
1247 Fourier dihedral                   & {\tts dihedrals}               & 4     & 5     & $C_1$, $C_2$, $C_3$, $C_4$ (\kJmol)                   & all        & \ssecref{Fourierdihedral} \\
1248 tabulated dihedral                 & {\tts dihedrals}               & 4     & 8     & table number ($\geq 0$); $k$ (\kJmol)                 & $k$        & \ssecref{tabulatedinteraction} \\
1249 proper dihedral (multiple)         & {\tts dihedrals}               & 4     & 9     & $\phi_s$ (deg); $k_\phi$ (\kJmol); multiplicity       & $\phi,k$   & \ssecref{properdihedral} \\
1250 restricted dihedral                & {\tts dihedrals}               & 4     & 11    & $\phi_0$ (deg); $k_\phi$ (\kJmol)                    &            & \ssecref{ReT} \\
1251 combined bending-torsion potential & {\tts dihedrals}               & 4     & 10    & $a_0$, $a_1$, $a_2$, $a_3$, $a_4$ (\kJmol)       &            & \ssecref{CBT} \\
1252 exclusions                         & {\tts exclusions}              & 1     &       & one or more atom indices                              &            & \tsecref{excl} \\
1253 constraint                         & {\tts constraints}\fnm{4}      & 2     & 1     & $b_0$ (nm)                                            & all        & \sssecref{constraints},\tsecref{constraints} \\
1254 constraint\fnm{6}                  & {\tts constraints}             & 2     & 2     & $b_0$ (nm)                                            & all        & \sssecref{constraints},\tsecref{constraints},\tsecref{excl} \\
1255 SETTLE                             & {\tts settles}                 & 1     & 1     & $d_{\mbox{\sc oh}}$, $d_{\mbox{\sc hh}}$ (nm)         &            & \ssecref{SETTLE},\tsecref{constraints} \\
1256 2-body virtual site                & {\tts virtual_sites2}          & 3     & 1     & $a$ ()                                                &            & \ssecref{vsite2} \\
1257 3-body virtual site                & {\tts virtual_sites3}          & 4     & 1     & $a$, $b$ ()                                           &            & \ssecref{vsite3} \\
1258 3-body virtual site (fd)           & {\tts virtual_sites3}          & 4     & 2     & $a$ (); $d$ (nm)                                      &            & \ssecref{vsite3fd} \\
1259 3-body virtual site (fad)          & {\tts virtual_sites3}          & 4     & 3     & $\theta$ (deg); $d$ (nm)                              &            & \ssecref{vsite3fad} \\
1260 3-body virtual site (out)          & {\tts virtual_sites3}          & 4     & 4     & $a$, $b$ (); $c$ (nm$^{-1}$)                          &            & \ssecref{vsite3out} \\
1261 4-body virtual site (fdn)          & {\tts virtual_sites4}          & 5     & 2     & $a$, $b$ (); $c$ (nm)                                 &            & \ssecref{vsite4fdn} \\
1262 N-body virtual site (COG)          & {\tts virtual_sitesn}          & 1     & 1     & one or more constructing atom indices                 &            & \ssecref{vsiteN} \\
1263 N-body virtual site (COM)          & {\tts virtual_sitesn}          & 1     & 2     & one or more constructing atom indices                 &            & \ssecref{vsiteN} \\
1264 N-body virtual site (COW)          & {\tts virtual_sitesn}          & 1     & 3     & one or more pairs consisting of constructing atom index and weight & & \ssecref{vsiteN} \\
1265 position restraint                 & {\ttss position_restraints}    & 1     & 1     & $k_{x}$, $k_{y}$, $k_{z}$ (\kJmolnm{-2}) & all                     & \ssecref{positionrestraint} \\
1266 flat-bottomed position restraint   & {\ttss position_restraints}    & 1     & 2     & $g$, $r$ (nm), $k$ (\kJmolnm{-2})                     &            & \ssecref{fbpositionrestraint} \\
1267 %restraint potential                & {\tts bonds}                   & 2     & 10    & low, up$_1$, up$_2$ (nm); $k_{dr}$ (\kJmolnm{-2})     &            & \ssecref{} \\
1268 distance restraint                 & {\ttss distance_restraints}    & 2     & 1     & type; label; low, up$_1$, up$_2$ (nm); weight ()      &            & \ssecref{distancerestraint} \\
1269 dihedral restraint                 & {\ttss dihedral_restraints}    & 4     & 1     & $\phi_0$ (deg); $\Delta\phi$ (deg); &    all   & \ssecref{dihedralrestraint} \\
1270 orientation restraint              & {\ttss orientation_restraints} & 2     & 1     & exp.; label; $\alpha$; $c$ (U nm$^\alpha$); obs. (U); weight (U$^{-1}$) & & \ssecref{orientationrestraint} \\
1271 angle restraint                    & {\ttss angle_restraints}       & 4     & 1     & $\theta_0$ (deg); $k_c$ (\kJmol); multiplicity        & $\theta,k$ & \ssecref{anglerestraint} \\
1272 angle restraint (z)                & {\ttss angle_restraints_z}     & 2     & 1     & $\theta_0$ (deg); $k_c$ (\kJmol); multiplicity        & $\theta,k$ & \ssecref{anglerestraint} \\
1273 \end{longtable}
1274 \end{landscape}
1275
1276 \renewcommand{\thefootnote}{\arabic{footnote}}
1277
1278 %\renewcommand\floatpagefraction{.5}
1279
1280
1281 Description of the file layout:
1282 \begin{itemize}
1283 \item Semicolon (;) and newline characters surround comments
1284 \item On a line ending with $\backslash$ the newline character is ignored.
1285 \item Directives are surrounded by {\tt [} and {\tt ]}
1286 \item The topology hierarchy (which must be followed) consists of three levels:
1287 \begin{itemize}
1288 \item the parameter level, which defines certain force field specifications 
1289       (see~\tabref{topfile1})
1290 \item the molecule level, which should contain one or more molecule
1291       definitions (see~\tabref{topfile2})
1292 \item the system level, containing only system-specific information 
1293       ({\tt [~system~]} and {\tt [~molecules~]})
1294 \end{itemize}
1295 \item Items should be separated by spaces or tabs, not commas
1296 \item Atoms in molecules should be numbered consecutively starting at 1
1297 \item Atoms in the same charge group must be listed consecutively
1298 \item The file is parsed only once, which implies that no forward
1299       references can be treated: items must be defined before they
1300       can be used
1301 \item Exclusions can be generated from the bonds or
1302       overridden manually
1303 \item The bonded force types can be generated from the atom types or
1304       overridden per bond
1305 \item It is possible to apply multiple bonded interactions of the same type
1306       on the same atoms
1307 \item Descriptive comment lines and empty lines are highly recommended
1308 \item Starting with {\gromacs} version 3.1.3, all directives at the
1309       parameter level can be used multiple times and there are no
1310       restrictions on the order, except that an atom type needs to be
1311       defined before it can be used in other parameter definitions
1312 \item If parameters for a certain interaction are defined multiple times
1313       for the same combination of atom types the last definition is used;
1314       starting with {\gromacs} version 3.1.3 {\tt grompp} generates a
1315       warning for parameter redefinitions with different values
1316 \item Using one of the {\tt [~atoms~]}, {\tt [~bonds~]},
1317       {\tt [~pairs~]}, {\tt [~angles~]}, etc. without having used
1318       {\tt [~moleculetype~]}
1319       before is meaningless and generates a warning
1320 \item Using {\tt [~molecules~]} without having used
1321       {\tt [~system~]} before is meaningless and generates a warning.
1322 \item After {\tt [~system~]} the only allowed directive is {\tt [~molecules~]}
1323 \item Using an unknown string in {\tt [ ]} causes all the data until
1324       the next directive to be ignored and generates a warning
1325 \end{itemize}
1326
1327 Here is an example of a topology file, {\tt urea.top}:
1328
1329 {\small
1330 \begin{verbatim}
1331 ;
1332 ;       Example topology file
1333 ;
1334 ; The force field files to be included
1335 #include "gmx.ff/forcefield.itp"
1336
1337 [ moleculetype ]
1338 ; name  nrexcl
1339 Urea         3
1340
1341 [ atoms ]
1342 ;   nr    type   resnr  residu    atom    cgnr  charge
1343      1       C       1    UREA      C1       1   0.683
1344      2       O       1    UREA      O2       1  -0.683
1345      3      NT       1    UREA      N3       2  -0.622
1346      4       H       1    UREA      H4       2   0.346
1347      5       H       1    UREA      H5       2   0.276
1348      6      NT       1    UREA      N6       3  -0.622
1349      7       H       1    UREA      H7       3   0.346
1350      8       H       1    UREA      H8       3   0.276
1351
1352 [ bonds ]
1353 ;  ai    aj funct           b0           kb
1354     3     4     1 1.000000e-01 3.744680e+05 
1355     3     5     1 1.000000e-01 3.744680e+05 
1356     6     7     1 1.000000e-01 3.744680e+05 
1357     6     8     1 1.000000e-01 3.744680e+05 
1358     1     2     1 1.230000e-01 5.020800e+05 
1359     1     3     1 1.330000e-01 3.765600e+05 
1360     1     6     1 1.330000e-01 3.765600e+05 
1361
1362 [ pairs ]
1363 ;  ai    aj funct           c6          c12
1364     2     4     1 0.000000e+00 0.000000e+00 
1365     2     5     1 0.000000e+00 0.000000e+00 
1366     2     7     1 0.000000e+00 0.000000e+00 
1367     2     8     1 0.000000e+00 0.000000e+00 
1368     3     7     1 0.000000e+00 0.000000e+00 
1369     3     8     1 0.000000e+00 0.000000e+00 
1370     4     6     1 0.000000e+00 0.000000e+00 
1371     5     6     1 0.000000e+00 0.000000e+00 
1372
1373 [ angles ]
1374 ;  ai    aj    ak funct          th0          cth
1375     1     3     4     1 1.200000e+02 2.928800e+02 
1376     1     3     5     1 1.200000e+02 2.928800e+02 
1377     4     3     5     1 1.200000e+02 3.347200e+02 
1378     1     6     7     1 1.200000e+02 2.928800e+02 
1379     1     6     8     1 1.200000e+02 2.928800e+02 
1380     7     6     8     1 1.200000e+02 3.347200e+02 
1381     2     1     3     1 1.215000e+02 5.020800e+02 
1382     2     1     6     1 1.215000e+02 5.020800e+02 
1383     3     1     6     1 1.170000e+02 5.020800e+02 
1384
1385 [ dihedrals ]
1386 ;  ai    aj    ak    al funct          phi           cp         mult
1387     2     1     3     4     1 1.800000e+02 3.347200e+01 2.000000e+00 
1388     6     1     3     4     1 1.800000e+02 3.347200e+01 2.000000e+00 
1389     2     1     3     5     1 1.800000e+02 3.347200e+01 2.000000e+00 
1390     6     1     3     5     1 1.800000e+02 3.347200e+01 2.000000e+00 
1391     2     1     6     7     1 1.800000e+02 3.347200e+01 2.000000e+00 
1392     3     1     6     7     1 1.800000e+02 3.347200e+01 2.000000e+00 
1393     2     1     6     8     1 1.800000e+02 3.347200e+01 2.000000e+00 
1394     3     1     6     8     1 1.800000e+02 3.347200e+01 2.000000e+00 
1395
1396 [ dihedrals ]
1397 ;  ai    aj    ak    al funct           q0           cq
1398     3     4     5     1     2 0.000000e+00 1.673600e+02 
1399     6     7     8     1     2 0.000000e+00 1.673600e+02 
1400     1     3     6     2     2 0.000000e+00 1.673600e+02 
1401
1402 [ position_restraints ]
1403 ; you wouldn't normally use this for a molecule like Urea,
1404 ; but we include it here for didactic purposes
1405 ; ai   funct    fc
1406    1     1     1000    1000    1000 ; Restrain to a point
1407    2     1     1000       0    1000 ; Restrain to a line (Y-axis)
1408    3     1     1000       0       0 ; Restrain to a plane (Y-Z-plane)
1409
1410 ; Include SPC water topology
1411 #include "spc.itp"
1412
1413 [ system ]
1414 Urea in Water
1415
1416 [ molecules ]
1417 ;molecule name   nr.
1418 Urea             1
1419 SOL              1000
1420 \end{verbatim}}
1421
1422 Here follows the explanatory text.
1423
1424 {\bf {\tt [~defaults~]} :}
1425 \begin{itemize}
1426 \item {\tt nbfunc} is the non-bonded function type. Use 1 (Lennard-Jones) or 2 (Buckingham)
1427 \item {\tt comb-rule} is the number of the \normindex{combination rule} (see \ssecref{nbpar}).
1428 \item {\tt gen-pairs} is for pair generation. The default is `no', {\ie} 
1429 get 1-4 parameters from the pairtypes list. When parameters
1430 are not present in the list, stop with a fatal error.
1431 Setting `yes' generates 1-4 parameters that are not present in the pair list
1432 from normal Lennard-Jones parameters using {\tt fudgeLJ}
1433 \item {\tt fudgeLJ} is the factor by which to multiply Lennard-Jones 1-4 interactions, default 1
1434 \item {\tt fudgeQQ} is the factor by which to multiply electrostatic 1-4 interactions, default 1
1435 \item $N$ is the power for the repulsion term in a 6-$N$ potential (with 
1436 nonbonded-type Lennard-Jones only), starting with {\gromacs} version 4.5,
1437 {\tt mdrun} also reads and applies $N$, for values not equal to 12 tabulated
1438 interaction functions are used
1439 (in older version you would have to use user tabulated interactions).
1440 \end{itemize}
1441 {\bf Note} that {\tt gen-pairs}, {\tt fudgeLJ}, {\tt fudgeQQ}, and $N$ are optional.
1442 {\tt fudgeLJ} is only used when generate pairs is set to `yes', and
1443 {\tt fudgeQQ} is always used. However, if you
1444 want to specify $N$ you need to give a value for the other parameters as well.
1445
1446 % move these figures so they end up on facing pages 
1447 % (first figure on even page)
1448 %\input{topolfig}
1449
1450 {\bf {\tt \#include "gmx.ff/forcefield.itp"} :} this includes the bonded and
1451 non-bonded force field parameters, the {\tt gmx} in {\tt gmx.ff} will be
1452 replaced by the name of the force field you are actually using.
1453
1454 {\bf {\tt [~moleculetype~]} :} defines the name of your molecule in
1455 this {\tt *.top} and nrexcl = 3 stands for excluding non-bonded
1456 interactions between atoms that are no further than 3 bonds away.
1457
1458 {\bf {\tt [~atoms~]} :} defines the molecule, where {\tt nr} and
1459 {\tt type} are fixed, the rest is user defined. So {\tt atom} can be named
1460 as you like, {\tt cgnr} made larger or smaller (if possible, the total
1461 charge of a charge group should be zero), and charges can be changed
1462 here too.
1463
1464 {\bf {\tt [~bonds~]} :} no comment.
1465
1466 {\bf {\tt [~pairs~]} :} LJ and Coulomb 1-4 interactions
1467
1468 {\bf {\tt [~angles~]} :} no comment
1469
1470 {\bf {\tt [~dihedrals~]} :} in this case there are 9 proper dihedrals
1471 (funct = 1), 3 improper (funct = 2) and no Ryckaert-Bellemans type
1472 dihedrals. If you want to include Ryckaert-Bellemans type dihedrals
1473 in a topology, do the following (in case of {\eg} decane):
1474 \begin{verbatim}
1475 [ dihedrals ]
1476 ;  ai    aj    ak    al funct       c0       c1       c2
1477     1    2     3     4     3 
1478     2    3     4     5     3
1479 \end{verbatim}
1480 In the original implementation of the potential for
1481 alkanes~\cite{Ryckaert78} no 1-4 interactions were used, which means
1482 that in order to implement that particular force field you need to remove the 1-4
1483 interactions from the {\tt [~pairs~]} section of your topology. In
1484 most modern force fields, like OPLS/AA or Amber the rules are
1485 different, and the Ryckaert-Bellemans potential is used as a cosine
1486 series in combination with 1-4 interactions.
1487
1488 {\bf {\tt [~position_restraints~]} :} harmonically restrain the selected particles
1489 to reference positions (\ssecref{positionrestraint}). 
1490 The reference positions are read from a 
1491 separate coordinate file by {\tt \normindex{grompp}}.
1492
1493 {\bf {\tt \#include "spc.itp"} :} includes a topology file that was already
1494 constructed (see section~\ssecref{molitp}).
1495
1496 {\bf {\tt [~system~]} :} title of your system, user-defined
1497
1498 {\bf {\tt [~molecules~]} :} this defines the total number of (sub)molecules
1499 in your system that are defined in this {\tt *.top}. In this
1500 example file, it stands for 1 urea molecule dissolved in 1000 water
1501 molecules. The molecule type SOL is defined in the {\tt spc.itp} file.
1502 Each name here must correspond to a name given with {\tt [~moleculetype~]}
1503 earlier in the topology. The order of the blocks of molecule types and
1504 the numbers of such molecules must match the coordinate file that
1505 accompanies the topology when supplied to {\tt \normindex{grompp}}.
1506 The blocks of molecules do not need to be contiguous, but some
1507 tools (e.g. {\tt \normindex{genion}}) may act only on the first or
1508 last such block of a particular molecule type. Also, these blocks
1509 have nothing to do with the definition of \normindex{groups}
1510 (see \secref{groupconcept} and \secref{usinggroups}).
1511
1512 \subsection{Molecule.itp file}
1513 \label{subsec:molitp}
1514 If you construct a topology file you will use frequently (like the water
1515 molecule, {\tt spc.itp}, which is already constructed for you) it is
1516 good to make a {\tt molecule.itp} file. This only lists the
1517 information of one particular molecule and allows you to re-use the
1518 {\tt [ moleculetype ]} in multiple systems without re-invoking
1519 {\tt pdb2gmx} or manually copying and pasting. An example follows: 
1520
1521 {\small
1522 \begin{verbatim}
1523 [ moleculetype ]
1524 ; name  nrexcl
1525 Urea       3
1526
1527 [ atoms ]
1528 ;   nr    type   resnr  residu    atom    cgnr  charge
1529      1       C       1    UREA      C1       1   0.683  
1530      .................
1531      .................
1532      8       H       1    UREA      H8       3   0.276
1533
1534 [ bonds ]
1535 ;  ai    aj funct           c0           c1
1536     3     4     1 1.000000e-01 3.744680e+05 
1537      .................
1538      .................
1539     1     6     1 1.330000e-01 3.765600e+05 
1540
1541 [ pairs ]
1542 ;  ai    aj funct           c0           c1
1543     2     4     1 0.000000e+00 0.000000e+00 
1544      .................
1545      .................
1546     5     6     1 0.000000e+00 0.000000e+00 
1547
1548 [ angles ]
1549 ;  ai    aj    ak funct           c0           c1
1550     1     3     4     1 1.200000e+02 2.928800e+02 
1551      .................
1552      .................
1553     3     1     6     1 1.170000e+02 5.020800e+02 
1554
1555 [ dihedrals ]
1556 ;  ai    aj    ak    al funct           c0           c1           c2
1557     2     1     3     4     1 1.800000e+02 3.347200e+01 2.000000e+00 
1558      .................
1559      .................
1560     3     1     6     8     1 1.800000e+02 3.347200e+01 2.000000e+00 
1561
1562 [ dihedrals ]
1563 ;  ai    aj    ak    al funct           c0           c1
1564     3     4     5     1     2 0.000000e+00 1.673600e+02 
1565     6     7     8     1     2 0.000000e+00 1.673600e+02 
1566     1     3     6     2     2 0.000000e+00 1.673600e+02 
1567 \end{verbatim}}
1568
1569 Using {\tt *.itp} files results in a very short {\tt *.top} file:
1570
1571 {\small
1572 \begin{verbatim}
1573 ; The force field files to be included
1574 #include "gmx.ff/forcefield.itp"
1575         
1576 ; Include urea topology
1577 #include "urea.itp"
1578
1579 ; Include SPC water topology
1580 #include "spc.itp"
1581
1582 [ system ]
1583 Urea in Water
1584
1585 [ molecules ]
1586 ;molecule name  number
1587 Urea              1
1588 SOL               1000
1589 \end{verbatim}}
1590
1591 \subsection{Ifdef statements}
1592 \label{subsec:ifdef}
1593 A very powerful feature in {\gromacs} is the use of {\tt \#ifdef}
1594 statements in your {\tt *.top} file. By making use of this statement,
1595 different parameters for one molecule can be used in the same
1596 {\tt *.top} file. An example is given for TFE, where there is an option to
1597 use different charges on the atoms: charges derived by De Loof
1598 {\etal}~\cite{Loof92} or by Van Buuren and
1599 Berendsen~\cite{Buuren93a}. In fact, you can use much of the functionality of the
1600 C preprocessor, {\tt cpp}, because {\tt grompp} contains similar pre-processing
1601 functions to scan the file.  The
1602 way to make use of the {\tt \#ifdef} option is as follows:
1603 \begin{itemize}
1604 \item either use the option {\tt define = -DDeLoof} in the
1605       {\tt *.mdp} file (containing {\tt grompp} input
1606       parameters), or use the line {\tt \#define DeLoof}
1607       early in your {\tt *.top} or {\tt *.itp} file; and
1608 \item put the {\tt \#ifdef} statements in your {\tt *.top}, as
1609       shown below: 
1610 \end{itemize}
1611
1612 {\small
1613 \begin{verbatim}
1614 ...
1615
1616
1617
1618 [ atoms ]
1619 ; nr     type     resnr    residu     atom      cgnr      charge        mass
1620 #ifdef DeLoof
1621 ; Use Charges from DeLoof
1622    1        C        1        TFE        C         1        0.74        
1623    2        F        1        TFE        F         1       -0.25        
1624    3        F        1        TFE        F         1       -0.25        
1625    4        F        1        TFE        F         1       -0.25        
1626    5      CH2        1        TFE      CH2         1        0.25        
1627    6       OA        1        TFE       OA         1       -0.65        
1628    7       HO        1        TFE       HO         1        0.41        
1629 #else
1630 ; Use Charges from VanBuuren
1631    1        C        1        TFE        C         1        0.59        
1632    2        F        1        TFE        F         1       -0.2         
1633    3        F        1        TFE        F         1       -0.2         
1634    4        F        1        TFE        F         1       -0.2         
1635    5      CH2        1        TFE      CH2         1        0.26        
1636    6       OA        1        TFE       OA         1       -0.55        
1637    7       HO        1        TFE       HO         1        0.3         
1638 #endif
1639
1640 [ bonds ]
1641 ;  ai    aj funct           c0           c1
1642     6     7     1 1.000000e-01 3.138000e+05 
1643     1     2     1 1.360000e-01 4.184000e+05 
1644     1     3     1 1.360000e-01 4.184000e+05 
1645     1     4     1 1.360000e-01 4.184000e+05 
1646     1     5     1 1.530000e-01 3.347000e+05 
1647     5     6     1 1.430000e-01 3.347000e+05 
1648 ...
1649 \end{verbatim}}
1650
1651 This mechanism is used by {\tt pdb2gmx} to implement optional position
1652 restraints (\ssecref{positionrestraint}) by {\tt \#include}-ing an {\tt .itp} file whose contents
1653 will be meaningful only if a particular {\tt \#define} is set (and spelled
1654 correctly!)
1655
1656 \subsection{Topologies for free energy calculations}
1657 \index{free energy topologies}
1658 Free energy differences between two systems, A and B, can be calculated as
1659 described in \secref{fecalc}.
1660 Systems A and B are described by topologies
1661 consisting of the same number of molecules with the same number of
1662 atoms. Masses and non-bonded interactions can be perturbed by adding B
1663 parameters under the {\tt [~atoms~]} directive. Bonded interactions can be 
1664 perturbed by adding B parameters to the bonded types or the bonded
1665 interactions. The parameters that can be perturbed are listed in  
1666 Tables \ref{tab:topfile1} and \ref{tab:topfile2}.
1667 The $\lambda$-dependence of the interactions is described
1668 in section \secref{feia}.
1669 The bonded parameters that are used (on the line of the bonded
1670 interaction definition, or the ones looked up on atom types
1671 in the bonded type lists) is explained in \tabref{topfe}.
1672 In most cases, things should work intuitively.
1673 When the A and B atom types in a bonded interaction
1674 are not all identical and parameters are not present for the B-state,
1675 either on the line or in the bonded types,
1676 {\tt grompp} uses the A-state parameters and issues a warning.
1677 For free energy calculations, all or no parameters for topology B
1678 ($\lambda = 1$) should be added on the same line, after the normal
1679 parameters, in the same order as the normal parameters.
1680 From {\gromacs} 4.6 onward, if $\lambda$ is treated as a vector, then
1681 the {\tt bonded-lambdas} component controls all bonded terms that are
1682 not explicitly labeled as restraints.  Restrain terms are controlled
1683 by the {\tt restraint-lambdas} component.
1684
1685 \begin{table}
1686 \centerline{
1687 \begin{tabular}{|c|cc|cc|cc|c|}
1688 \dline
1689 B-state atom types & \multicolumn{2}{c|}{parameters} & \multicolumn{4}{c|}{parameters in bonded types} & \\
1690 all identical to      & \multicolumn{2}{c|}{on line} & \multicolumn{2}{c|}{A atom types} & \multicolumn{2}{c|}{B atom types} & message \\
1691 A-state atom types & A & B & A & B & A & B & \\
1692 \dline
1693     & +AB & $-$ &  x  &  x  &     &     & \\
1694     & +A  & +B  &  x  &  x  &     &     & \\
1695 yes & $-$ & $-$ & $-$ & $-$ &     &     & error \\
1696     & $-$ & $-$ & +AB & $-$ &     &     & \\
1697     & $-$ & $-$ & +A  & +B  &     &     & \\
1698 \hline
1699     & +AB & $-$ &  x  &  x  &  x  &  x  & warning \\
1700     & +A  & +B  &  x  &  x  &  x  &  x  & \\
1701     & $-$ & $-$ & $-$ & $-$ &  x  &  x  & error \\
1702 no  & $-$ & $-$ & +AB & $-$ & $-$ & $-$ & warning \\
1703     & $-$ & $-$ & +A  & +B  & $-$ & $-$ & warning \\
1704     & $-$ & $-$ & +A  &  x  & +B  & $-$ & \\
1705     & $-$ & $-$ & +A  &  x  &  +  & +B  & \\
1706 \dline
1707 \end{tabular}
1708 }
1709 \caption{The bonded parameters that are used for free energy topologies,
1710 on the line of the bonded interaction definition or looked up
1711 in the bond types section based on atom types. A and B indicate the
1712 parameters used for state A and B respectively, + and $-$ indicate
1713 the (non-)presence of parameters in the topology, x indicates that
1714 the presence has no influence.}
1715 \label{tab:topfe}
1716 \end{table}
1717
1718 Below is an example of a topology which changes from 200 propanols to
1719 200 pentanes using the \gromosv{96} force field.\\
1720
1721 {\small
1722 \begin{verbatim}
1723  
1724 ; Include force field parameters
1725 #include "gromos43a1.ff/forcefield.itp"
1726
1727 [ moleculetype ]
1728 ; Name            nrexcl
1729 PropPent          3
1730
1731 [ atoms ]
1732 ; nr type resnr residue atom cgnr  charge    mass  typeB chargeB  massB
1733   1    H    1     PROP    PH    1   0.398    1.008  CH3     0.0  15.035
1734   2   OA    1     PROP    PO    1  -0.548  15.9994  CH2     0.0  14.027
1735   3  CH2    1     PROP   PC1    1   0.150   14.027  CH2     0.0  14.027
1736   4  CH2    1     PROP   PC2    2   0.000   14.027
1737   5  CH3    1     PROP   PC3    2   0.000   15.035
1738
1739 [ bonds ]
1740 ;  ai    aj funct    par_A  par_B 
1741     1     2     2    gb_1   gb_26
1742     2     3     2    gb_17  gb_26
1743     3     4     2    gb_26  gb_26
1744     4     5     2    gb_26
1745
1746 [ pairs ]
1747 ;  ai    aj funct
1748     1     4     1
1749     2     5     1
1750
1751 [ angles ]
1752 ;  ai    aj    ak funct    par_A   par_B
1753     1     2     3     2    ga_11   ga_14
1754     2     3     4     2    ga_14   ga_14
1755     3     4     5     2    ga_14   ga_14
1756
1757 [ dihedrals ]
1758 ;  ai    aj    ak    al funct    par_A   par_B
1759     1     2     3     4     1    gd_12   gd_17
1760     2     3     4     5     1    gd_17   gd_17
1761
1762 [ system ]
1763 ; Name
1764 Propanol to Pentane
1765
1766 [ molecules ]
1767 ; Compound        #mols
1768 PropPent          200
1769 \end{verbatim}}
1770
1771 Atoms that are not perturbed, {\tt PC2} and {\tt PC3}, do not need B-state parameter
1772 specifications, since the B parameters will be copied from the A parameters.
1773 Bonded interactions between atoms that are not perturbed do not need B
1774 parameter specifications, as is the case for the last bond in the example topology.
1775 Topologies using the OPLS/AA force field need no bonded parameters at all,
1776 since both the A and B parameters are determined by the atom types.
1777 Non-bonded interactions involving one or two perturbed atoms use the 
1778 free-energy perturbation functional forms.
1779 Non-bonded interactions between two non-perturbed atoms use the normal
1780 functional forms.
1781 This means that when, for instance, only the charge of a particle is
1782 perturbed, its Lennard-Jones interactions will also be affected when
1783 lambda is not equal to zero or one.
1784
1785 {\bf Note} that this topology uses the \gromosv{96} force field, in which the bonded
1786 interactions are not determined by the atom types. The bonded interaction
1787 strings are converted by the C-preprocessor. The force field parameter
1788 files contain lines like:
1789
1790 {\small
1791 \begin{verbatim}
1792 #define gb_26       0.1530  7.1500e+06
1793
1794 #define gd_17     0.000       5.86          3
1795 \end{verbatim}}
1796
1797 \subsection{Constraint forces\index{constraint force}}
1798 \label{subsec:constraintforce}
1799 The constraint force between two atoms in one molecule can be calculated
1800 with the free energy perturbation code by adding a constraint between the
1801 two atoms, with a different length in the A and B topology. When the B length
1802 is 1 nm longer than the A length and lambda is kept constant at zero,
1803 the derivative of the Hamiltonian with respect to lambda is the constraint
1804 force. For constraints between molecules, the pull code can be used,
1805 see \secref{pull}.
1806 Below is an example for calculating the constraint force at 0.7 nm
1807 between two methanes in water, by combining the two methanes into one ``molecule.''
1808 {\bf Note} that the definition of a ``molecule'' in {\gromacs} does not necessarily
1809 correspond to the chemical definition of a molecule.  In {\gromacs}, a ``molecule''
1810 can be defined as any group of atoms that one wishes to consider simultaneously.
1811 The added constraint is of function type 2, which means that it is not
1812 used for generating exclusions (see~\secref{excl}). 
1813 Note that the constraint free energy term is included in the derivative term, and is
1814 specifically included in the {\tt bonded-lambdas} component. However, the free
1815 energy for changing constraints is {\em not} included in the potential energy
1816 differences used for BAR and MBAR, as this requires reevaluating the energy at
1817 each of the constraint components.  This functionality is planned for later versions.\\
1818
1819 {\small
1820 \begin{verbatim}
1821 ; Include force field parameters
1822 #include "gromos43a1.ff/forcefield.itp"
1823
1824 [ moleculetype ]
1825 ; Name            nrexcl
1826 Methanes               1
1827
1828 [ atoms ]
1829 ; nr   type   resnr  residu   atom    cgnr     charge    mass
1830    1    CH4     1     CH4      C1       1          0    16.043
1831    2    CH4     1     CH4      C2       2          0    16.043
1832 [ constraints ]
1833 ;  ai    aj funct   length_A  length_B
1834     1     2     2        0.7       1.7
1835
1836 #include "spc.itp"
1837
1838 [ system ]
1839 ; Name
1840 Methanes in Water
1841
1842 [ molecules ]
1843 ; Compound        #mols
1844 Methanes              1
1845 SOL                2002
1846 \end{verbatim}}
1847
1848 \subsection{Coordinate file}
1849 \label{subsec:grofile}
1850 Files with the {\tt .gro} file extension contain a molecular structure in 
1851 \gromosv{87} format. A sample piece is included below:
1852
1853 {\small
1854 \begin{verbatim}
1855 MD of 2 waters, reformat step, PA aug-91
1856     6
1857     1WATER  OW1    1   0.126   1.624   1.679  0.1227 -0.0580  0.0434
1858     1WATER  HW2    2   0.190   1.661   1.747  0.8085  0.3191 -0.7791
1859     1WATER  HW3    3   0.177   1.568   1.613 -0.9045 -2.6469  1.3180
1860     2WATER  OW1    4   1.275   0.053   0.622  0.2519  0.3140 -0.1734
1861     2WATER  HW2    5   1.337   0.002   0.680 -1.0641 -1.1349  0.0257
1862     2WATER  HW3    6   1.326   0.120   0.568  1.9427 -0.8216 -0.0244
1863    1.82060   1.82060   1.82060
1864 \end{verbatim}}
1865
1866 This format is fixed, {\ie} all columns are in a fixed position. If you
1867 want to read such a file in your own program without using the
1868 {\gromacs} libraries you can use the following formats:
1869
1870 {\bf C-format:} {\tt "\%5i\%5s\%5s\%5i\%8.3f\%8.3f\%8.3f\%8.4f\%8.4f\%8.4f"}
1871
1872 Or to be more precise, with title {\em etc.} it looks like this:
1873
1874 \begin{verbatim}
1875   "%s\n", Title
1876   "%5d\n", natoms
1877   for (i=0; (i<natoms); i++) {
1878     "%5d%-5s%5s%5d%8.3f%8.3f%8.3f%8.4f%8.4f%8.4f\n",
1879       residuenr,residuename,atomname,atomnr,x,y,z,vx,vy,vz
1880   }
1881   "%10.5f%10.5f%10.5f%10.5f%10.5f%10.5f%10.5f%10.5f%10.5f\n",
1882     box[X][X],box[Y][Y],box[Z][Z],
1883     box[X][Y],box[X][Z],box[Y][X],box[Y][Z],box[Z][X],box[Z][Y]
1884 \end{verbatim}
1885
1886 {\bf Fortran format:} {\tt (i5,2a5,i5,3f8.3,3f8.4)}
1887
1888 So {\tt confin.gro} is the {\gromacs} coordinate file and is almost
1889 the same as the \gromosv{87} file (for {\gromos} users: when used with
1890 {\tt ntx=7}).  The only difference is the box for which {\gromacs} uses a
1891 tensor, not a vector.
1892
1893
1894
1895 \section{Force field organization \index{force field organization}}
1896 \label{sec:fforganization}
1897
1898 \subsection{Force field files}
1899 \label{subsec:fffiles}
1900 As of {\gromacs} version 4.5, 14 force fields are available by default.
1901 Force fields are detected by the presence of {\tt <name>.ff} directories
1902 in the {\gromacs} {\tt /share/top} sub-directory and/or the working directory.
1903 The information regarding the location of the force field files is printed
1904 by {\tt pdb2gmx} so you can easily keep track of which version of a force field
1905 is being called, in case you have made modifications in one location or another.
1906 The force fields included with {\gromacs} are:
1907
1908 {\small
1909 \begin{itemize}
1910  \item AMBER03 force field (Duan et al., J. Comp. Chem. 24, 1999-2012, 2003) 
1911  \item AMBER94 force field (Cornell et al., JACS 117, 5179-5197, 1995) 
1912  \item AMBER96 force field (Kollman et al., Acc. Chem. Res. 29, 461-469, 1996) 
1913  \item AMBER99 force field (Wang et al., J. Comp. Chem. 21, 1049-1074, 2000) 
1914  \item AMBER99SB force field (Hornak et al., Proteins 65, 712-725, 2006) 
1915  \item AMBER99SB-ILDN force field (Lindorff-Larsen et al., Proteins 78, 1950-58, 2010) 
1916  \item AMBERGS force field (Garcia \& Sanbonmatsu, PNAS 99, 2782-2787, 2002) 
1917  \item CHARMM27 all-atom force field (with CMAP) 
1918  \item GROMOS96 43A1 force field 
1919  \item GROMOS96 43A2 force field (improved alkane dihedrals) 
1920  \item GROMOS96 45A3 force field (Schuler JCC 2001 22 1205) 
1921  \item GROMOS96 53A5 force field (JCC 2004 vol 25 pag 1656) 
1922  \item GROMOS96 53A6 force field (JCC 2004 vol 25 pag 1656) 
1923  \item OPLS-AA/L all-atom force field (2001 aminoacid dihedrals) 
1924 \end{itemize}} 
1925  
1926 There are also some additional deprecated force fields listed in the selection from
1927 {\tt pdb2gmx}, but we do not currently recommend that you use those for new simulations.
1928  
1929 A force field is included at the beginning of a topology file with an
1930 {\tt \#include} statement followed by {\tt <name>.ff/forcefield.itp}.
1931 This statement includes the force field file,
1932 which, in turn, may include other force field files. All the force fields
1933 are organized in the same way. As an example, we show the {\tt gmx.ff/forcefield.itp}
1934 file:
1935
1936 {\small
1937 \begin{verbatim}
1938 #define _FF_GROMACS
1939 #define _FF_GROMACS1
1940
1941 [ defaults ]
1942 ; nbfunc        comb-rule       gen-pairs       fudgeLJ fudgeQQ
1943   1             1               no              1.0     1.0
1944
1945 #include "ffnonbonded.itp"
1946 #include "ffbonded.itp"
1947 \end{verbatim}}
1948
1949 The first {\tt \#define} can be used in topologies to parse data which is
1950 specific for all {\gromacs} force fields, the second {\tt \#define} is to parse
1951 data specific to this force field. The {\tt [~defaults~]} section is
1952 explained in \ssecref{topfile}. The included file {\tt ffnonbonded.itp} contains
1953 all atom types and non-bonded parameters. The included file {\tt ffbonded.itp}
1954 contains all bonded parameters.
1955
1956 For each force field, there several files which are only used by {\tt pdb2gmx}.
1957 These are: residue databases ({\tt .rtp}, see~\ssecref{rtp})
1958 the hydrogen database ({\tt .hdb}, see~\ssecref{hdb}), two termini databases
1959 ({\tt .n.tdb} and {\tt .c.tdb}, see~\ssecref{tdb}) and
1960 the atom type database ({\tt .atp}, see~\ssecref{atomtype}), which contains only the masses.  Other optional
1961 files are described in~\secref{pdb2gmxfiles}.
1962
1963
1964 \subsection{Changing force field parameters\index{force field}}
1965 If one wants to change the parameters of few bonded interactions in
1966 a molecule, this is most easily accomplished by typing the parameters
1967 behind the definition of the bonded interaction directly in the {\tt *.top} file 
1968 under the {\tt [~moleculetype~]} section (see \ssecref{topfile} for the format
1969 and units).
1970 If one wants to change the parameters for all instances of a certain
1971 interaction one can change them in the force-field file or add a
1972 new {\tt [~???types~]} section after including the force field.
1973 When parameters for a certain interaction are defined multiple times,
1974 the last definition is used. As of {\gromacs} version 3.1.3, a warning is
1975 generated when parameters are redefined with a different value.
1976 Changing the Lennard-Jones parameters of an atom type is not
1977 recommended, because in the {\gromos} force fields
1978 the Lennard-Jones parameters for several combinations of atom types
1979 are not generated according to the standard combination rules.
1980 Such combinations (and possibly others that do follow the
1981 combination rules) are defined in the {\tt [~nonbond_params~]}
1982 section, and changing the Lennard-Jones parameters of an atom type
1983 has no effect on these combinations.
1984
1985 \subsection{Adding atom types\swapindexquiet{adding}{atom types}}
1986 As of {\gromacs} version 3.1.3, atom types can be added in an extra
1987 {\tt [~atomtypes~]} section after the the inclusion of the normal
1988 force field. After the definition of the new atom type(s), additional
1989 non-bonded and pair parameters can be defined.
1990 In pre-3.1.3 versions of {\gromacs}, the new atom types needed to be
1991 added in the {\tt [~atomtypes~]} section of the force field files,
1992 because all non-bonded parameters above the last {\tt [~atomtypes~]}
1993 section would be overwritten using the standard combination rules.
1994
1995 \section{{\tt gmx.ff} documentation}
1996 For backward compatibility we retain here some reference to parameters
1997 present in the {\tt gmx.ff} force field. The last 10 atom types were
1998 not part of the original \gromosv{87} force field~\cite{biomos}, so
1999 if you use them you should refer to one or more of the following
2000 papers:
2001 \begin{itemize}
2002 \item F was taken from ref.~\cite{Buuren93a}, 
2003 \item CP2 and CP3 from ref.~\cite{Buuren93b} and references cited therein, 
2004 \item CR5, CR6 and HCR from ref.~\cite{Spoel96c}
2005 \item OWT3 from ref.~\cite{Jorgensen83}
2006 \item SD, OD and CD from ref.~\cite{Liu95}
2007 \end{itemize}
2008 {\bf Note that we recommend against using these parameters in new projects
2009 since they are not well-tested.}
2010
2011 % LocalWords:  parameterized fffiles ptype polarizable gromacs atp ype arameter
2012 % LocalWords:  lll carboxyl OA hydroxyl NL porphyrin OPLS CP HCR OWT fd funct
2013 % LocalWords:  grompp statprop atomtype rtp esidue opology pdb gmx kJ mol gro
2014 % LocalWords:  grofile dihedrals bon itp func kb th cth cq cp mult Ryckaert aj
2015 % LocalWords:  Bellemans ak alkanes alkane llrllrllr LJ der nb topfile llllll
2016 % LocalWords:  llll nonbond params ij pairtypes fecalc moleculetype indices mdp
2017 % LocalWords:  constraintforce SPC molname nrexcl nr ren HW doh dhh aminoacids
2018 % LocalWords:  dat basename rna dna arn hdb sn rtpo gmxfiles molitp ndx ARG CYS
2019 % LocalWords:  defaultgroups impropers chargegroup bondedtypes hydrogens ARGN
2020 % LocalWords:  preprocessor protonation specbond protonated arginine aspartic
2021 % LocalWords:  ASPH GLU glutamic GLUH HISD histidine HISE HISH LYSN LYS IUPAC
2022 % LocalWords:  wildcards xlateat asparagine HD HH cis deprotonated oxygens COOH
2023 % LocalWords:  llllc tp cr QQ atomtypes bondtypes angletypes dihedraltypes FENE
2024 % LocalWords:  constrainttypes intra nbpar morse dr Coul rr UB dih constr hh ai
2025 % LocalWords:  vsite sitesn construc restr ffgmx resnr residu cgnr al fc spc gb
2026 % LocalWords:  FudgeLJ FudgeQQ nonbonded mdrun decane posre Ifdef ifdef TFE cpp
2027 % LocalWords:  Loof Buuren Berendsen DDeloof DeLoof VanBuuren endif feia topfe
2028 % LocalWords:  propanols pentanes ffG PropPent typeB chargeB massB ga gd mols
2029 % LocalWords:  Propanol Pentane methanes aug natoms residuenr residuename vx vy
2030 % LocalWords:  atomname atomnr vz Fortran confin ntx GROMOS nbfunc GROningen ff
2031 % LocalWords:  fudgeLJ fudgeQQ ffgmxnb ffgmxbon tdb ffbonded ffnonbonded nonbond
2032 % LocalWords:  MAchine BIOSON Groningen Spoel Drunen Comp Phys Comm trr AA fdn
2033 % LocalWords:  aliphatic CHARMM polarisability quadrupole tt normvsbds Waals jj
2034 % LocalWords:  pairinteractions num Buckingham rcl trans Intramolecular Lennard
2035 % LocalWords:  excl gen solute unscaled moltype intramol dgimplement Qiu HCT rt
2036 % LocalWords:  Onufriev OBC LINCS doc xxx residuetypes polyatomic co rotatable
2037 % LocalWords:  heme cysteine lysine CH NH LP amine nitrenyl ethynyl vsd MCH MNH
2038 % LocalWords:  chainsep resA atomA nbondsA resB atomB nbondsB newresA newresB
2039 % LocalWords:  rad deg lcc cc nm intramolecular forcefield PME Ewald
2040 % LocalWords:  solvation et groupconcept PHE TYR TRP equilibrated pre
2041 % LocalWords:  macromolecule disulfide harmonicbond Morsebond vsiteN
2042 % LocalWords:  cubicbond FENEbond tabulatedinteraction harmonicangle
2043 % LocalWords:  harmonicrestraint bondbondcross bondanglecross genion
2044 % LocalWords:  quarticangle properdihedral harmonicimproperdihedral
2045 % LocalWords:  RBdihedral periodicimproperdihedral Fourierdihedral
2046 % LocalWords:  positionrestraint distancerestraint dihedralrestraint
2047 % LocalWords:  orientationrestraint anglerestraint usinggroups ing
2048 % LocalWords:  DDeLoof MBAR Duan JACS Kollman Acc Hornak ILDN AMBERGS
2049 % LocalWords:  Lindorff Sanbonmatsu PNAS CMAP Schuler JCC pag
2050 % LocalWords:  aminoacid