Merge branch 'master' of git://repo.or.cz/gromacs
[gromacs/adressmacs.git] / include / physics.h
blobff6814be3034115f6bae4e99dba746455d11370d
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 #ifndef M_PI
52 #ifdef _PI
53 #define M_PI _PI
54 #else
55 #define M_PI 3.14159265358979323846
56 #endif
57 #endif
59 #define ANGSTROM (1e-10) /* Old... */
60 #define KILO (1e3) /* Thousand */
61 #define NANO (1e-9) /* A Number */
62 #define PICO (1e-12) /* A Number */
63 #define A2NM (ANGSTROM/NANO) /* NANO */
64 #define NM2A (NANO/ANGSTROM) /* 10.0 */
65 #define RAD2DEG (180.0/M_PI) /* Conversion */
66 #define DEG2RAD (M_PI/180.0) /* id */
67 #define CAL2JOULE (4.184) /* id */
68 #define E_CHARGE (1.60217733e-19) /* Coulomb */
70 #define AMU (1.6605402e-27) /* kg */
71 #define BOLTZMANN (1.380658e-23) /* (J/K) */
72 #define AVOGADRO (6.0221367e23) /* () */
73 #define RGAS (BOLTZMANN*AVOGADRO) /* (J/(mol K)) */
74 #define BOLTZ (RGAS/KILO) /* (kJ/(mol K)) */
75 #define FARADAY (E_CHARGE*AVOGADRO) /* (C/mol) */
76 #define ELECTRONVOLT (E_CHARGE*AVOGADRO/KILO) /* (kJ/mol) */
77 #define PLANCK1 (6.6262e-34) /* J s */
78 #define PLANCK (6.6262e-34*AVOGADRO/(PICO*KILO)) /* (kJ/mol) ps */
80 #define EPSILON0 (5.72765E-4) /* (e^2 / Na (kJ nm))
81 == (e^2 mol/(kJ nm)) */
83 #define SPEED_OF_LIGHT (2.9979245800E05) /* nm/ps */
84 #define ATOMICMASS_keV (940000.0) /* Atomic mass in keV */
85 #define ELECTRONMASS_keV (512.0) /* Electron mas in keV */
87 /* Improved accuracy (PL & EL, 20090421) */
88 #define FACEL (332.0636930*CAL2JOULE)/* (10 * (ONE_4PI_EPS0)) */
89 #define ONE_4PI_EPS0 (FACEL*0.1) /* 1/(4*pi*e0)*/
90 #define PRESFAC (16.6054) /* bar / pressure unity */
91 #define ENM2DEBYE 48.0321 /* Convert electron nm *
92 * to debye */
93 #define DEBYE2ENM 0.02081941
94 /* to convert from a acceleration in (e V)/(amu nm) */
95 /* FIELDFAC is also Faraday's constant and E_CHARGE/(1e6 AMU) */
96 #define FIELDFAC (FARADAY/KILO)
98 /* to convert AU to MD units: */
99 #define HARTREE2KJ 4.3597482e-21
100 #define BOHR2NM 0.0529177249
101 #define HARTREE_BOHR2MD (HARTREE2KJ*AVOGADRO/BOHR2NM)
104 /* The four basic units */
105 #define unit_length "nm"
106 #define unit_time "ps"
107 #define unit_mass "u"
108 #define unit_energy "kJ/mol"
110 /* Temperature unit, T in this unit times BOLTZ give energy in unit_energy */
111 #define unit_temp_K "K"
113 /* Charge unit, electron charge, involves ONE_4PI_EPS0 */
114 #define unit_charge_e "e"
116 /* Pressure unit, pressure in basic units times PRESFAC gives this unit */
117 #define unit_pres_bar "bar"
119 /* Dipole unit, debye, conversion from the unit_charge_e involves ENM2DEBYE */
120 #define unit_dipole_D "D"
122 /* Derived units from basic units only */
123 #define unit_vel unit_length "/" unit_time
124 #define unit_volume unit_length "^3"
125 #define unit_invtime "1/" unit_time
127 /* Other derived units */
128 #define unit_surft_bar unit_pres_bar " " unit_length
130 /* SI units, conversion from basic units involves NANO, PICO and AMU */
131 #define unit_length_SI "m"
132 #define unit_time_SI "s"
133 #define unit_mass_SI "kg"
135 #define unit_density_SI unit_mass_SI "/" unit_length_SI "^3"
136 #define unit_invvisc_SI unit_length_SI " " unit_time_SI "/" unit_mass_SI
138 #endif /* _physics_h */