|
funkalicious 0.1
|
00001 /* 00002 ** unit_conversion.c 00003 ** 00004 ** Made by (Johnny Q. Hacker) 00005 ** Login <solarion@borkborkbork> 00006 ** 00007 Copyright (C) 2009 Joseph Pingenot 00008 00009 This program is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU Affero General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU Affero General Public License for more details. 00018 00019 You should have received a copy of the GNU Affero General Public License 00020 along with this program. If not, see <http://www.gnu.org/licenses/>. 00021 00022 ** Started on Thu Nov 19 22:52:01 2009 Johnny Q. Hacker 00023 ** Last update Sun May 12 01:17:25 2002 Speed Blue 00024 */ 00025 00026 #include "unit_conversion.h" 00027 00028 /*From NIST: http://physics.nist.gov/cuu/Constants/index.html*/ 00029 00030 const double mag_q_e_in_C = 1.602176487e-19; 00031 const double ev_in_hartree = 1.0/27.21138386; 00032 const double hartree_in_ev = 27.21138386; 00033 const double bohr_in_meters = 0.529177208e-10; 00034 const double bohr_in_nmeters = 0.529177208e-1; 00035 00036 /*hbar, in eV s*/ 00037 const double hbar = 6.58211899e-16; 00038 /*Speed of light in m/s*/ 00039 const double c = 299792458; 00040 /*mass of electron in eV s^2 m^-2*/ 00041 const double m0 = 0.510998910e6/(299792458.0*299792458.0); 00042 /*Magnitude of the charge of the electron in C*/ 00043 const double e = 1.602176487e-19; 00044 /*Charge of the elecron in C*/ 00045 const double q_e = -1.602176487e-19; 00046 /*vacuum dielectric constant F/m*/ 00047 const double epsilon0 = 8.854187817e-12; 00048 /*one over vacuum dielectric constant F/m*/ 00049 const double oo_epsilon0 = 1.0/8.854187817e-12; 00050 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 }