From 3d22f28223ee6dcef7e8d0cba247ac112942e344 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 26 Nov 2009 12:20:05 +0100 Subject: Move constants around --- src/detector.c | 6 +++++- src/diffraction.c | 18 ++++-------------- src/diffraction.h | 3 ++- src/utils.h | 11 ++++++++++- 4 files changed, 21 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/detector.c b/src/detector.c index 1e0e4a2f..9f28a624 100644 --- a/src/detector.c +++ b/src/detector.c @@ -29,6 +29,9 @@ /* Detector's saturation value */ #define SATURATION (60000) +/* Radius of X-ray beam */ +#define BEAM_RADIUS (3.0e-6) + /* Bleed excess intensity into neighbouring pixels */ static void bloom_values(double *tmp, int x, int y, @@ -169,7 +172,8 @@ void record_image(struct image *image) /* Add intensity contribution from water */ water = water_intensity(image->qvecs[x + image->width*y], - image->xray_energy); + image->xray_energy, + BEAM_RADIUS, 1.5e-6); //printf("%e, %e, ", intensity, water); intensity += water; diff --git a/src/diffraction.c b/src/diffraction.c index f1322c04..10e12c4d 100644 --- a/src/diffraction.c +++ b/src/diffraction.c @@ -23,15 +23,8 @@ #include "diffraction.h" #include "sfac.h" - -/* Density of water in kg/m^3 */ -#define WATER_DENSITY (1.0e6) - -/* Molar mass of water, in kg/mol */ -#define WATER_MOLAR_MASS (18.01528e3) - -/* Avogadro's number */ -#define AVOGADRO (6.022e23) +/* Radius of beam (m) */ +#define BEAM_RADIUS (1.5e-6) static double lattice_factor(struct threevec q, double ax, double ay, double az, @@ -99,7 +92,8 @@ static double complex molecule_factor(struct molecule *mol, struct threevec q, } -double water_intensity(struct threevec q, double en) +double water_intensity(struct threevec q, double en, + double beam_r, double water_r) { double complex fH, fO; double s, modq; @@ -109,10 +103,6 @@ double water_intensity(struct threevec q, double en) const double rOH = 0.09584e-9; const double rHH = 0.1515e-9; - /* Dimensions of water column */ - const double water_r = 0.5e-6; - const double beam_r = 1.5e-6; - /* Volume of water column */ const double water_v = M_PI*pow(water_r, 2.0) * 2.0 * beam_r; diff --git a/src/diffraction.h b/src/diffraction.h index e2994a0b..1e08e116 100644 --- a/src/diffraction.h +++ b/src/diffraction.h @@ -20,6 +20,7 @@ #include "cell.h" extern void get_diffraction(struct image *image); -extern double water_intensity(struct threevec q, double en); +extern double water_intensity(struct threevec q, double en, + double beam_r, double water_r); #endif /* DIFFRACTION_H */ diff --git a/src/utils.h b/src/utils.h index c89466c3..b4b5a58e 100644 --- a/src/utils.h +++ b/src/utils.h @@ -36,8 +36,17 @@ /* Thomson scattering length (m) */ #define THOMSON_LENGTH (2.81794e-15) +/* Density of water in kg/m^3 */ +#define WATER_DENSITY (1.0e6) -/* --------------------------- Useful datatypes ----------------------------- */ +/* Molar mass of water, in kg/mol */ +#define WATER_MOLAR_MASS (18.01528e3) + +/* Avogadro's number */ +#define AVOGADRO (6.022e23) + + +/* ------------------------------ Quaternions ------------------------------- */ struct quaternion { -- cgit v1.2.3