Optimized the bonded thread force reduction
[gromacs/AngularHB.git] / docs / manual / defunits.tex
blob3ee35f46375a56594e7cca6e76c63875dc4153a7
2 % This file is part of the GROMACS molecular simulation package.
4 % Copyright (c) 2013,2014,2015, 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(73) \times 10^{-27}$ kg \\
82 time & t & ps $= 10^{-12}$ s \\
83 charge & q & {\it e} $=$ elementary charge $=
84 1.602\,176\,565(35)\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}. Numbers in parentheses give accuracy.}
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$ & kJ~mol$^{-1}$~nm$^{-3} =
105 10^{30}/N_{AV}$~Pa \\
106 & & $1.660\,538\,921\times 10^6$~Pa $=
107 16.605\,389\,21$~bar \\
108 velocity & $v$ & nm~ps$^{-1} = 1000$ m s$^{-1}$ \\
109 dipole moment & $\mu$ & \emph{e}~nm \\
110 electric potential& $\Phi$ & kJ~mol$^{-1}$~\emph{e}$^{-1} =
111 0.010\,364\,269\,19(32)$ Volt \\
112 electric field & $E$ & kJ~mol$^{-1}$~nm$^{-1}$~\emph{e}$^{-1} =
113 1.036\,426\,919(32) \times 10^7$~V m$^{-1}$ \\
114 \dline
115 \end{tabular}
117 \caption{Derived units}
118 \label{tab:derivedunits}
119 \end{table}
121 The {\bf electric conversion factor} $f=\frac{1}{4 \pi
122 \varepsilon_o}=138.935\,457\,8(39)$ kJ~mol$^{-1}$~nm~e$^{-2}$. It relates
123 the mechanical quantities to the electrical quantities as in
124 \beq
125 V = f \frac{q^2}{r} \mbox{\ \ or\ \ } F = f \frac{q^2}{r^2}
126 \eeq
128 Electric potentials $\Phi$ and electric fields $\ve{E}$ are
129 intermediate quantities in the calculation of energies and
130 forces. They do not occur inside {\gromacs}. If they are used in
131 evaluations, there is a choice of equations and related units. We
132 strongly recommend following the usual practice of including the factor
133 $f$ in expressions that evaluate $\Phi$ and $\ve{E}$:
134 \bea
135 \Phi(\ve{r}) = f \sum_j \frac{q_j}{|\ve{r}-\ve{r}_j|} \\
136 \ve{E}(\ve{r}) = f \sum_j q_j \frac{(\ve{r}-\ve{r}_j)}{|\ve{r}-\ve{r}_j|^3}
137 \eea
138 With these definitions, $q\Phi$ is an energy and $q\ve{E}$ is a
139 force. The units are those given in \tabref{derivedunits}:
140 about 10 mV for potential. Thus, the potential of an electronic charge
141 at a distance of 1 nm equals $f \approx 140$ units $\approx
142 1.4$~V. (exact value: $1.439\,964\,5$ V)
144 {\bf Note} that these units are mutually consistent; changing any of the
145 units is likely to produce inconsistencies and is therefore {\em
146 strongly discouraged\/}! In particular: if \AA \ are used instead of
147 nm, the unit of time changes to 0.1 ps. If kcal mol$^{-1}$ (= 4.184
148 kJ mol$^{-1}$) is used instead of kJ mol$^{-1}$ for energy, the unit of time becomes
149 0.488882 ps and the unit of temperature changes to 4.184 K. But in
150 both cases all electrical energies go wrong, because they will still
151 be computed in kJ mol$^{-1}$, expecting nm as the unit of length. Although
152 careful rescaling of charges may still yield consistency, it is clear
153 that such confusions must be rigidly avoided.
155 In terms of the MD units, the usual physical constants take on
156 different values (see \tabref{consts}). All quantities are per mol rather than per
157 molecule. There is no distinction between Boltzmann's constant $k$ and
158 the gas constant $R$: their value is
159 $0.008\,314\,462\,1$~kJ~mol$^{-1}$~K$^{-1}$.
160 \begin{table}
161 \centerline{
162 \begin{tabular}{|c|l|l|}
163 \dline
164 Symbol & Name & Value \\
165 \hline
166 $N_{AV}$& Avogadro's number & $6.022\,141\,29(27)\times 10^{23}$ mol$^{-1}$ \\
167 $R$ & gas constant & $8.314\,462\,1(75)\times 10^{-3}$~kJ~mol$^{-1}$~K$^{-1}$ \\
168 $k_B$ & Boltzmann's constant & \emph{idem} \\
169 $h$ & Planck's constant & $0.399\,031\,271(17)$~kJ~mol$^{-1}$~ps \\
170 $\hbar$ & Dirac's constant & $0.063\,507\,799\,3(28)$~kJ~mol$^{-1}$~ps \\
171 $c$ & velocity of light & $299\,792.458$~nm~ps$^{-1}$ \\
172 \dline
173 \end{tabular}
175 \caption{Some Physical Constants}
176 \label{tab:consts}
177 \end{table}
179 \section{Reduced units\index{reduced units}}
180 When simulating Lennard-Jones (LJ) systems, it might be advantageous to
181 use reduced units ({\ie}, setting
182 $\epsilon_{ii}=\sigma_{ii}=m_i=k_B=1$ for one type of atoms). This is
183 possible. When specifying the input in reduced units, the output will
184 also be in reduced units. The one exception is the {\em
185 temperature}, which is expressed in $0.008\,314\,462\,1$ reduced
186 units. This is a consequence of using Boltzmann's constant in the
187 evaluation of temperature in the code. Thus not $T$, but $k_BT$, is the
188 reduced temperature. A {\gromacs} temperature $T=1$ means a reduced
189 temperature of $0.008\ldots$ units; if a reduced temperature of 1 is
190 required, the {\gromacs} temperature should be $120.272\,36$.
192 In \tabref{reduced} quantities are given for LJ potentials:
193 \beq
194 V_{LJ} = 4\epsilon \left[ \left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6} \right]
195 \eeq
197 \begin{table}
198 \centerline{
199 \begin{tabular}{|l|c|l|}
200 \dline
201 Quantity & Symbol & Relation to SI \\
202 \hline
203 Length & r$^*$ & r $\sigma^{-1}$ \\
204 Mass & m$^*$ & m M$^{-1}$ \\
205 Time & t$^*$ & t $\sigma^{-1}$ $\sqrt{\epsilon/M}$ \\
206 Temperature & T$^*$ & k$_B$T $\epsilon^{-1}$ \\
207 Energy & E$^*$ & E $\epsilon^{-1}$ \\
208 Force & F$^*$ & F $\sigma~\epsilon^{-1}$ \\
209 Pressure & P$^*$ & P $\sigma ^3 \epsilon^{-1}$ \\
210 Velocity & v$^*$ & v $\sqrt{M/\epsilon}$ \\
211 Density & $\rho^*$ & N $\sigma ^3~V^{-1}$ \\
212 \dline
213 \end{tabular}
215 \caption{Reduced Lennard-Jones quantities}
216 \label{tab:reduced}
217 \end{table}
220 \section{Mixed or Double precision}
221 {\gromacs} can be compiled in either mixed\index{mixed
222 precision|see{precision, mixed}}\index{precision, mixed} or
223 \pawsindex{double}{precision}. Documentation of previous {\gromacs}
224 versions referred to ``single precision'', but the implementation
225 has made selective use of double precision for many years.
226 Using single precision
227 for all variables would lead to a significant reduction in accuracy.
228 Although in ``mixed precision'' all state vectors, i.e. particle coordinates,
229 velocities and forces, are stored in single precision, critical variables
230 are double precision. A typical example of the latter is the virial,
231 which is a sum over all forces in the system, which have varying signs.
232 In addition, in many parts of the code we managed to avoid double precision
233 for arithmetic, by paying attention to summation order or reorganization
234 of mathematical expressions. The default configuration uses mixed precision,
235 but it is easy to turn on double precision by adding the option
236 {\tt -DGMX_DOUBLE=on} to {\tt cmake}. Double precision
237 will be 20 to 100\% slower than mixed precision depending on the
238 architecture you are running on. Double precision will use somewhat
239 more memory and run input, energy and full-precision trajectory files
240 will be almost twice as large.
242 The energies in mixed precision are accurate up to the last decimal,
243 the last one or two decimals of the forces are non-significant.
244 The virial is less accurate than the forces, since the virial is only one
245 order of magnitude larger than the size of each element in the sum over
246 all atoms (\secref{virial}).
247 In most cases this is not really a problem, since the fluctuations in the
248 virial can be two orders of magnitude larger than the average.
249 Using cut-offs for the Coulomb interactions cause large errors
250 in the energies, forces, and virial.
251 Even when using a reaction-field or lattice sum method, the errors
252 are larger than, or comparable to, the errors due to the partial use of
253 single precision.
254 Since MD is chaotic, trajectories with very similar starting conditions will
255 diverge rapidly, the divergence is faster in mixed precision than in double
256 precision.
258 For most simulations, mixed precision is accurate enough.
259 In some cases double precision is required to get reasonable results:
260 \begin{itemize}
261 \item normal mode analysis,
262 for the conjugate gradient or l-bfgs minimization and the calculation and
263 diagonalization of the Hessian
264 \item long-term energy conservation, especially for large systems
265 \end{itemize}
268 % LocalWords: ij basicunits derivedunits kJ mol mV kcal consts LJ BT
269 % LocalWords: nm ps