aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-13 12:10:12 +0100
committerThomas White <taw@physics.org>2009-11-13 12:10:12 +0100
commitef6a971cf432321ceb057b8c355c8e6814d5aff6 (patch)
tree1d8d7373a1b7c1591cf28fcf61230122e19c1ca4 /src/utils.h
parent857cc8c991a5ee4e717d01822da271ae34f5adaa (diff)
Work in progress on photon correctness
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h26
1 files changed, 26 insertions, 0 deletions
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 <math.h>
+
+/* 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 */