Definitions and Units#

Notation#

The following conventions for mathematical typesetting are used throughout this document:

Item

Notation

Example

Vector

Bold italic

ri

Vector Length

Italic

ri

We define the lowercase subscripts i, j, k and l to denote particles: ri is the position vector of particle i, and using this notation:

(5)#rij=rjririj=|rij|

The force on particle i is denoted by Fi and

(6)#Fij=force on i exerted by j

MD units#

GROMACS uses a consistent set of units that produce values in the vicinity of unity for most relevant molecular quantities. Let us call them MD units. The basic units in this system are nm, ps, K, electron charge (e) and atomic mass unit (u), see Table 2 The values used in GROMACS are taken from the CODATA Internationally recommended 2010 values of fundamental physical constants (see NIST homepage).

Table 2 Basic units used in GROMACS#

Quantity

Symbol

Unit

length

r

nm=109 m

mass

m

u (unified atomic mass unit) = 1.660538921×1027 kg

time

t

ps=1012 s

charge

q

e = elementary charge = 1.602176565×1019 C

temperature

T

K

Consistent with these units are a set of derived units, given in Table 3

Table 3 Derived units. Note that an additional conversion factor of 1028 a.m.u ( 16.6) is applied to get bar instead of internal MD units in the energy and log files#

Quantity

Symbol

Unit

energy

E,V

kJ mol1

Force

F

kJ mol1 nm1

pressure

p

bar

velocity

v

nm ps1=1000 m s1

dipole moment

μ

e nm

electric potential

Φ

kJ mol1 e1= 0.01036426919 Volt

electric field

E

kJ mol1 nm1 e1= 1.036426919×107 Vm1

The electric conversion factor f=14πεo=138.935458 kJ mol1nm e2. It relates the mechanical quantities to the electrical quantities as in

(7)#V=fq2r\ \ or\ \ F=fq2r2

Electric potentials Φ and electric fields E are intermediate quantities in the calculation of energies and forces. They do not occur inside GROMACS. If they are used in evaluations, there is a choice of equations and related units. We strongly recommend following the usual practice of including the factor f in expressions that evaluate Φ and E:

(8)#Φ(r)=fjqj|rrj|E(r)=fjqj(rrj)|rrj|3

With these definitions, qΦ is an energy and qE is a force. The units are those given in Table 3 about 10 mV for potential. Thus, the potential of an electronic charge at a distance of 1 nm equals f140 units 1.4 V. (exact value: 1.4399645 V)

Note that these units are mutually consistent; changing any of the units is likely to produce inconsistencies and is therefore strongly discouraged! In particular: if Å are used instead of nm, the unit of time changes to 0.1 ps. If kcal mol1 (= 4.184 kJ mol1) is used instead of kJ mol1 for energy, the unit of time becomes 0.488882 ps and the unit of temperature changes to 4.184 K. But in both cases all electrical energies go wrong, because they will still be computed in kJ mol1, expecting nm as the unit of length. Although careful rescaling of charges may still yield consistency, it is clear that such confusions must be rigidly avoided.

In terms of the MD units, the usual physical constants take on different values (see Table 4). All quantities are per mol rather than per molecule. There is no distinction between Boltzmann’s constant k and the gas constant R: their value is 0.0083144621kJ mol1K1.

Table 4 Some Physical Constants#

Symbol

Name

Value

NAV

Avogadro’s number

6.02214129×1023 mol1

R

gas constant

8.3144621×103 kJ mol1 K1

kB

Boltzmann’s constant

idem

h

Planck’s constant

0.399031271 kJ mol1 ps

Dirac’s constant

0.0635077993 kJ mol1 ps

c

velocity of light

299792.458 nm ps1

Reduced units#

When simulating Lennard-Jones (LJ) systems, it might be advantageous to use reduced units (i.e., setting ϵii=σii=mi=kB=1 for one type of atoms). This is possible. When specifying the input in reduced units, the output will also be in reduced units. The one exception is the temperature, which is expressed in 0.0083144621 reduced units. This is a consequence of using Boltzmann’s constant in the evaluation of temperature in the code. Thus not T, but kBT, is the reduced temperature. A GROMACS temperature T=1 means a reduced temperature of 0.008 units; if a reduced temperature of 1 is required, the GROMACS temperature should be 120.27236.

In Table 5 quantities are given for LJ potentials:

(9)#VLJ=4ϵ[(σr)12(σr)6]
Table 5 Reduced Lennard-Jones quantities#

Quantity

Symbol

Relation to SI

Length

r

rσ1

Mass

m

m M1

Time

t

tσ1 ϵ/M

Temperature

T

kBT ϵ1

Energy

E

Eϵ1

Force

F

Fσ ϵ1

Pressure

P

Pσ3ϵ1

Velocity

v

vM/ϵ

Density

ρ

Nσ3 V1

Mixed or Double precision#

GROMACS can be compiled in either mixed or double precision. Documentation of previous GROMACS versions referred to single precision, but the implementation has made selective use of double precision for many years. Using single precision for all variables would lead to a significant reduction in accuracy. Although in mixed precision all state vectors, i.e. particle coordinates, velocities and forces, are stored in single precision, critical variables are double precision. A typical example of the latter is the virial, which is a sum over all forces in the system, which have varying signs. In addition, in many parts of the code we managed to avoid double precision for arithmetic, by paying attention to summation order or reorganization of mathematical expressions. The default configuration uses mixed precision, but it is easy to turn on double precision by adding the option -DGMX_DOUBLE=on to cmake. Double precision will be 20 to 100% slower than mixed precision depending on the architecture you are running on. Double precision will use somewhat more memory and run input, energy and full-precision trajectory files will be almost twice as large.

The energies in mixed precision are accurate up to the last decimal, the last one or two decimals of the forces are non-significant. The virial is less accurate than the forces, since the virial is only one order of magnitude larger than the size of each element in the sum over all atoms (sec. Virial and pressure). In most cases this is not really a problem, since the fluctuations in the virial can be two orders of magnitude larger than the average. Using cut-offs for the Coulomb interactions cause large errors in the energies, forces, and virial. Even when using a reaction-field or lattice sum method, the errors are larger than, or comparable to, the errors due to the partial use of single precision. Since MD is chaotic, trajectories with very similar starting conditions will diverge rapidly, the divergence is faster in mixed precision than in double precision.

For most simulations, mixed precision is accurate enough. In some cases double precision is required to get reasonable results:

  • normal mode analysis, for the conjugate gradient or l-bfgs minimization and the calculation and diagonalization of the Hessian

  • long-term energy conservation, especially for large systems