From ef6a971cf432321ceb057b8c355c8e6814d5aff6 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 13 Nov 2009 12:10:12 +0100 Subject: Work in progress on photon correctness --- src/utils.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/utils.h') diff --git a/src/utils.h b/src/utils.h index f1b72af8..1de0ea09 100644 --- a/src/utils.h +++ b/src/utils.h @@ -18,6 +18,20 @@ #include + +/* Electron charge in C */ +#define ELECTRON_CHARGE (1.6021773e-19) + +/* Planck's constant (Js) */ +#define PLANCK (6.62606896e-34) + +/* Speed of light in vacuo (m/s) */ +#define C_VACUO (299792458) + +/* Thomson scattering length (m) */ +#define THOMSON_LENGTH (2.81794e-15) + + extern unsigned int biggest(signed int a, signed int b); extern unsigned int smallest(signed int a, signed int b); extern double distance(double x1, double y1, double x2, double y2); @@ -42,4 +56,16 @@ extern void mapping_rotate(double x, double y, double z, #define is_odd(a) ((a)%2==1) +/* Photon energy (J) to wavelength (m) */ +#define ph_en_to_lambda(a) ((PLANCK*C_VACUO)/(a)) + +/* Photon wavelength (m) to energy (J) */ +#define ph_lambda_to_en(a) ((PLANCK*C_VACUO)/(a)) + +/* eV to Joules */ +#define eV_to_J(a) ((a)*ELECTRON_CHARGE) + +/* Joules to eV */ +#define J_to_eV(a) ((a)/ELECTRON_CHARGE) + #endif /* UTILS_H */ -- cgit v1.2.3