k-dot-p 0.1

physical_constants.c++

Go to the documentation of this file.
00001 /*
00002  *Contains physical constants and derived constants
00003  
00004 
00005     Copyright (C) 2010 Joseph Pingenot
00006 
00007     This program is free software: you can redistribute it and/or modify
00008     it under the terms of the GNU Affero General Public License as published by
00009     the Free Software Foundation, either version 3 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU Affero General Public License for more details.
00016 
00017     You should have received a copy of the GNU Affero General Public License
00018     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 
00020 */
00021 
00022 #ifndef __PHYSICAL_CONSTANTS_HXX___
00023 #define __PHYSICAL_CONSTANTS_HXX___
00024 
00025 #include <libkdotp/gcc_hints.h>
00026 
00027 namespace kdp {
00028   namespace constants {
00029 
00030 /*Sources are NIST*/
00031 
00032 /*hbar, in eV s*/
00033 double hbar = 6.58211899e-16;
00034 /*Speed of light in m/s*/
00035 double c = 299792458;
00036 /*mass of electron in eV s^2 m^-2*/
00037 double m0 = 0.510998910e6/c/c;
00038 /*Magnitude of the charge of the electron in C*/
00039 double e = 1.602176487e-19;
00040 /*Charge of the elecron in C*/
00041 double q_e = -e;
00042 /*vacuum dielectric constant F/m*/
00043 double epsilon0 = 8.854187817e-12;
00044 
00045 /*Hartree/eV*/
00046 double ev_in_hartree = 1.0/27.21138386;
00047 /*eV/Hartree*/
00048 double hartree_in_ev = 27.21138386;
00049 double bohr_in_meters = 0.529177208e-10;
00050 double bohr_in_nmeters = 0.529177208e-1;
00051 
00052 ___const double ev_to_hartree(double ev) {
00053   return ev * ev_in_hartree;
00054 }
00055 
00056 ___const double hartree_to_ev(double hartree) {
00057   return hartree * hartree_in_ev;
00058 }
00059 
00060 ___const double bohr_to_m(double bohr) {
00061   return bohr*bohr_in_meters;
00062 }
00063 
00064 ___const double m_to_bohr(double m) {
00065   return m/bohr_in_meters;
00066 }
00067 
00068 ___const double bohr_to_nm(double bohr) {
00069   return bohr*bohr_in_nmeters;
00070 }
00071 
00072 ___const double nm_to_bohr(double nm) {
00073   return nm/bohr_in_nmeters;
00074 }
00075 
00076   }
00077 }
00078 
00079 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines