Free topology in non-DD simulations
[gromacs.git] / docs / reference-manual / definitions.rst
blobdc2ee05ad6c740d84c1a46fa49f9020dfbbc6140
1 .. _defunits:
3 Definitions and Units
4 =====================
6 Notation
7 --------
9 The following conventions for mathematical typesetting are used
10 throughout this document:
12 .. |vecex| replace:: :math:`{\mathbf{r}_i}`
13 .. |lenex| replace:: :math:`r_i`
15 .. table:: 
16     :align: center
17     :widths: auto
19     +---------------+-------------+---------+
20     | Item          | Notation    | Example |
21     +===============+=============+=========+
22     | Vector        | Bold italic | |vecex| |
23     +---------------+-------------+---------+
24     | Vector Length | Italic      | |lenex| |
25     +---------------+-------------+---------+
27 We define the *lowercase* subscripts :math:`i`, :math:`j`, :math:`k` and
28 :math:`l` to denote particles: :math:`\mathbf{r}_i` is the
29 *position vector* of particle :math:`i`, and using this notation:
31 .. math:: \begin{aligned}
32           \mathbf{r}_{ij}       =       \mathbf{r}_j-\mathbf{r}_i\\
33           r_{ij}=       | \mathbf{r}_{ij} | \end{aligned}
34           :label: eqnnotation
36 The force on particle :math:`i` is denoted by
37 :math:`\mathbf{F}_i` and
39 .. math:: \mathbf{F}_{ij} = \mbox{force on $i$ exerted by $j$}
40           :label: eqbforcenotation
42 MD units
43 --------
45 |Gromacs| uses a consistent set of units that produce values in the
46 vicinity of unity for most relevant molecular quantities. Let us call
47 them *MD units*. The basic units in this system are nm, ps, K, electron
48 charge (e) and atomic mass unit (u), see :numref:`Table %s <table-basicunits>`
49 The values used in |Gromacs| are
50 taken from the CODATA Internationally recommended 2010 values of
51 fundamental physical constants (see `NIST homepage <http://nist.gov>`__). 
53 .. |tnm| replace:: :math:`\mathrm{nm = }10^{-9}\ m`
54 .. |tu1| replace:: u (unified atomic mass unit) =
55 .. |tu2| replace:: :math:`1.660\,538\,921 \times 10^{-27}\ kg`
56 .. |tti| replace:: :math:`\mathrm{ps = }10^{-12}\ s`
57 .. |tc1| replace:: *e* = elementary charge =
58 .. |tc2| replace:: :math:`1.602\,176\,565 \times 10^{-19}\ C`
59 .. |tte| replace:: K 
61 .. _table-basicunits:
63 .. table:: Basic units used in |Gromacs|
64     :align: center
65     :widths: auto
67     +--------------+--------+-------+
68     | Quantity     | Symbol | Unit  |
69     +==============+========+=======+
70     | length       |     r  | |tnm| |
71     +--------------+--------+-------+
72     | mass         |     m  | |tu1| |
73     |              |        | |tu2| |
74     +--------------+--------+-------+
75     | time         |     t  | |tti| |
76     +--------------+--------+-------+
77     | charge       |     q  | |tc1| |
78     |              |        | |tc2| |
79     +--------------+--------+-------+
80     | temperature  |     T  | |tte| |
81     +--------------+--------+-------+
86 Consistent
87 with these units are a set of derived units, given in
88 :numref:`Table %s <table-derivedunits>`
90 .. |tse|  replace:: :math:`E,V`
91 .. |tsf|  replace:: :math:`\mathbf{F}`
92 .. |tsp|  replace:: :math:`p`
93 .. |tsv|  replace:: :math:`v`
94 .. |tsd|  replace:: :math:`\mu`
95 .. |tsep| replace:: :math:`\Phi`
96 .. |tsef| replace:: :math:`E`
97 .. |tdue|   replace:: :math:`\mathrm{kJ~mol}^{-1}`
98 .. |tduf|   replace:: :math:`\mathrm{kJ~mol}^{-1}~\mathrm{nm}^{-1}`
99 .. |tdup|   replace:: bar
100 .. |tduv|   replace:: :math:`\mathrm{nm~ps}^{-1} = 1000\mathrm{~m~s}^{-1}`
101 .. |tdud|   replace:: :math:`\mathrm{e\ nm}`
102 .. |tduep1| replace:: :math:`\mathrm{kJ~mol}^{-1}\mathrm{~e}^{-1} =`
103 .. |tduep2| replace:: :math:`0.010\,364\,269\,19` Volt
104 .. |tduef1| replace:: :math:`\mathrm{kJ~mol}^{-1}\mathrm{~nm}^{-1}\ \mathrm{e}^{-1} =`
105 .. |tduef2| replace:: :math:`1.036\,426\,919 \times 10^7\mathrm{~V m}^{-1}`
107 .. _table-derivedunits:
109 .. table::
110     Derived units. Note that an additional conversion factor of 10\ :math:`^{28}` a.m.u (\ :math:`\approx` 16.6)
111     is applied to get bar instead of internal MD units in the energy and
112     log files
113     :align: center
114     :widths: auto
116     +--------------------+--------+----------+
117     | Quantity           | Symbol | Unit     |
118     +====================+========+==========+
119     | energy             | |tse|  | |tdue|   |
120     +--------------------+--------+----------+
121     | Force              | |tsf|  | |tduf|   |
122     +--------------------+--------+----------+
123     | pressure           | |tsp|  | |tdup|   |
124     +--------------------+--------+----------+
125     | velocity           | |tsv|  | |tduv|   |
126     +--------------------+--------+----------+
127     | dipole moment      | |tsd|  | |tdud|   |
128     +--------------------+--------+----------+
129     | electric potential | |tsep| | |tduep1| |
130     |                    |        | |tduep2| |
131     +--------------------+--------+----------+
132     | electric field     | |tsef| | |tduef1| |
133     |                    |        | |tduef2| |
134     +--------------------+--------+----------+
137 The **electric conversion factor**
138 :math:`f=\frac{1}{4 \pi \varepsilon_o}={138.935\,458}`
139 :math:`\mathrm{kJ}~\mathrm{mol}^{-1}\mathrm{nm}~\mathrm{ e}^{-2}`.
140 It relates the mechanical quantities to the electrical quantities as in
142 .. math:: V = f \frac{q^2}{r} \mbox{\ \ or\ \ } F = f \frac{q^2}{r^2}
143           :label: eqnelecconv
145 Electric potentials :math:`\Phi` and electric fields
146 :math:`\mathbf{E}` are intermediate quantities in the
147 calculation of energies and forces. They do not occur inside |Gromacs|. If
148 they are used in evaluations, there is a choice of equations and related
149 units. We strongly recommend following the usual practice of including
150 the factor :math:`f` in expressions that evaluate :math:`\Phi` and
151 :math:`\mathbf{E}`:
153 .. math:: \begin{aligned}
154           \Phi(\mathbf{r}) = f \sum_j \frac{q_j}{| \mathbf{r}-\mathbf{r}_j | }  \\
155           \mathbf{E}(\mathbf{r}) = f \sum_j q_j \frac{(\mathbf{r}-\mathbf{r}_j)}{| \mathbf{r}-\mathbf{r}_j| ^3}\end{aligned}
156           :label: eqnelecfacinclude
158 With these definitions, :math:`q\Phi` is an energy and
159 :math:`q\mathbf{E}` is a force. The units are those given
160 in :numref:`Table %s <table-derivedunits>`
161 about 10 mV for potential.
162 Thus, the potential of an electronic charge at a distance of 1 nm equals
163 :math:`f \approx 140` units :math:`\approx 1.4` V.
164 (exact value: :math:`1.439\,964\,5` V)
166 **Note** that these units are mutually consistent; changing any of the
167 units is likely to produce inconsistencies and is therefore *strongly
168 discouraged*! In particular: if Å are used instead of nm, the unit of
169 time changes to 0.1 ps. If :math:`\mathrm{kcal}~\mathrm{mol}^{-1}` (= 4.184
170 :math:`\mathrm{kJ~mol}^{-1}`) is used instead of :math:`\mathrm{kJ~mol}^{-1}` for energy,
171 the unit of time becomes 0.488882 ps and the unit of temperature changes
172 to 4.184 K. But in both cases all electrical energies go wrong, because
173 they will still be computed in :math:`\mathrm{kJ~mol}^{-1}`, expecting nm as
174 the unit of length. Although careful rescaling of charges may still
175 yield consistency, it is clear that such confusions must be rigidly
176 avoided.
178 In terms of the MD units, the usual physical constants take on different
179 values (see :numref:`Table %s <table-consts>`). All quantities are per
180 mol rather than per molecule. There is no distinction between
181 Boltzmann’s constant :math:`k` and the gas constant :math:`R`: their
182 value is :math:`0.008\,314\,462\,1\mathrm{kJ~mol}^{-1} \mathrm{K}^{-1}`.
184 .. _table-consts:
186 .. table:: 
187     Some Physical Constants
188     :align: center
189     :widths: auto
191     +----------------+----------------------+--------------------------------------------------------------------------+
192     | Symbol         | Name                 | Value                                                                    |
193     +================+======================+==========================================================================+
194     | :math:`N_{AV}` | Avogadro's number    | :math:`6.022\,141\,29\times 10^{23}~\mathrm{mol}^{-1}`                   |
195     +----------------+----------------------+--------------------------------------------------------------------------+
196     | :math:`R`      | gas constant         | :math:`8.314\,462\,1\times 10^{-3}~\mathrm{kJ~mol}^{-1}~\mathrm{K}^{-1}` |
197     +----------------+----------------------+--------------------------------------------------------------------------+
198     | :math:`k_B`    | Boltzmann's constant | *idem*                                                                   |
199     +----------------+----------------------+--------------------------------------------------------------------------+
200     | :math:`h`      | Planck's constant    | :math:`0.399\,031\,271~\mathrm{kJ~mol}^{-1}~\mathrm{ps}`                 |
201     +----------------+----------------------+--------------------------------------------------------------------------+
202     | :math:`\hbar`  | Dirac's constant     | :math:`0.063\,507\,799\,3~\mathrm{kJ~mol}^{-1}~\mathrm{ps}`              |
203     +----------------+----------------------+--------------------------------------------------------------------------+
204     | :math:`c`      | velocity of light    | :math:`299\,792.458~\mathrm{nm~ps}^{-1}`                                 |
205     +----------------+----------------------+--------------------------------------------------------------------------+
209 Reduced units
210 -------------
212 When simulating Lennard-Jones (LJ) systems, it might be advantageous to
213 use reduced units (*i.e.*, setting
214 :math:`\epsilon_{ii}=\sigma_{ii}=m_i=k_B=1` for one type of atoms). This
215 is possible. When specifying the input in reduced units, the output will
216 also be in reduced units. The one exception is the *temperature*, which
217 is expressed in :math:`0.008\,314\,462\,1` reduced units. This is a
218 consequence of using Boltzmann’s constant in the evaluation of
219 temperature in the code. Thus not :math:`T`, but :math:`k_BT`, is the
220 reduced temperature. A |Gromacs| temperature :math:`T=1` means a reduced
221 temperature of :math:`0.008\ldots` units; if a reduced temperature of 1
222 is required, the |Gromacs| temperature should be :math:`120.272\,36`.
224 In :numref:`Table %s <table-reduced>` quantities are given for LJ
225 potentials:
227 .. math:: V_{LJ} = 4\epsilon \left[ \left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6} \right]
228           :label: eqnbaseljpotentials
230 .. _table-reduced:
232 .. table:: 
233     Reduced Lennard-Jones quantities
234     :align: center
235     :widths: auto
237     +-------------+----------------+------------------------------------------+
238     | Quantity    | Symbol         | Relation to SI                           |
239     +=============+================+==========================================+
240     | Length      | r\ :math:`^*`  | r\ :math:`\sigma^{-1}`                   |
241     +-------------+----------------+------------------------------------------+
242     | Mass        | m\ :math:`^*`  | m M\ :math:`^{-1}`                       |
243     +-------------+----------------+------------------------------------------+
244     | Time        | t\ :math:`^*`  | t\ :math:`\sigma^{-1}~\sqrt{\epsilon/M}` |
245     +-------------+----------------+------------------------------------------+
246     | Temperature | T\ :math:`^*`  | k\ :math:`_B\mathrm{T}~\epsilon^{-1}`    |
247     +-------------+----------------+------------------------------------------+
248     | Energy      | E\ :math:`^*`  | E\ :math:`\epsilon^{-1}`                 |
249     +-------------+----------------+------------------------------------------+
250     | Force       | F\ :math:`^*`  | F\ :math:`\sigma~\epsilon^{-1}`          |
251     +-------------+----------------+------------------------------------------+
252     | Pressure    | P\ :math:`^*`  | P\ :math:`\sigma ^3 \epsilon^{-1}`       |
253     +-------------+----------------+------------------------------------------+
254     | Velocity    | v\ :math:`^*`  | v\ :math:`\sqrt{M/\epsilon}`             |
255     +-------------+----------------+------------------------------------------+
256     | Density     | :math:`\rho^*` | N\ :math:`\sigma ^3~V^{-1}`              |
257     +-------------+----------------+------------------------------------------+
262 Mixed or Double precision
263 -------------------------
265 |Gromacs| can be compiled in either mixed or double precision.
266 Documentation of previous |Gromacs| versions referred to *single
267 precision*, but the implementation has made selective use of double
268 precision for many years. Using single precision for all variables would
269 lead to a significant reduction in accuracy. Although in *mixed
270 precision* all state vectors, i.e. particle coordinates, velocities and
271 forces, are stored in single precision, critical variables are double
272 precision. A typical example of the latter is the virial, which is a sum
273 over all forces in the system, which have varying signs. In addition, in
274 many parts of the code we managed to avoid double precision for
275 arithmetic, by paying attention to summation order or reorganization of
276 mathematical expressions. The default configuration uses mixed
277 precision, but it is easy to turn on double precision by adding the
278 option ``-DGMX\_DOUBLE=on`` to ``cmake``. Double precision will be 20 to 100%
279 slower than mixed precision depending on the architecture you are
280 running on. Double precision will use somewhat more memory and run
281 input, energy and full-precision trajectory files will be almost twice
282 as large.
284 The energies in mixed precision are accurate up to the last decimal, the
285 last one or two decimals of the forces are non-significant. The virial
286 is less accurate than the forces, since the virial is only one order of
287 magnitude larger than the size of each element in the sum over all atoms
288 (sec. :ref:`virial`). In most cases this is not really a problem, since
289 the fluctuations in the virial can be two orders of magnitude larger
290 than the average. Using cut-offs for the Coulomb interactions cause
291 large errors in the energies, forces, and virial. Even when using a
292 reaction-field or lattice sum method, the errors are larger than, or
293 comparable to, the errors due to the partial use of single precision.
294 Since MD is chaotic, trajectories with very similar starting conditions
295 will diverge rapidly, the divergence is faster in mixed precision than
296 in double precision.
298 For most simulations, mixed precision is accurate enough. In some cases
299 double precision is required to get reasonable results:
301 -  normal mode analysis, for the conjugate gradient or l-bfgs
302    minimization and the calculation and diagonalization of the Hessian
304 -  long-term energy conservation, especially for large systems
306 .. raw:: latex
308     \clearpage