2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team.
6 * Copyright (c) 2012, by the GROMACS development team, led by
7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8 * and including many others, as listed in the AUTHORS file in the
9 * top-level source directory and at http://www.gromacs.org.
11 * GROMACS is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * GROMACS is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with GROMACS; if not, see
23 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * If you want to redistribute modifications to GROMACS, please
27 * consider that scientific software is very special. Version
28 * control is crucial - bugs must be traceable. We will be happy to
29 * consider code for inclusion in the official distribution, but
30 * derived work must not be called official GROMACS. Details are found
31 * in the README & COPYING files - if they are missing, get the
32 * official version at http://www.gromacs.org.
34 * To help us fund GROMACS development, we humbly ask that you cite
35 * the research papers on the package. Check out http://www.gromacs.org.
42 * Physical constants to be used in Gromacs.
43 * No constants (apart from 0, 1 or 2) should
44 * be anywhere else in the code.
49 /* we do it anyway. */
58 #define M_PI 3.14159265358979323846
62 #define ANGSTROM (1e-10) /* Old... */
63 #define KILO (1e3) /* Thousand */
64 #define NANO (1e-9) /* A Number */
65 #define PICO (1e-12) /* A Number */
66 #define A2NM (ANGSTROM/NANO) /* NANO */
67 #define NM2A (NANO/ANGSTROM) /* 10.0 */
68 #define RAD2DEG (180.0/M_PI) /* Conversion */
69 #define DEG2RAD (M_PI/180.0) /* id */
70 #define CAL2JOULE (4.184) /* id */
71 #define E_CHARGE (1.60217733e-19) /* Coulomb */
73 #define AMU (1.6605402e-27) /* kg */
74 #define BOLTZMANN (1.380658e-23) /* (J/K) */
75 #define AVOGADRO (6.0221367e23) /* () */
76 #define RGAS (BOLTZMANN*AVOGADRO) /* (J/(mol K)) */
77 #define BOLTZ (RGAS/KILO) /* (kJ/(mol K)) */
78 #define FARADAY (E_CHARGE*AVOGADRO) /* (C/mol) */
79 #define ELECTRONVOLT (E_CHARGE*AVOGADRO/KILO) /* (kJ/mol) */
80 #define PLANCK1 (6.6262e-34) /* J s */
81 #define PLANCK (6.6262e-34*AVOGADRO/(PICO*KILO)) /* (kJ/mol) ps */
83 #define EPSILON0 (5.72765E-4) /* (e^2 / Na (kJ nm))
84 == (e^2 mol/(kJ nm)) */
86 #define SPEED_OF_LIGHT (2.9979245800E05) /* nm/ps */
87 #define ATOMICMASS_keV (940000.0) /* Atomic mass in keV */
88 #define ELECTRONMASS_keV (512.0) /* Electron mas in keV */
90 /* Improved accuracy (PL & EL, 20090421) */
91 #define FACEL (332.0636930*CAL2JOULE) /* (10 * (ONE_4PI_EPS0)) */
92 #define ONE_4PI_EPS0 (FACEL*0.1) /* 1/(4*pi*e0)*/
93 #define PRESFAC (16.6054) /* bar / pressure unity */
94 #define ENM2DEBYE 48.0321 /* Convert electron nm *
96 #define DEBYE2ENM 0.02081941
97 /* to convert from a acceleration in (e V)/(amu nm) */
98 /* FIELDFAC is also Faraday's constant and E_CHARGE/(1e6 AMU) */
99 #define FIELDFAC (FARADAY/KILO)
101 /* to convert AU to MD units: */
102 #define HARTREE2KJ 4.3597482e-21
103 #define BOHR2NM 0.0529177249
104 #define HARTREE_BOHR2MD (HARTREE2KJ*AVOGADRO/BOHR2NM)
107 /* The four basic units */
108 #define unit_length "nm"
109 #define unit_time "ps"
110 #define unit_mass "u"
111 #define unit_energy "kJ/mol"
113 /* Temperature unit, T in this unit times BOLTZ give energy in unit_energy */
114 #define unit_temp_K "K"
116 /* Charge unit, electron charge, involves ONE_4PI_EPS0 */
117 #define unit_charge_e "e"
119 /* Pressure unit, pressure in basic units times PRESFAC gives this unit */
120 #define unit_pres_bar "bar"
122 /* Dipole unit, debye, conversion from the unit_charge_e involves ENM2DEBYE */
123 #define unit_dipole_D "D"
125 /* Derived units from basic units only */
126 #define unit_vel unit_length "/" unit_time
127 #define unit_volume unit_length "^3"
128 #define unit_invtime "1/" unit_time
130 /* Other derived units */
131 #define unit_surft_bar unit_pres_bar " " unit_length
133 /* SI units, conversion from basic units involves NANO, PICO and AMU */
134 #define unit_length_SI "m"
135 #define unit_time_SI "s"
136 #define unit_mass_SI "kg"
138 #define unit_density_SI unit_mass_SI "/" unit_length_SI "^3"
139 #define unit_invvisc_SI unit_length_SI " " unit_time_SI "/" unit_mass_SI
141 /* The routines below can be used for converting units from or to GROMACS
144 eg2cAngstrom, eg2cNm, eg2cBohr, eg2cKcal_Mole,
145 eg2cHartree, eg2cHartree_e, eg2cAngstrom3, eg2cCoulomb,
146 eg2cDebye, eg2cElectron, eg2cBuckingham, eg2cNR
149 /* Convert value x to GROMACS units. Energy -> Energy, Length -> Length etc.
150 The type of x is deduced from unit,
151 which should be taken from the enum above. */
152 extern double convert2gmx(double x, int unit);
154 /* Convert value x from GROMACS units to the desired one.
155 The type of return value is deduced from unit, see above */
156 extern double gmx2convert(double x, int unit);
158 /* Convert the string to one of the units supported. Returns -1 if not found. */
159 extern int string2unit(char *string);
161 /* Convert the unit to a string. Return NULL when unit is out of range. */
162 extern const char *unit2string(int unit);
169 #endif /* _physics_h */