Updated cool quotes
[gromacs.git] / docs / manual / defunits.tex
blob13f8bb8b5e354c2a9868ea06c5cf6ffecdd95723
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{Definitions and Units}
36 \label{ch:defunits}
37 \section{Notation}
38 The following conventions for mathematical typesetting
39 are used throughout this document:
41 \centerline{
42 \begin{tabular}{l|l|c}
43 Item & Notation & Example \\
44 \hline
45 Vector & Bold italic & $\rvi$ \\
46 Vector Length & Italic & $r_i$ \\
47 \end{tabular}
50 We define the {\em lowercase} subscripts
51 $i$, $j$, $k$ and $l$ to denote particles:
52 $\rvi$ is the {\em position vector} of particle $i$, and using this
53 notation:
54 \bea
55 \rvij = \rvj-\rvi \\
56 \rij = | \rvij |
57 \eea
58 The force on particle $i$ is denoted by $\ve{F}_i$ and
59 \beq
60 \ve{F}_{ij} = \mbox{force on $i$ exerted by $j$}
61 \eeq
62 Please note that we changed notation as of version 2.0 to $\rvij=\rvj-\rvi$ since this
63 is the notation commonly used. If you encounter an error, let us know.
65 \section{\normindex{MD units}\index{units}}
66 {\gromacs} uses a consistent set of units that produce values in the
67 vicinity of unity for most relevant molecular quantities. Let us call
68 them {\em MD units}. The basic units in this system are nm, ps, K,
69 electron charge (e) and atomic mass unit (u), see
70 \tabref{basicunits}. The values used in {\gromacs} are taken from the
71 CODATA Internationally recommended 2010 values of
72 fundamental physical constants (see \verb+http://nist.gov+).
73 \begin{table}
74 \centerline{
75 \begin{tabular}{|l|c|l|}
76 \dline
77 Quantity & Symbol& Unit \\
78 \hline
79 length & r & nm $= 10^{-9}$ m \\
80 mass & m & u (unified atomic mass unit) $=$
81 $1.660\,538\,921 \times 10^{-27}$ kg \\
82 time & t & ps $= 10^{-12}$ s \\
83 charge & q & {\it e} $=$ elementary charge $=
84 1.602\,176\,565(\times 10^{-19}$ C \\
85 temperature & T & K \\
86 \dline
87 \end{tabular}
89 \caption[Basic units used in {\gromacs}.]{Basic units used in
90 {\gromacs}.}
91 \label{tab:basicunits}
92 \end{table}
94 Consistent with these units are a set of derived units, given in
95 \tabref{derivedunits}.
96 \begin{table}
97 \centerline{
98 \begin{tabular}{|l|c|l|}
99 \dline
100 Quantity & Symbol & Unit \\
101 \hline
102 energy & $E,V$ & kJ~mol$^{-1}$ \\
103 Force & $\ve{F}$ & kJ~mol$^{-1}$~nm$^{-1}$ \\
104 pressure & $p$ & bar \\
105 velocity & $v$ & nm~ps$^{-1} = 1000$ m s$^{-1}$ \\
106 dipole moment & $\mu$ & \emph{e}~nm \\
107 electric potential& $\Phi$ & kJ~mol$^{-1}$~\emph{e}$^{-1} =
108 0.010\,364\,269\,19$ Volt \\
109 electric field & $E$ & kJ~mol$^{-1}$~nm$^{-1}$~\emph{e}$^{-1} =
110 1.036\,426\,919 \times 10^7$~V m$^{-1}$ \\
111 \dline
112 \end{tabular}
114 \caption{Derived units. Note that an additional conversion factor of 10$^{28}$ a.m.u ($\approx$16.6)
115 is applied to get bar instead of internal MD units in the energy and
116 log files.}
117 \label{tab:derivedunits}
118 \end{table}
120 The {\bf electric conversion factor} $f=\frac{1}{4 \pi
121 \varepsilon_o}=\electricConvFactorValue$ kJ~mol$^{-1}$~nm~e$^{-2}$. It relates
122 the mechanical quantities to the electrical quantities as in
123 \beq
124 V = f \frac{q^2}{r} \mbox{\ \ or\ \ } F = f \frac{q^2}{r^2}
125 \eeq
127 Electric potentials $\Phi$ and electric fields $\ve{E}$ are
128 intermediate quantities in the calculation of energies and
129 forces. They do not occur inside {\gromacs}. If they are used in
130 evaluations, there is a choice of equations and related units. We
131 strongly recommend following the usual practice of including the factor
132 $f$ in expressions that evaluate $\Phi$ and $\ve{E}$:
133 \bea
134 \Phi(\ve{r}) = f \sum_j \frac{q_j}{|\ve{r}-\ve{r}_j|} \\
135 \ve{E}(\ve{r}) = f \sum_j q_j \frac{(\ve{r}-\ve{r}_j)}{|\ve{r}-\ve{r}_j|^3}
136 \eea
137 With these definitions, $q\Phi$ is an energy and $q\ve{E}$ is a
138 force. The units are those given in \tabref{derivedunits}:
139 about 10 mV for potential. Thus, the potential of an electronic charge
140 at a distance of 1 nm equals $f \approx 140$ units $\approx
141 1.4$~V. (exact value: $1.439\,964\,5$ V)
143 {\bf Note} that these units are mutually consistent; changing any of the
144 units is likely to produce inconsistencies and is therefore {\em
145 strongly discouraged\/}! In particular: if \AA \ are used instead of
146 nm, the unit of time changes to 0.1 ps. If kcal mol$^{-1}$ (= 4.184
147 kJ mol$^{-1}$) is used instead of kJ mol$^{-1}$ for energy, the unit of time becomes
148 0.488882 ps and the unit of temperature changes to 4.184 K. But in
149 both cases all electrical energies go wrong, because they will still
150 be computed in kJ mol$^{-1}$, expecting nm as the unit of length. Although
151 careful rescaling of charges may still yield consistency, it is clear
152 that such confusions must be rigidly avoided.
154 In terms of the MD units, the usual physical constants take on
155 different values (see \tabref{consts}). All quantities are per mol rather than per
156 molecule. There is no distinction between Boltzmann's constant $k$ and
157 the gas constant $R$: their value is
158 $0.008\,314\,462\,1$~kJ~mol$^{-1}$~K$^{-1}$.
159 \begin{table}
160 \centerline{
161 \begin{tabular}{|c|l|l|}
162 \dline
163 Symbol & Name & Value \\
164 \hline
165 $N_{AV}$& Avogadro's number & $6.022\,141\,29\times 10^{23}$ mol$^{-1}$ \\
166 $R$ & gas constant & $8.314\,462\,1\times 10^{-3}$~kJ~mol$^{-1}$~K$^{-1}$ \\
167 $k_B$ & Boltzmann's constant & \emph{idem} \\
168 $h$ & Planck's constant & $0.399\,031\,271$~kJ~mol$^{-1}$~ps \\
169 $\hbar$ & Dirac's constant & $0.063\,507\,799\,3$~kJ~mol$^{-1}$~ps \\
170 $c$ & velocity of light & $299\,792.458$~nm~ps$^{-1}$ \\
171 \dline
172 \end{tabular}
174 \caption{Some Physical Constants}
175 \label{tab:consts}
176 \end{table}
178 \section{Reduced units\index{reduced units}}
179 When simulating Lennard-Jones (LJ) systems, it might be advantageous to
180 use reduced units ({\ie}, setting
181 $\epsilon_{ii}=\sigma_{ii}=m_i=k_B=1$ for one type of atoms). This is
182 possible. When specifying the input in reduced units, the output will
183 also be in reduced units. The one exception is the {\em
184 temperature}, which is expressed in $0.008\,314\,462\,1$ reduced
185 units. This is a consequence of using Boltzmann's constant in the
186 evaluation of temperature in the code. Thus not $T$, but $k_BT$, is the
187 reduced temperature. A {\gromacs} temperature $T=1$ means a reduced
188 temperature of $0.008\ldots$ units; if a reduced temperature of 1 is
189 required, the {\gromacs} temperature should be $120.272\,36$.
191 In \tabref{reduced} quantities are given for LJ potentials:
192 \beq
193 V_{LJ} = 4\epsilon \left[ \left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6} \right]
194 \eeq
196 \begin{table}
197 \centerline{
198 \begin{tabular}{|l|c|l|}
199 \dline
200 Quantity & Symbol & Relation to SI \\
201 \hline
202 Length & r$^*$ & r $\sigma^{-1}$ \\
203 Mass & m$^*$ & m M$^{-1}$ \\
204 Time & t$^*$ & t $\sigma^{-1}$ $\sqrt{\epsilon/M}$ \\
205 Temperature & T$^*$ & k$_B$T $\epsilon^{-1}$ \\
206 Energy & E$^*$ & E $\epsilon^{-1}$ \\
207 Force & F$^*$ & F $\sigma~\epsilon^{-1}$ \\
208 Pressure & P$^*$ & P $\sigma ^3 \epsilon^{-1}$ \\
209 Velocity & v$^*$ & v $\sqrt{M/\epsilon}$ \\
210 Density & $\rho^*$ & N $\sigma ^3~V^{-1}$ \\
211 \dline
212 \end{tabular}
214 \caption{Reduced Lennard-Jones quantities}
215 \label{tab:reduced}
216 \end{table}
219 \section{Mixed or Double precision}
220 {\gromacs} can be compiled in either mixed\index{mixed
221 precision|see{precision, mixed}}\index{precision, mixed} or
222 \pawsindex{double}{precision}. Documentation of previous {\gromacs}
223 versions referred to ``single precision'', but the implementation
224 has made selective use of double precision for many years.
225 Using single precision
226 for all variables would lead to a significant reduction in accuracy.
227 Although in ``mixed precision'' all state vectors, i.e. particle coordinates,
228 velocities and forces, are stored in single precision, critical variables
229 are double precision. A typical example of the latter is the virial,
230 which is a sum over all forces in the system, which have varying signs.
231 In addition, in many parts of the code we managed to avoid double precision
232 for arithmetic, by paying attention to summation order or reorganization
233 of mathematical expressions. The default configuration uses mixed precision,
234 but it is easy to turn on double precision by adding the option
235 {\tt -DGMX_DOUBLE=on} to {\tt cmake}. Double precision
236 will be 20 to 100\% slower than mixed precision depending on the
237 architecture you are running on. Double precision will use somewhat
238 more memory and run input, energy and full-precision trajectory files
239 will be almost twice as large.
241 The energies in mixed precision are accurate up to the last decimal,
242 the last one or two decimals of the forces are non-significant.
243 The virial is less accurate than the forces, since the virial is only one
244 order of magnitude larger than the size of each element in the sum over
245 all atoms (\secref{virial}).
246 In most cases this is not really a problem, since the fluctuations in the
247 virial can be two orders of magnitude larger than the average.
248 Using cut-offs for the Coulomb interactions cause large errors
249 in the energies, forces, and virial.
250 Even when using a reaction-field or lattice sum method, the errors
251 are larger than, or comparable to, the errors due to the partial use of
252 single precision.
253 Since MD is chaotic, trajectories with very similar starting conditions will
254 diverge rapidly, the divergence is faster in mixed precision than in double
255 precision.
257 For most simulations, mixed precision is accurate enough.
258 In some cases double precision is required to get reasonable results:
259 \begin{itemize}
260 \item normal mode analysis,
261 for the conjugate gradient or l-bfgs minimization and the calculation and
262 diagonalization of the Hessian
263 \item long-term energy conservation, especially for large systems
264 \end{itemize}
267 % LocalWords: ij basicunits derivedunits kJ mol mV kcal consts LJ BT
268 % LocalWords: nm ps