Merge branch 'master' of git@git.gromacs.org:gromacs
[gromacs/qmmm-gamess-us.git] / include / physics.h
blob7563386393043bb7ddf22218235a674ccb2eb32c
1 /*
2 *
3 * This source code is part of
4 *
5 * G R O M A C S
6 *
7 * GROningen MAchine for Chemical Simulations
8 *
9 * VERSION 3.2.0
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gromacs Runs On Most of All Computer Systems
36 #ifndef _physics_h
37 #define _physics_h
39 #ifdef HAVE_CONFIG_H
40 #include <config.h>
41 #endif
44 * Physical constants to be used in Gromacs.
45 * No constants (apart from 0, 1 or 2) should
46 * be anywhere else in the code.
49 #include <math.h>
51 /* we do it anyway. */
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
56 #ifndef M_PI
57 #ifdef _PI
58 #define M_PI _PI
59 #else
60 #define M_PI 3.14159265358979323846
61 #endif
62 #endif
64 #define ANGSTROM (1e-10) /* Old... */
65 #define KILO (1e3) /* Thousand */
66 #define NANO (1e-9) /* A Number */
67 #define PICO (1e-12) /* A Number */
68 #define A2NM (ANGSTROM/NANO) /* NANO */
69 #define NM2A (NANO/ANGSTROM) /* 10.0 */
70 #define RAD2DEG (180.0/M_PI) /* Conversion */
71 #define DEG2RAD (M_PI/180.0) /* id */
72 #define CAL2JOULE (4.184) /* id */
73 #define E_CHARGE (1.60217733e-19) /* Coulomb */
75 #define AMU (1.6605402e-27) /* kg */
76 #define BOLTZMANN (1.380658e-23) /* (J/K) */
77 #define AVOGADRO (6.0221367e23) /* () */
78 #define RGAS (BOLTZMANN*AVOGADRO) /* (J/(mol K)) */
79 #define BOLTZ (RGAS/KILO) /* (kJ/(mol K)) */
80 #define FARADAY (E_CHARGE*AVOGADRO) /* (C/mol) */
81 #define ELECTRONVOLT (E_CHARGE*AVOGADRO/KILO) /* (kJ/mol) */
82 #define PLANCK1 (6.6262e-34) /* J s */
83 #define PLANCK (6.6262e-34*AVOGADRO/(PICO*KILO)) /* (kJ/mol) ps */
85 #define EPSILON0 (5.72765E-4) /* (e^2 / Na (kJ nm))
86 == (e^2 mol/(kJ nm)) */
88 #define SPEED_OF_LIGHT (2.9979245800E05) /* nm/ps */
89 #define ATOMICMASS_keV (940000.0) /* Atomic mass in keV */
90 #define ELECTRONMASS_keV (512.0) /* Electron mas in keV */
92 /* Improved accuracy (PL & EL, 20090421) */
93 #define FACEL (332.0636930*CAL2JOULE)/* (10 * (ONE_4PI_EPS0)) */
94 #define ONE_4PI_EPS0 (FACEL*0.1) /* 1/(4*pi*e0)*/
95 #define PRESFAC (16.6054) /* bar / pressure unity */
96 #define ENM2DEBYE 48.0321 /* Convert electron nm *
97 * to debye */
98 #define DEBYE2ENM 0.02081941
99 /* to convert from a acceleration in (e V)/(amu nm) */
100 /* FIELDFAC is also Faraday's constant and E_CHARGE/(1e6 AMU) */
101 #define FIELDFAC (FARADAY/KILO)
103 /* to convert AU to MD units: */
104 #define HARTREE2KJ 4.3597482e-21
105 #define BOHR2NM 0.0529177249
106 #define HARTREE_BOHR2MD (HARTREE2KJ*AVOGADRO/BOHR2NM)
109 /* The four basic units */
110 #define unit_length "nm"
111 #define unit_time "ps"
112 #define unit_mass "u"
113 #define unit_energy "kJ/mol"
115 /* Temperature unit, T in this unit times BOLTZ give energy in unit_energy */
116 #define unit_temp_K "K"
118 /* Charge unit, electron charge, involves ONE_4PI_EPS0 */
119 #define unit_charge_e "e"
121 /* Pressure unit, pressure in basic units times PRESFAC gives this unit */
122 #define unit_pres_bar "bar"
124 /* Dipole unit, debye, conversion from the unit_charge_e involves ENM2DEBYE */
125 #define unit_dipole_D "D"
127 /* Derived units from basic units only */
128 #define unit_vel unit_length "/" unit_time
129 #define unit_volume unit_length "^3"
130 #define unit_invtime "1/" unit_time
132 /* Other derived units */
133 #define unit_surft_bar unit_pres_bar " " unit_length
135 /* SI units, conversion from basic units involves NANO, PICO and AMU */
136 #define unit_length_SI "m"
137 #define unit_time_SI "s"
138 #define unit_mass_SI "kg"
140 #define unit_density_SI unit_mass_SI "/" unit_length_SI "^3"
141 #define unit_invvisc_SI unit_length_SI " " unit_time_SI "/" unit_mass_SI
143 #ifdef __cplusplus
145 #endif
148 #endif /* _physics_h */