Merge branch release-5-1 into release-2016
[gromacs.git] / docs / manual / analyse.tex
blobca3e5344a8a2650b43a21b455701b3d54f42d8f0
2 % This file is part of the GROMACS molecular simulation package.
4 % Copyright (c) 2013,2014,2015,2016, 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.
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.
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.
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.
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.
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.
35 \chapter{Analysis}
36 \label{ch:analysis}
37 In this chapter different ways of analyzing your trajectory are described.
38 The names of the corresponding analysis programs are given.
39 Specific information on the in- and output of these programs can be found
40 in the online manual at {\wwwpage}.
41 The output files are often produced as finished Grace/Xmgr graphs.
43 First, in \secref{usinggroups}, the group concept in analysis is explained.
44 \ssecref{selections} explains a newer concept of dynamic selections,
45 which is currently supported by a few tools.
46 Then, the different analysis tools are presented.
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Groups in Analysis
50 \section{Using Groups}
51 \label{sec:usinggroups}\index{groups}
52 {\tt gmx make_ndx, gmx mk_angndx, gmx select}\\
53 In \chref{algorithms}, it was explained how {\em groups of
54 atoms} can be used in {\tt mdrun} (see~\secref{groupconcept}).
55 In most analysis programs, groups
56 of atoms must also be chosen. Most programs can generate several default
57 index groups, but groups can always be read from an index file. Let's
58 consider the example of a simulation of a binary mixture of components A and B. When
59 we want to calculate the radial distribution function (RDF)
60 $g_{AB}(r)$ of A with respect to B, we have to calculate:
61 \beq
62 4\pi r^2 g_{AB}(r) ~=~ V~\sum_{i \in A}^{N_A} \sum_{j \in B}^{N_B} P(r)
63 \eeq
64 where $V$ is the volume and $P(r)$ is the probability of finding a B atom
65 at distance $r$ from an A atom.
67 By having the user define the {\em atom numbers} for groups A and B in
68 a simple file, we can calculate this $g_{AB}$ in the most general way, without
69 having to make any assumptions in the RDF program about the type of
70 particles.
72 Groups can therefore consist of a series of {\em atom numbers}, but in
73 some cases also of {\em molecule numbers}. It is also possible to
74 specify a series of angles by {\em triples} of {\em atom numbers},
75 dihedrals by {\em quadruples} of {\em atom numbers} and bonds or
76 vectors (in a molecule) by {\em pairs} of {\em atom numbers}. When
77 appropriate the type of index file will be specified for the following
78 analysis programs. To help creating such \swapindex{index}{file}s ({\tt
79 index.ndx}), there are a couple of programs to generate them, using
80 either your input configuration or the topology. To generate an
81 index file consisting of a series of {\em atom numbers} (as in the
82 example of $g_{AB}$), use {\tt \normindex{gmx make_ndx}} or
83 {\tt \normindex{gmx select}}. To generate an index file
84 with angles or dihedrals, use {\tt \normindex{gmx mk_angndx}}.
85 Of course you can also
86 make them by hand. The general format is presented here:
88 \begin{verbatim}
89 [ Oxygen ]
90 1 4 7
92 [ Hydrogen ]
93 2 3 5 6
94 8 9
95 \end{verbatim}
97 First, the group name is written between square brackets. The following
98 atom numbers may be spread out over as many lines as you like. The
99 atom numbering starts at 1.
101 \swapindexquiet{choosing}{groups}%
102 Each tool that can use groups will offer the available alternatives
103 for the user to choose. That choice can be made with the number of the
104 group, or its name. In fact, the first few letters of the group
105 name will suffice if that will distinguish the group from all others.
106 There are ways to use Unix shell features to choose group names
107 on the command line, rather than interactively. Consult {\wwwpage}
108 for suggestions.
110 \subsection{Default Groups}
111 \label{subsec:defaultgroups}
112 When no index file is supplied to analysis tools or {\tt grompp},
113 a number of \swapindex{default}{groups} are generated to choose from:
114 \begin{description}
115 \item[{\tt System}]\mbox{}\\
116 all atoms in the system
117 \item[{\tt Protein}]\mbox{}\\
118 all protein atoms
119 \item[{\tt Protein-H}]\mbox{}\\
120 protein atoms excluding hydrogens
121 \item[{\tt C-alpha}]\mbox{}\\
122 C$_{\alpha}$ atoms
123 \item[{\tt Backbone}]\mbox{}\\
124 protein backbone atoms; N, C$_{\alpha}$ and C
125 \item[{\tt MainChain}]\mbox{}\\
126 protein main chain atoms: N, C$_{\alpha}$, C and O, including
127 oxygens in C-terminus
128 \item[{\tt MainChain+Cb}]\mbox{}\\
129 protein main chain atoms including C$_{\beta}$
130 \item[{\tt MainChain+H}]\mbox{}\\
131 protein main chain atoms including backbone amide hydrogens and
132 hydrogens on the N-terminus
133 \item[{\tt SideChain}]\mbox{}\\
134 protein side chain atoms; that is all atoms except N,
135 C$_{\alpha}$, C, O, backbone amide hydrogens, oxygens in
136 C-terminus and hydrogens on the N-terminus
137 \item[{\tt SideChain-H}]\mbox{}\\
138 protein side chain atoms excluding all hydrogens
139 %\ifthenelse{\equal{\gmxlite}{1}}{}{
140 \item[{\tt Prot-Masses}]\mbox{}\\
141 protein atoms excluding dummy masses (as used in virtual site
142 constructions of NH$_3$ groups and tryptophan side-chains),
143 see also \secref{vsitetop}; this group is only included when
144 it differs from the ``{\tt Protein}'' group
145 %} % Brace matches ifthenelse test for gmxlite
146 \item[{\tt Non-Protein}]\mbox{}\\
147 all non-protein atoms
148 \item[{\tt DNA}]\mbox{}\\
149 all DNA atoms
150 \item[{\tt RNA}]\mbox{}\\
151 all RNA atoms
152 \item[{\tt Water}]\mbox{}\\
153 water molecules (names like {\tt SOL}, {\tt WAT}, {\tt HOH}, etc.) See
154 {\tt \normindex{residuetypes.dat}} for a full listing
155 \item[{\tt non-Water}]\mbox{}\\
156 anything not covered by the {\tt Water} group
157 \item[{\tt Ion}]\mbox{}\\
158 any name matching an Ion entry in {\tt \normindex{residuetypes.dat}}
159 \item[{\tt Water_and_Ions}]\mbox{}\\
160 combination of the {\tt Water} and {\tt Ions} groups
161 \item[{\tt molecule_name}]\mbox{}\\
162 for all residues/molecules which are not recognized as protein,
163 DNA, or RNA; one group per residue/molecule name is generated
164 \item[{\tt Other}]\mbox{}\\
165 all atoms which are neither protein, DNA, nor RNA.
166 \end{description}
167 Empty groups will not be generated.
168 Most of the groups only contain protein atoms.
169 An atom is considered a protein atom if its residue name is listed
170 in the {\tt \normindex{residuetypes.dat}} file and is listed as a
171 ``Protein'' entry. The process for determinding DNA, RNA, etc. is
172 analogous. If you need to modify these classifications, then you
173 can copy the file from the library directory into your working
174 directory and edit the local copy.
176 \subsection{Selections}
177 \label{subsec:selections}
178 {\tt \normindex{gmx select}}\\
179 Currently, a few analysis tools support an extended concept of {\em
180 (dynamic) \normindex{selections}}. There are three main differences to
181 traditional index groups:
182 \begin{itemize}
183 \item The selections are specified as text instead of reading fixed
184 atom indices from a file, using a syntax similar to VMD. The text
185 can be entered interactively, provided on the command line, or from
186 a file.
187 \item The selections are not restricted to atoms, but can also specify
188 that the analysis is to be performed on, e.g., center-of-mass
189 positions of a group of atoms.
190 Some tools may not support selections that do not evaluate to single
191 atoms, e.g., if they require information that is available only for
192 single atoms, like atom names or types.
193 \item The selections can be dynamic, i.e., evaluate to different atoms
194 for different trajectory frames. This allows analyzing only a
195 subset of the system that satisfies some geometric criteria.
196 \end{itemize}
197 As an example of a simple selection,
198 {\tt resname ABC and within 2 of resname DEF}
199 selects all atoms in residues named ABC that are within 2\,nm of any
200 atom in a residue named DEF.
202 Tools that accept selections can also use traditional index files
203 similarly to older tools: it is possible to give an {\tt .ndx} file to
204 the tool, and directly select a group from the index file as a
205 selection, either by group number or by group name. The index groups
206 can also be used as a part of a more complicated selection.
208 To get started, you can run {\tt gmx select} with a single structure,
209 and use the interactive prompt to try out different selections.
210 The tool provides, among others, output options {\tt -on} and
211 {\tt -ofpdb} to write out the selected atoms to an index file and to a
212 {\tt .pdb} file, respectively. This does not allow testing selections
213 that evaluate to center-of-mass positions, but other selections can be
214 tested and the result examined.
216 The detailed syntax and the individual keywords that can be used in
217 selections can be accessed by typing {\tt help} in the interactive
218 prompt of any selection-enabled tool, as well as with
219 {\tt gmx help selections}. The help is divided into subtopics that can
220 be accessed with, e.g., {\tt help syntax} / {\tt gmx help selections
221 syntax}. Some individual selection keywords have extended help as well,
222 which can be accessed with, e.g., {\tt help keywords within}.
224 The interactive prompt does not currently provide much editing
225 capabilities. If you need them, you can run the program under
226 {\tt rlwrap}.
228 For tools that do not yet support the selection syntax, you can use
229 {\tt gmx select -on} to generate static index groups to pass to the
230 tool. However, this only allows for a small subset (only the first
231 bullet from the above list) of the flexibility that fully
232 selection-aware tools offer.
234 It is also possible to write your own analysis
235 tools to take advantage of the flexibility of these selections: see the
236 {\tt template.cpp} file in the {\tt share/gromacs/template} directory of
237 your installation for an example.
239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Looking at your trajectory
241 \section{Looking at your trajectory}
242 \label{sec:lookwhostalking}
243 \begin{figure}
244 \centerline{
245 {\includegraphics[width=8cm,angle=90]{plots/ngmxdump}}}
246 \caption{The window of {\tt gmx view} showing a box of water.}
247 \label{fig:ngmxdump}
248 \end{figure}
249 {\tt gmx view}\\
250 Before analyzing your trajectory it is often informative to look at
251 your trajectory first. {\gromacs} comes with a simple trajectory
252 viewer {\tt \normindex{gmx view}}; the advantage with this one is that it does not
253 require OpenGL, which usually isn't present on {\eg} supercomputers.
254 It is also possible to generate a
255 hard-copy in Encapsulated Postscript format (see
256 \figref{ngmxdump}). If you want a faster and more fancy viewer
257 there are several programs
258 that can read the {\gromacs} trajectory formats -- have a look at our
259 homepage ({\wwwpage}) for updated links.
261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% General properties
263 \section{General properties}
264 \label{sec:genprop}
265 {\tt gmx energy, gmx traj}\\
266 To analyze some or all {\em energies} and other properties, such as
267 {\em total pressure}, {\em pressure tensor}, {\em density}, {\em
268 box-volume} and {\em box-sizes}, use the program {\tt \normindex{gmx energy}}. A
269 choice can be made from a list a set of energies, like potential,
270 kinetic or total energy, or individual contributions, like
271 Lennard-Jones or dihedral energies.
273 The {\em center-of-mass velocity}, defined as
274 \beq
275 {\bf v}_{com} = {1 \over M} \sum_{i=1}^N m_i {\bf v}_i
276 \eeq
277 with $M = \sum_{i=1}^N m_i$ the total mass of the system, can be
278 monitored in time by the program {\tt \normindex{gmx traj} -com -ov}. It is however
279 recommended to remove the center-of-mass velocity every step (see
280 \chref{algorithms})!
282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Radial distribution functions
284 \section{Radial distribution functions}
285 \label{sec:rdf}
286 {\tt gmx rdf}\\
287 The {\em radial distribution function} (RDF) or pair correlation
288 function $g_{AB}(r)$ between particles of type $A$ and $B$ is defined
289 in the following way:
290 \newcommand{\dfrac}[2]{\displaystyle \frac{#1}{#2}}
291 \beq
292 \begin{array}{rcl}
293 g_{AB}(r)&=& \dfrac{\langle \rho_B(r) \rangle}{\langle\rho_B\rangle_{local}} \\
294 &=& \dfrac{1}{\langle\rho_B\rangle_{local}}\dfrac{1}{N_A}
295 \sum_{i \in A}^{N_A} \sum_{j \in B}^{N_B}
296 \dfrac{\delta( r_{ij} - r )}{4 \pi r^2} \\
297 \end{array}
298 \eeq
299 with $\langle\rho_B(r)\rangle$ the particle density of type $B$ at a distance $r$
300 around particles $A$, and $\langle\rho_B\rangle_{local}$ the particle density of
301 type $B$ averaged over all spheres around particles $A$ with radius
302 $r_{max}$ (see \figref{rdfex}C).
304 \begin{figure}
305 \centerline{
306 {\includegraphics[width=7cm]{plots/rdf}}}
307 \caption[Definition of slices in {\tt gmx rdf}.]{Definition of slices
308 in {\tt gmx rdf}: A. $g_{AB}(r)$. B. $g_{AB}(r,\theta)$. The slices are
309 colored gray. C. Normalization $\langle\rho_B\rangle_{local}$. D. Normalization
310 $\langle\rho_B\rangle_{local,\:\theta }$. Normalization volumes are colored gray.}
311 \label{fig:rdfex}
312 \end{figure}
314 Usually the value of $r_{max}$ is half of the box length. The
315 averaging is also performed in time. In practice the analysis program
316 {\tt \normindex{gmx rdf}} divides the system into spherical slices (from $r$ to
317 $r+dr$, see \figref{rdfex}A) and makes a histogram in stead of
318 the $\delta$-function. An example of the RDF of oxygen-oxygen in
319 SPC water~\cite{Berendsen81} is given in \figref{rdf}.
321 \begin{figure}
322 \centerline{
323 {\includegraphics[width=8cm]{plots/rdfO-O}}}
324 \caption{$g_{OO}(r)$ for Oxygen-Oxygen of SPC-water.}
325 \label{fig:rdf}
326 \end{figure}
328 % TODO: This functionality isn't there...
329 With {\tt gmx rdf} it is also possible to calculate an angle dependent rdf
330 $g_{AB}(r,\theta)$, where the angle $\theta$ is defined with respect to a
331 certain laboratory axis ${\bf e}$, see \figref{rdfex}B.
332 \bea
333 g_{AB}(r,\theta) &=& {1 \over \langle\rho_B\rangle_{local,\:\theta }} {1 \over N_A} \sum_{i \in A}^{N_A} \sum_{j \in B}^{N_B} {\delta( r_{ij} - r ) \delta(\theta_{ij} -\theta) \over 2 \pi r^2 sin(\theta)}\\
334 cos(\theta_{ij}) &=& {{\bf r}_{ij} \cdot {\bf e} \over \|r_{ij}\| \;\| e\| }
335 \eea
336 This $g_{AB}(r,\theta)$ is useful for analyzing anisotropic systems.
337 {\bf Note} that in this case the normalization $\langle\rho_B\rangle_{local,\:\theta}$ is
338 the average density in all angle slices from $\theta$ to $\theta + d\theta$
339 up to $r_{max}$, so angle dependent, see \figref{rdfex}D.
341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Correlation functions
342 %\ifthenelse{\equal{\gmxlite}{1}}{}{
344 \section{Correlation functions}
345 \label{sec:corr}
347 \subsection{Theory of correlation functions}
348 The theory of correlation functions is well established~\cite{Allen87}.
349 We describe here the implementation of the various
350 \normindex{correlation} function flavors in the {\gromacs} code.
351 The definition of the autocorrelation function\index{autocorrelation function}
352 (ACF)
353 $C_f(t)$ for a property $f(t)$ is:
354 \beq
355 C_f(t) ~=~ \left\langle f(\xi) f(\xi+t)\right\rangle_{\xi}
356 \label{eqn:corr}
357 \eeq
358 where the notation on the right hand side indicates averaging over $\xi$, {\ie} over
359 time origins.
360 It is also possible to compute cross-correlation function from two properties
361 $f(t)$ and $g(t)$:
362 \beq
363 C_{fg}(t) ~=~ \left\langle f(\xi) g(\xi+t)\right\rangle_{\xi}
364 \eeq
365 however, in {\gromacs} there is no standard mechanism to do this
366 ({\bf note:} you can use the {\tt \normindex{xmgr}} program to compute cross correlations).
367 The integral of the correlation function over time is the
368 correlation time $\tau_f$:
369 \beq
370 \tau_f ~=~ \int_0^{\infty} C_f(t) {\rm d} t
371 \label{eqn:corrtime}
372 \eeq
374 In practice, correlation functions are calculated based on data points with
375 discrete time intervals {$\Delta$t}, so that the ACF from an MD simulation is:
376 \beq
377 C_f(j\Delta t) ~=~ \frac{1}{N-j}\sum_{i=0}^{N-1-j} f(i\Delta t) f((i+j)\Delta t)
378 \label{eqn:corrmd}
379 \eeq
380 where $N$ is the number of available time frames for the calculation.
381 The resulting ACF is
382 obviously only available at time points with the same interval {$\Delta$t}.
383 Since, for many applications, it is necessary to know the short time behavior
384 of the ACF ({\eg} the first 10 ps) this often means that we have to save the
385 data with intervals much shorter than the time scale of interest.
386 Another implication of \eqnref{corrmd} is that in principle we can not compute
387 all points of the ACF with the same accuracy, since we have $N-1$ data points
388 for $C_f(\Delta t)$ but only 1 for $C_f((N-1)\Delta t)$. However, if we decide to
389 compute only an ACF of length $M\Delta t$, where $M \leq N/2$ we can compute
390 all points with the same statistical accuracy:
391 \beq
392 C_f(j\Delta t) ~=~ \frac{1}{M}\sum_{i=0}^{N-1-M} f(i\Delta t)f((i+j)\Delta t)
393 \eeq
394 Here of course $j < M$.
395 $M$ is sometimes referred to as the \normindex{time lag} of the correlation function.
396 When we decide to do this, we intentionally do not use all the available points
397 for very short time intervals ($j << M$), but it makes it easier to interpret
398 the results.
399 Another aspect that may not be neglected when computing
400 ACFs from simulation is that usually the time origins $\xi$ (\eqnref{corr})
401 are not statistically independent, which may introduce a bias in the results.
402 This can be tested using a block-averaging procedure, where only time origins
403 with a spacing at least the length of the time lag are included, {\eg} using
404 $k$ time origins with spacing of $M\Delta t$ (where $kM \leq N$):
405 \beq
406 C_f(j\Delta t) ~=~ \frac{1}{k}\sum_{i=0}^{k-1} f(iM\Delta t)f((iM+j)\Delta t)
407 \eeq
408 However, one
409 needs very long simulations to get good accuracy this way, because there are
410 many fewer points that contribute to the ACF.
412 \subsection{Using FFT for computation of the ACF}
413 The computational cost for calculating an ACF according to \eqnref{corrmd}
414 is proportional to $N^2$, which is considerable. However, this can be improved
415 by using fast Fourier transforms to do the convolution~\cite{Allen87}.
417 \subsection{Special forms of the ACF}
418 There are some important varieties on the ACF, {\eg} the ACF of a vector \ve{p}:
419 \beq
420 C_{\ve{p}}(t) ~=~ \int_0^{\infty} P_n(\cos\angle\left(\ve{p}(\xi),\ve{p}(\xi+t)\right) {\rm d} \xi
421 \label{eqn:corrleg}
422 \eeq
423 where $P_n(x)$ is the $n^{th}$ order Legendre polynomial
424 \footnote{$P_0(x) = 1$, $P_1(x) = x$, $P_2(x) = (3x^2-1)/2$}.
425 Such correlation times
426 can actually be obtained experimentally using {\eg} NMR or other relaxation
427 experiments. {\gromacs} can compute correlations using
428 the 1$^{st}$ and 2$^{nd}$ order Legendre polynomial (\eqnref{corrleg}).
429 This can also be used for rotational autocorrelation
430 ({\tt \normindex{gmx rotacf}})
431 and dipole autocorrelation ({\tt \normindex{gmx dipoles}}).
433 In order to study torsion angle dynamics, we define a dihedral
434 autocorrelation function as~\cite{Spoel97a}:
435 \beq
436 C(t) ~=~ \left\langle \cos(\theta(\tau)-\theta(\tau+t))\right\rangle_{\tau}
437 \label{eqn:coenk}
438 \eeq
439 {\bf Note} that this is not a product of two functions
440 as is generally used for correlation
441 functions, but it may be rewritten as the sum of two products:
442 \beq
443 C(t) ~=~ \left\langle\cos(\theta(\tau))\cos(\theta(\tau+t))\,+\,\sin(\theta(\tau))\sin(\theta(\tau+t))\right\rangle_{\tau}
444 \label{eqn:cot}
445 \eeq
447 \subsection{Some Applications}
448 The program {\tt \normindex{gmx velacc}} calculates the {\em velocity autocorrelation
449 function}.
450 \beq
451 C_{\ve{v}} (\tau) ~=~ \langle {\ve{v}}_i(\tau) \cdot {\ve{v}}_i(0) \rangle_{i \in A}
452 \eeq
453 The self diffusion coefficient can be calculated using the Green-Kubo
454 relation~\cite{Allen87}:
455 \beq
456 D_A ~=~ {1\over 3} \int_0^{\infty} \langle {\bf v}_i(t) \cdot {\bf v}_i(0) \rangle_{i \in A} \; dt
457 \eeq
458 which is just the integral of the velocity autocorrelation function.
459 There is a widely-held belief that the velocity ACF converges faster than the mean
460 square displacement (\secref{msd}), which can also be used for the computation of
461 diffusion constants. However, Allen \& Tildesley~\cite{Allen87}
462 warn us that the long-time
463 contribution to the velocity ACF can not be ignored, so care must be taken.
465 Another important quantity is the dipole correlation time. The {\em dipole
466 correlation function} for particles of type $A$ is calculated as follows by
467 {\tt \normindex{gmx dipoles}}:
468 \beq
469 C_{\mu} (\tau) ~=~
470 \langle {\bf \mu}_i(\tau) \cdot {\bf \mu}_i(0) \rangle_{i \in A}
471 \eeq
472 with ${\bf \mu}_i = \sum_{j \in i} {\bf r}_j q_j$. The dipole correlation time
473 can be computed using \eqnref{corrtime}.
474 For some applications see~\cite{Spoel98a}.
476 The \normindex{viscosity} of a liquid can be related to the correlation
477 time of the Pressure tensor $\ve{P}$~\cite{PSmith93c,Balasubramanian96}.
478 {\tt \normindex{gmx energy}} can compute the viscosity,
479 but this is not very accurate~\cite{Hess2002a}, and
480 actually the values do not converge.
481 %} % Brace matches ifthenelse test for gmxlite
483 \section{Curve fitting in \gromacs}
484 \subsection{Sum of exponential functions}
485 Sometimes it is useful to fit a curve to an analytical function, for
486 example in the case of autocorrelation functions with noisy
487 tails. {\gromacs} is not a general purpose curve-fitting tool however
488 and therefore {\gromacs} only supports a limited number of
489 functions.
490 Table~\ref{tab:fitfn} lists the available options with the
491 corresponding command-line options. The underlying routines for
492 fitting use the Levenberg-Marquardt algorithm as implemented in the
493 {\tt lmfit} package~\cite{lmfit} (a bare-bones version of which is
494 included in {\gromacs} in which an option for error-weighted fitting
495 was implemented).
496 \begin{table}[ht]
497 \centering
498 \caption{Overview of fitting functions supported in (most) analysis tools
499 that compute autocorrelation functions. The ``Note'' column describes
500 properties of the output parameters.}
501 \label{tab:fitfn}
502 \begin{tabular}{lcc}
503 \hline
504 Command & Functional form $f(t)$& Note\\
505 line option & & \\
506 \hline
507 exp & $e^{-t/{a_0}}$ &\\
508 aexp & $a_1e^{-t/{a_0}}$ &\\
509 exp_exp & $a_1e^{-t/{a_0}}+(1-a_1)e^{-t/{a_2}}$ & $a_2\ge a_0\ge 0$\\
510 exp5 & $a_1e^{-t/{a_0}}+a_3e^{-t/{a_2}}+a_4$ &$a_2\ge a_0\ge 0$\\
511 exp7 &
512 $a_1e^{-t/{a_0}}+a_3e^{-t/{a_2}}+a_5e^{-t/{a_4}}+a_6$&$a_4\ge a_2\ge
513 a_0 \ge0$\\
514 exp9 &
515 $a_1e^{-t/{a_0}}+a_3e^{-t/{a_2}}+a_5e^{-t/{a_4}}+a_7e^{-t/{a_6}}+a_8$&$a_6\ge
516 a_4\ge a_2\ge a_0\ge 0$\\
517 \hline
518 \end{tabular}
519 \end{table}
521 \subsection{Error estimation}
522 Under the hood {\gromacs} implements some more fitting functions,
523 namely a function to estimate the error in time-correlated data due to Hess~\cite{Hess2002a}:
524 \beq
525 \varepsilon^2(t) =
526 \alpha\tau_1\left(1+\frac{\tau_1}{t}\left(e^{-t/\tau_1}-1\right)\right)
527 + (1-\alpha)\tau_2\left(1+\frac{\tau_2}{t}\left(e^{-t/\tau_2}-1\right)\right)
528 \eeq
529 where $\tau_1$ and
530 $\tau_2$ are time constants (with $\tau_2 \ge \tau_1$) and $\alpha$
531 usually is close to 1 (in the fitting procedure it is enforced that
532 $0\leq\alpha\leq 1$). This is used in {\tt gmx analyze} for error
533 estimation using
534 \beq
535 \lim_{t\rightarrow\infty}\varepsilon(t) = \sigma\sqrt{\frac{2(\alpha\tau_1+(1-\alpha)\tau_2)}{T}}
536 \eeq
537 where $\sigma$ is the standard deviation of the data set and $T$ is
538 the total simulation time~\cite{Hess2002a}.
540 \subsection{Interphase boundary demarcation}
541 In order to determine the position and width of an interface,
542 Steen-S{\ae}thre {\em et al.} fitted a density profile to the
543 following function
544 \beq
545 f(x) ~=~ \frac{a_0+a_1}{2} - \frac{a_0-a_1}{2}{\rm
546 erf}\left(\frac{x-a_2}{a_3^2}\right)
547 \eeq
548 where $a_0$ and $a_1$ are densities of different phases, $x$ is the
549 coordinate normal to the interface, $a_2$ is the position of the
550 interface and $a_3$ is the width of the
551 interface~\cite{Steen-Saethre2014a}.
552 This is implemented in {\tt gmx densorder}.
554 \subsection{Transverse current autocorrelation function}
555 In order to establish the transverse current autocorrelation function
556 (useful for computing viscosity~\cite{Palmer1994a})
557 the following function is fitted:
558 \beq
559 f(x) ~=~ e^{-\nu}\left({\rm cosh}(\omega\nu)+\frac{{\rm
560 sinh}(\omega\nu)}{\omega}\right)
561 \eeq
562 with $\nu = x/(2a_0)$ and $\omega = \sqrt{1-a_1}$.
563 This is implemented in {\tt gmx tcaf}.
565 \subsection{Viscosity estimation from pressure autocorrelation
566 function}
567 The viscosity is a notoriously difficult property to extract from
568 simulations~\cite{Hess2002a,Wensink2003a}. It is {\em in principle}
569 possible to determine it by integrating the pressure autocorrelation
570 function~\cite{PSmith93c}, however this is often hampered by the noisy
571 tail of the ACF. A workaround to this is fitting the ACF to the
572 following function~\cite{Guo2002b}:
573 \beq
574 f(t)/f(0) = (1-C) {\rm cos}(\omega t) e^{-(t/\tau_f)^{\beta_f}} + C
575 e^{-(t/\tau_s)^{\beta_s}}
576 \eeq
577 where $\omega$ is the frequency of rapid pressure oscillations (mainly
578 due to bonded forces in molecular simulations), $\tau_f$ and $\beta_f$
579 are the time constant and exponent of fast relaxation in a
580 stretched-exponential approximation, $\tau_s$ and $\beta_s$ are constants
581 for slow relaxation and $C$ is the pre-factor that determines the
582 weight between fast and slow relaxation. After a fit, the integral of
583 the function $f(t)$ is used to compute the viscosity:
584 \beq
585 \eta = \frac{V}{k_B T}\int_0^{\infty} f(t) dt
586 \eeq
587 This equation has been
588 applied to computing the bulk and shear viscosity using different
589 elements from the pressure tensor~\cite{Fanourgakis2012a}.
590 This is implemented in {\tt gmx viscosity}.
592 \section{Mean Square Displacement}
593 \label{sec:msd}
594 {\tt gmx msd}\\
595 To determine the self diffusion coefficient\index{diffusion coefficient} $D_A$
597 particles of type $A$, one can use the \normindex{Einstein
598 relation}~\cite{Allen87}:
599 \beq
600 \lim_{t \rightarrow \infty} \langle
601 \|{\bf r}_i(t) - {\bf r}_i(0)\|^2 \rangle_{i \in A} ~=~ 6 D_A t
602 \eeq
603 This {\em mean square displacement} and $D_A$ are calculated by the
604 program {\tt \normindex{gmx msd}}. Normally an index file containing
605 atom numbers is used and the MSD is averaged over these atoms. For
606 molecules consisting of more than one atom, ${\bf r}_i$ can be taken
607 as the center of mass positions of the molecules. In that case, you
608 should use an index file with molecule numbers. The results will be
609 nearly identical to averaging over atoms, however. The {\tt gmx msd}
610 program can
611 also be used for calculating diffusion in one or two dimensions. This
612 is useful for studying lateral diffusion on interfaces.
614 An example of the mean square displacement of SPC water is given in
615 \figref{msdwater}.
617 \begin{figure}
618 \centerline{
619 {\includegraphics[width=8cm]{plots/msdwater}}}
620 \caption{Mean Square Displacement of SPC-water.}
621 \label{fig:msdwater}
622 \end{figure}
624 %\ifthenelse{\equal{\gmxlite}{1}}{}{
626 %%%%%%%%%%%%%%%%%%%%% Bonds, angles and dihedral %%%%%%%%%%%%%%%%%%%
628 \section{Bonds/distances, angles and dihedrals}
629 \label{sec:bad}
630 {\tt gmx distance, gmx angle, gmx gangle}\\
631 To monitor specific {\em bonds} in your modules, or more generally
632 distances between points, the program
633 {\tt \normindex{gmx distance}} can calculate distances as a function of
634 time, as well as the distribution of the distance.
635 With a traditional index file, the groups should consist of pairs of
636 atom numbers, for example:
637 \begin{verbatim}
638 [ bonds_1 ]
641 9 10
643 [ bonds_2 ]
644 12 13
645 \end{verbatim}
646 Selections are also supported, with first two positions defining the
647 first distance, second pair of positions defining the second distance
648 and so on. You can calculate the distances between CA and CB atoms in
649 all your residues (assuming that every residue either has both atoms, or
650 neither) using a selection such as:
651 \begin{verbatim}
652 name CA CB
653 \end{verbatim}
654 The selections also allow more generic distances to be computed.
655 For example, to compute the distances between centers of mass of two
656 residues, you can use:
657 \begin{verbatim}
658 com of resname AAA plus com of resname BBB
659 \end{verbatim}
661 The program {\tt \normindex{gmx angle}} calculates the distribution of {\em angles} and
662 {\em dihedrals} in time. It also gives the average angle or dihedral.
663 The index file consists of triplets or quadruples of atom numbers:
665 \begin{verbatim}
666 [ angles ]
667 1 2 3
668 2 3 4
669 3 4 5
671 [ dihedrals ]
672 1 2 3 4
673 2 3 5 5
674 \end{verbatim}
676 For the dihedral angles you can use either the ``biochemical convention''
677 ($\phi = 0 \equiv cis$) or ``polymer convention'' ($\phi = 0 \equiv trans$),
678 see \figref{dih_def}.
680 \begin{figure}
681 \centerline{
682 {\includegraphics[width=3.5cm,angle=270]{plots/dih-def}}}
683 \caption[Dihedral conventions.]{Dihedral conventions: A. ``Biochemical
684 convention''. B. ``Polymer convention''.}
685 \label{fig:dih_def}
686 \end{figure}
688 The program {\tt \normindex{gmx gangle}} provides a selection-enabled
689 version to compute angles. This tool can also compute angles and
690 dihedrals, but does not support all the options of {\tt gmx angle}, such
691 as autocorrelation or other time series analyses.
692 In addition, it supports angles between two vectors, a vector and a
693 plane, two planes (defined by 2 or 3 points, respectively), a
694 vector/plane and the $z$ axis, or a vector/plane and the normal of a
695 sphere (determined by a single position).
696 Also the angle between a vector/plane compared to its position in the
697 first frame is supported.
698 For planes, {\tt \normindex{gmx gangle}} uses the normal vector
699 perpendicular to the plane.
700 See \figref{sgangle}A, B, C) for the definitions.
702 \begin{figure}
703 \centerline{
704 {\includegraphics{plots/sgangle}}}
705 \caption[Angle options of {\tt gmx gangle}.]{Angle options of {\tt gmx gangle}:
706 A. Angle between two vectors.
707 B. Angle between two planes.
708 C. Angle between a vector and the $z$ axis.
709 D. Angle between a vector and the normal of a sphere.
710 Also other combinations are supported: planes and vectors can be used
711 interchangeably.}
712 \label{fig:sgangle}
713 \end{figure}
714 %} % Brace matches ifthenelse test for gmxlite
716 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Radius of gyration and distances
718 \section{Radius of gyration and distances}
719 \label{sec:rg}
720 {\tt gmx gyrate, gmx distance, gmx mindist, gmx mdmat, gmx pairdist, gmx xpm2ps}\\
721 To have a rough measure for the compactness of a structure, you can calculate
722 the {\em radius of gyration} with the program {\tt \normindex{gmx gyrate}} as follows:
723 \beq
724 R_g ~=~ \left({\frac{\sum_i \|{\bf r}_i\|^2 m_i}{\sum_i m_i}}\right)^{\half}
725 \label{eqn:rg}
726 \eeq
727 where $m_i$ is the mass of atom $i$ and ${\bf r}_i$ the position of
728 atom $i$ with respect to the center of mass of the molecule. It is especially
729 useful to characterize polymer solutions and proteins. The program will also
730 provide the radius of gyration around the coordinate axis (or, optionally, principal axes)
731 by only summing the radii components orthogonal to each axis, for instance
732 \beq
733 R_{g,x} ~=~ \left({\frac{\sum_i \left( r_{i,y}^2 + r_{i,z}^2 \right) m_i}{\sum_i m_i}}\right)^{\half}
734 \label{eqn:rgaxis}
735 \eeq
737 Sometimes it is interesting to plot the {\em distance} between two atoms,
738 or the {\em minimum} distance between two groups of atoms
739 ({\eg}: protein side-chains in a salt bridge).
740 To calculate these distances between certain groups there are several
741 possibilities:
742 \begin{description}
743 \item[$\bullet$]
744 The {\em distance between the geometrical centers} of two groups can be
745 calculated with the program
746 %\ifthenelse{\equal{\gmxlite}{1}}{
747 {{\tt \normindex{gmx distance}}, as explained in \secref{bad}.}
748 \item[$\bullet$]
749 The {\em minimum distance} between two groups of atoms during time
750 can be calculated with the program {\tt \normindex{gmx mindist}}. It also calculates the
751 {\em number of contacts} between these groups
752 within a certain radius $r_{max}$.
753 \item[$\bullet$]
754 {\tt \normindex{gmx pairdist}} is a selection-enabled version of
755 {\tt gmx mindist}.
756 \item[$\bullet$]
757 To monitor the {\em minimum distances between amino acid residues}
758 within a (protein) molecule, you can use
759 the program {\tt \normindex{gmx mdmat}}. This minimum distance between two residues
760 A$_i$ and A$_j$ is defined as the smallest distance between any pair of
761 atoms (i $\in$ A$_i$, j $\in$ A$_j$).
762 The output is a symmetrical matrix of smallest distances
763 between all residues.
764 To visualize this matrix, you can use a program such as {\tt xv}.
765 If you want to view the axes and legend or if you want to print
766 the matrix, you can convert it with
767 {\tt xpm2ps} into a Postscript picture, see \figref{mdmat}.
768 \begin{figure}
769 \centerline{
770 \includegraphics[width=6.5cm]{plots/distm}}
771 \caption{A minimum distance matrix for a peptide~\protect\cite{Spoel96b}.}
772 \label{fig:mdmat}
773 \end{figure}
775 Plotting these matrices for different time-frames, one can analyze changes
776 in the structure, and {\eg} forming of salt bridges.
777 \end{description}
779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Root mean square deviations
781 \section{Root mean square deviations in structure}
782 \label{sec:rmsd}
783 {\tt gmx rms, gmx rmsdist}\\
784 The {\em root mean square deviation} ($RMSD$) of certain atoms in a molecule
785 with respect to a reference structure can be calculated with the program
786 {\tt \normindex{gmx rms}} by least-square fitting the structure to the reference structure
787 ($t_2 = 0$) and subsequently calculating the $RMSD$ (\eqnref{rmsd}).
788 \beq
789 RMSD(t_1,t_2) ~=~ \left[\frac{1}{M} \sum_{i=1}^N m_i \|{\bf r}_i(t_1)-{\bf r}_i(t_2)\|^2 \right]^{\frac{1}{2}}
790 \label{eqn:rmsd}
791 \eeq
792 where $M = \sum_{i=1}^N m_i$ and ${\bf r}_i(t)$ is the position of atom $i$ at time $t$.
793 {\bf Note} that fitting does not have to use the same atoms as the calculation
794 of the $RMSD$; {\eg} a protein is usually fitted on the backbone atoms
795 (N,C$_{\alpha}$,C), but the $RMSD$ can be computed of the backbone
796 or of the whole protein.
798 Instead of comparing the structures to the initial structure at time $t=0$
799 (so for example a crystal structure), one can also calculate \eqnref{rmsd}
800 with a structure at time $t_2=t_1-\tau$.
801 This gives some insight in the mobility as a function of $\tau$.
802 A matrix can also be made with the $RMSD$ as a function of $t_1$ and $t_2$,
803 which gives a nice graphical interpretation of a trajectory.
804 If there are transitions in a trajectory, they will clearly show up in
805 such a matrix.
807 Alternatively the $RMSD$ can be computed using a fit-free method with the
808 program {\tt \normindex{gmx rmsdist}}:
809 \beq
810 RMSD(t) ~=~ \left[\frac{1}{N^2}\sum_{i=1}^N \sum_{j=1}^N \|{\bf r}_{ij}(t)-{\bf r}_{ij}(0)\|^2\right]^{\frac{1}{2}}
811 \label{eqn:rmsdff}
812 \eeq
813 where the {\em distance} {\bf r}$_{ij}$ between atoms at time $t$
814 is compared with the distance between the same atoms at time $0$.
816 %\ifthenelse{\equal{\gmxlite}{1}}{}{
817 \section{Covariance analysis\index{covariance analysis}}
818 \label{sec:covanal}
819 Covariance analysis, also called
820 \seeindex{principal component analysis}{covariance analysis}
821 or \seeindex{essential dynamics}{covariance analysis}
822 \cite{Amadei93}{,} can find correlated motions.
823 It uses the covariance matrix $C$ of the atomic coordinates:
824 \beq
825 C_{ij} = \left \langle
826 M_{ii}^{\frac{1}{2}} (x_i - \langle x_i \rangle)
827 M_{jj}^{\frac{1}{2}} (x_j - \langle x_j \rangle)
828 \right \rangle
829 \eeq
830 where $M$ is a diagonal matrix containing the masses of the atoms
831 (mass-weighted analysis) or the unit matrix (non-mass weighted analysis).
832 $C$ is a symmetric $3N \times 3N$ matrix, which can be diagonalized with
833 an orthonormal transformation matrix $R$:
834 \beq
835 R^T C R = \mbox{diag}(\lambda_1,\lambda_2,\ldots,\lambda_{3N})
836 ~~~~\mbox{where}~~\lambda_1 \geq \lambda_2 \geq \ldots \geq \lambda_{3N}
837 \eeq
838 The columns of $R$ are the eigenvectors, also called principal or
839 essential modes.
840 $R$ defines a transformation to a new coordinate system. The trajectory
841 can be projected on the principal modes to give the principal components
842 $p_i(t)$:
843 \beq
844 {\bf p}(t) = R^T M^{\frac{1}{2}} ({\bf x}(t) - \langle {\bf x} \rangle)
845 \eeq
846 The eigenvalue $\lambda_i$ is the mean square fluctuation of principal
847 component $i$. The first few principal modes often describe
848 collective, global motions in the system.
849 The trajectory can be filtered along one (or more) principal modes.
850 For one principal mode $i$ this goes as follows:
851 \beq
852 {\bf x}^f(t) =
853 \langle {\bf x} \rangle + M^{-\frac{1}{2}} R_{*i} \, p_i(t)
854 \eeq
856 When the analysis is performed on a macromolecule, one often wants to
857 remove the overall rotation and translation to look at the internal motion
858 only. This can be achieved by least square fitting to a reference structure.
859 Care has to be taken that the reference structure is representative for the
860 ensemble, since the choice of reference structure influences the covariance
861 matrix.
863 One should always check if the principal modes are well defined.
864 If the first principal component resembles a half cosine and
865 the second resembles a full cosine, you might be filtering noise (see below).
866 A good way to check the relevance of the first few principal
867 modes is to calculate the overlap of the sampling between
868 the first and second half of the simulation.
869 {\bf Note} that this can only be done when the same reference structure is
870 used for the two halves.
872 A good measure for the overlap has been defined in~\cite{Hess2002b}.
873 The elements of the covariance matrix are proportional to the square
874 of the displacement, so we need to take the square root of the matrix
875 to examine the extent of sampling. The square root can be
876 calculated from the eigenvalues $\lambda_i$ and the eigenvectors,
877 which are the columns of the rotation matrix $R$.
878 For a symmetric and diagonally-dominant matrix $A$ of size $3N \times 3N$
879 the square root can be calculated as:
880 \beq
881 A^\frac{1}{2} =
882 R \, \mbox{diag}(\lambda_1^\frac{1}{2},\lambda_2^\frac{1}{2},\ldots,\lambda_{3N}^\frac{1}{2}) \, R^T
883 \eeq
884 It can be verified easily that the product of this matrix with itself gives
885 $A$.
886 Now we can define a difference $d$ between covariance matrices $A$ and $B$
887 as follows:
888 \begin{eqnarray}
889 d(A,B) & = & \sqrt{\mbox{tr}\left(\left(A^\frac{1}{2} - B^\frac{1}{2}\right)^2\right)
891 \\ & = &
892 \sqrt{\mbox{tr}\left(A + B - 2 A^\frac{1}{2} B^\frac{1}{2}\right)}
893 \\ & = &
894 \left( \sum_{i=1}^N \left( \lambda_i^A + \lambda_i^B \right)
895 - 2 \sum_{i=1}^N \sum_{j=1}^N \sqrt{\lambda_i^A \lambda_j^B}
896 \left(R_i^A \cdot R_j^B\right)^2 \right)^\frac{1}{2}
897 \end{eqnarray}
898 where tr is the trace of a matrix.
899 We can now define the overlap $s$ as:
900 \beq
901 s(A,B) = 1 - \frac{d(A,B)}{\sqrt{\mbox{tr}A + \mbox{tr} B}}
902 \eeq
903 The overlap is 1 if and only if matrices $A$ and $B$ are identical.
904 It is 0 when the sampled subspaces are completely orthogonal.
906 A commonly-used measure is the subspace overlap of the first few
907 eigenvectors of covariance matrices.
908 The overlap of the subspace spanned by $m$ orthonormal vectors
909 ${\bf w}_1,\ldots,{\bf w}_m$ with a reference subspace spanned by
910 $n$ orthonormal vectors ${\bf v}_1,\ldots,{\bf v}_n$
911 can be quantified as follows:
912 \beq
913 \mbox{overlap}({\bf v},{\bf w}) =
914 \frac{1}{n} \sum_{i=1}^n \sum_{j=1}^m ({\bf v}_i \cdot {\bf w}_j)^2
915 \eeq
916 The overlap will increase with increasing $m$ and will be 1 when
917 set ${\bf v}$ is a subspace of set ${\bf w}$.
918 The disadvantage of this method is that it does not take the eigenvalues
919 into account. All eigenvectors are weighted equally, and when
920 degenerate subspaces are present (equal eigenvalues), the calculated overlap
921 will be too low.
923 Another useful check is the cosine content. It has been proven that the
924 the principal components of random diffusion are cosines with the number of
925 periods equal to half the principal component index~\cite{Hess2000,Hess2002b}.
926 The eigenvalues are proportional to the index to the power $-2$.
927 The cosine content is defined as:
928 \beq
929 \frac{2}{T}
930 \left( \int_0^T \cos\left(\frac{i \pi t}{T}\right) \, p_i(t) \mbox{d} t \right)^2
931 \left( \int_0^T p_i^2(t) \mbox{d} t \right)^{-1}
932 \eeq
933 When the cosine content of the first few principal components
934 is close to 1, the largest fluctuations are not connected with
935 the potential, but with random diffusion.
937 The covariance matrix is built and diagonalized by
938 {\tt \normindex{gmx covar}}.
939 The principal components and overlap (and many more things)
940 can be plotted and analyzed with {\tt \normindex{gmx anaeig}}.
941 The cosine content can be calculated with {\tt \normindex{gmx analyze}}.
942 %} % Brace matches ifthenelse test for gmxlite
944 %\ifthenelse{\equal{\gmxlite}{1}}{}{
945 \section{Dihedral principal component analysis}
946 {\tt gmx angle, gmx covar, gmx anaeig}\\
947 Principal component analysis can be performed in dihedral
948 space~\cite{Mu2005a} using {\gromacs}. You start by defining the
949 dihedral angles of interest in an index file, either using {\tt
950 gmx mk_angndx} or otherwise. Then you use the {\tt gmx angle} program
951 with the {\tt -or} flag to produce a new {\tt .trr} file containing the cosine and
952 sine of each dihedral angle in two coordinates, respectively. That is,
953 in the {\tt .trr} file you will have a series of numbers corresponding to:
954 cos($\phi_1$), sin($\phi_1$), cos($\phi_2$), sin($\phi_2$), ...,
955 cos($\phi_n$), sin($\phi_n$), and the array is padded with zeros, if
956 necessary. Then you can use this {\tt .trr} file as input for the {\tt
957 gmx covar} program and perform principal component analysis as usual.
958 For this to work you will need to generate a reference file ({\tt .tpr},
959 {\tt .gro}, {\tt .pdb} etc.) containing the same number of ``atoms''
960 as the new {\tt .trr} file, that is for $n$ dihedrals you need 2$n$/3 atoms
961 (rounded up if not an integer number).
962 You should use the {\tt -nofit} option for {\tt
963 gmx covar} since the coordinates in the dummy reference file do not
964 correspond in any way to the information in the {\tt .trr} file. Analysis of
965 the results is done using {\tt gmx anaeig}.
966 %} % Brace matches ifthenelse test for gmxlite
968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Hydrogen bonds
970 \section{Hydrogen bonds}
971 {\tt gmx hbond}\\
972 The program {\tt \normindex{gmx hbond}} analyzes the {\em hydrogen bonds} (H-bonds)
973 between all possible donors D and acceptors A. To determine if an
974 H-bond exists, a geometrical criterion is used, see also
975 \figref{hbond}:
976 \beq
977 \begin{array}{rclcl}
978 r & \leq & r_{HB} & = & 0.35~\mbox{nm} \\
979 \alpha & \leq & \alpha_{HB} & = & 30^o \\
980 \end{array}
981 \eeq
983 \begin{figure}
984 \centerline{\includegraphics[width=2.5cm,angle=270]{plots/hbond}}
985 \caption{Geometrical Hydrogen bond criterion.}
986 \label{fig:hbond}
987 \end{figure}
989 The value of $r_{HB} = 0.35$~nm corresponds to the first minimum of the RDF of
990 SPC water (see also \figref{rdf}).
992 The program {\tt gmx hbond} analyzes all hydrogen bonds existing
993 between two groups of atoms (which must be either identical or
994 non-overlapping) or in specified donor-hydrogen-acceptor triplets, in
995 the following ways:
997 \begin{figure}
998 \centerline{
999 {\includegraphics[width=5cm,angle=270]{plots/hbond-insert}}}
1000 \caption[Insertion of water into an H-bond.]{Insertion of water into
1001 an H-bond. (1) Normal H-bond between two residues. (2) H-bonding
1002 bridge via a water molecule.}
1003 \label{fig:insert}
1004 \end{figure}
1006 \begin{itemize}
1007 \item
1008 Donor-Acceptor distance ($r$) distribution of all H-bonds
1009 \item
1010 Hydrogen-Donor-Acceptor angle ($\alpha$) distribution of all H-bonds
1011 \item
1012 The total number of H-bonds in each time frame
1013 \item
1014 \newcommand{\nn}[1]{$n$-$n$+$#1$}
1015 The number of H-bonds in time between residues, divided into groups
1016 \nn{i} where $n$ and $n$+$i$ stand for residue numbers and $i$ goes
1017 from 0 to 6. The group for $i=6$ also includes all H-bonds for
1018 $i>6$. These groups include the \nn{3}, \nn{4} and \nn{5} H-bonds,
1019 which provide a measure for the formation of $\alpha$-helices or
1020 $\beta$-turns or strands.
1021 \item
1022 The lifetime of the H-bonds is calculated from the average over all
1023 autocorrelation functions of the existence functions (either 0 or 1)
1024 of all H-bonds:
1025 \beq
1026 C(\tau) ~=~ \langle s_i(t)~s_i (t + \tau) \rangle
1027 \label{eqn:hbcorr}
1028 \eeq
1029 with $s_i(t) = \{0,1\}$ for H-bond $i$ at time $t$. The integral of
1030 $C(\tau)$ gives a rough estimate of the average H-bond lifetime
1031 $\tau_{HB}$:
1032 \beq
1033 \tau_{HB} ~=~ \int_{0}^{\infty} C(\tau) d\tau
1034 \label{eqn:hblife}
1035 \eeq
1036 Both the integral and the complete autocorrelation function $C(\tau)$
1037 will be output, so that more sophisticated analysis ({\eg}\@ using
1038 multi-exponential fits) can be used to get better estimates for
1039 $\tau_{HB}$. A more complete analysis is given in ref.~\cite{Spoel2006b};
1040 one of the more fancy option is the Luzar and Chandler analysis
1041 of hydrogen bond kinetics~\cite{Luzar96b,Luzar2000a}.
1042 \item
1043 An H-bond existence map can be generated of dimensions {\em
1044 \#~H-bonds}$\times${\em \#~frames}. The ordering is identical to the index
1045 file (see below), but reversed, meaning that the last triplet in the index
1046 file corresponds to the first row of the existence map.
1047 \item
1048 Index groups are output containing the analyzed groups, all
1049 donor-hydrogen atom pairs and acceptor atoms in these groups,
1050 donor-hydrogen-acceptor triplets involved in hydrogen bonds between
1051 the analyzed groups and all solvent atoms involved in insertion.
1053 \end{itemize}
1055 %\ifthenelse{\equal{\gmxlite}{1}}{}{
1057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Protein related items
1059 \section{Protein-related items}
1060 {\tt gmx do_dssp, gmx rama, gmx wheel}\\
1061 To analyze structural changes of a protein, you can calculate the radius of
1062 gyration or the minimum residue distances over time
1063 (see \secref{rg}), or calculate the RMSD (\secref{rmsd}).
1065 You can also look at the changing of {\em secondary structure elements}
1066 during your run. For this, you can use the program {\tt \normindex{gmx do_dssp}}, which is
1067 an interface for the commercial program {\tt DSSP}~\cite{Kabsch83}. For
1068 further information, see the {\tt DSSP} manual. A typical output plot of
1069 {\tt gmx do_dssp} is given in \figref{dssp}.
1071 \begin{figure}
1072 \centerline{
1073 \includegraphics[width=12cm]{plots/dssp}}
1074 \caption{Analysis of the secondary structure elements of a peptide in time.}
1075 \label{fig:dssp}
1076 \end{figure}
1078 One other important analysis of proteins is the so-called
1079 {\em Ramachandran plot}.
1080 This is the projection of the structure on the two dihedral angles $\phi$ and
1081 $\psi$ of the protein backbone, see \figref{phipsi}.
1083 \begin{figure}
1084 \centerline{
1085 \includegraphics[width=5cm]{plots/phipsi}}
1086 \caption{Definition of the dihedral angles $\phi$ and $\psi$ of the protein backbone.}
1087 \label{fig:phipsi}
1088 \end{figure}
1090 To evaluate this Ramachandran plot you can use the program {\tt
1091 \normindex{gmx rama}}.
1092 A typical output is given in \figref{rama}.
1094 \begin{figure}
1095 \centerline{
1096 {\includegraphics[width=8cm]{plots/rama}}}
1097 \caption{Ramachandran plot of a small protein.}
1098 \label{fig:rama}
1099 \end{figure}
1101 When studying $\alpha$-helices
1102 it is useful to have a {\em helical wheel} projection
1103 of your peptide, to see whether a peptide is amphipathic. This can be done
1104 using the {\tt \normindex{gmx wheel}} program. Two examples are
1105 plotted in \figref{wheel}.
1107 \begin{figure}
1108 \centerline{\includegraphics[width=\htw]{plots/hpr-wheel}}
1109 \caption{Helical wheel projection of the N-terminal helix of HPr.}
1110 \label{fig:wheel}
1111 \end{figure}
1113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Membrane Related Items
1115 \section{Interface-related items}
1116 {\tt gmx order, gmx density, gmx potential, gmx traj}\\
1117 When simulating molecules with long carbon tails, it can be
1118 interesting to calculate their average orientation. There are several
1119 flavors of order parameters, most of which are related. The program
1120 {\tt \normindex{gmx order}} can calculate order parameters using the equation:
1122 \begin{equation}
1123 S_{z} = \frac{3}{2}\langle {\cos^2{\theta_z}} \rangle - \frac{1}{2}
1124 \label{eqn:Sgr}
1125 \end{equation}
1126 where $\theta_z$ is the angle between the $z$-axis of the simulation
1127 box and the molecular axis under consideration. The latter is defined as the
1128 vector from C$_{n-1}$ to C$_{n+1}$. The parameters $S_x$
1129 and $S_y$ are defined in the same way. The brackets imply averaging over time
1130 and molecules. Order parameters can vary between 1 (full order along
1131 the interface normal) and $-1/2$ (full order perpendicular to the
1132 normal), with a value of zero in the case of isotropic orientation.
1134 The program can do two things for you. It can calculate the order
1135 parameter for each CH$_2$ segment separately, for any of three axes,
1136 or it can divide the box in slices and calculate the average value of
1137 the order parameter per segment in one slice. The first method gives
1138 an idea of the ordering of a molecule from head to tail, the second
1139 method gives an idea of the ordering as function of the box length.
1141 The electrostatic potential ($\psi$) across the interface can be
1142 computed from a trajectory by evaluating the double integral of the
1143 charge density ($\rho(z)$):
1144 \beq
1145 \psi(z) - \psi(-\infty) = - \int_{-\infty}^z dz' \int_{-\infty}^{z'} \rho(z'')dz''/ \epsilon_0
1146 \label{eqn:elpotgr}
1147 \eeq
1148 where the position $z=-\infty$ is far enough in the bulk phase such that
1149 the field is zero. With this method, it is possible to ``split'' the
1150 total potential into separate contributions from lipid and water
1151 molecules. The program {\tt \normindex{gmx potential}} divides the box in slices and
1152 sums all charges of the atoms in each slice. It then integrates this
1153 charge density to give the electric field, which is in turn integrated to
1154 give the potential. Charge density, electric field, and potential are written
1155 to {\tt xvgr} input files.
1157 The program {\tt \normindex{gmx traj}} is a very simple analysis program. All it
1158 does is print the coordinates, velocities, or forces of selected atoms.
1159 It can also calculate the center of mass of one or more
1160 molecules and print the coordinates of the center of mass to three
1161 files. By itself, this is probably not a very useful analysis, but
1162 having the coordinates of selected molecules or atoms can be very
1163 handy for further analysis, not only in interfacial systems.
1165 The program {\tt \normindex{gmx density}} calculates the mass density of
1166 groups and gives a plot of the density against a box
1167 axis. This is useful for looking at the distribution of groups or
1168 atoms across the interface.
1170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Chemical shifts
1172 % \section{Chemical shifts}
1173 % {\tt total, do_shift}\\
1174 % You can compute the NMR chemical shifts of protons with the program
1175 % {\tt \normindex{do_shift}}. This is just an {\gromacs} interface to
1176 % the public domain program {\tt total}~\cite{Williamson93a}. For
1177 % further information, read the article. Although there is limited
1178 % support for this in {\gromacs}, users are encouraged to use the
1179 % software provided by David Case's group at Scripps because it seems
1180 % to be more up-to-date.
1182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1183 %} % Brace matches ifthenelse test for gmxlite
1185 % LocalWords: Xmgr ndx mk angndx rdf dihedrals grompp hydrogens MainChain Prot
1186 % LocalWords: oxygens SideChain tryptophan vsitetop aminoacids dat ngmx dr SPC
1187 % LocalWords: OO ACF fg xmgr corrmd ACFs kM iM FFT th NMR nd corrleg rotacf dt
1188 % LocalWords: velacc Kubo msd Tildesley corrtime msdwater sgangle cis dih xpm
1189 % LocalWords: mindist mdmat rms rmsdist rmsd jj diag eigenvectors covar anaeig
1190 % LocalWords: macromolecule trr tpr gro pdb nofit hbond rclcl HB multi Luzar
1191 % LocalWords: dssp rama xrama rg Ramachandran phipsi amphipathic HPr xvgr pvd
1192 % LocalWords: Scripps RDF online usinggroups mdrun groupconcept HOH
1193 % LocalWords: residuetypes determinding OpenGL traj ov rcl ij ps nm
1194 % LocalWords: autocorrelation interfacial pairdist