aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/detector.c2
-rw-r--r--src/diffraction.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/src/detector.c b/src/detector.c
index 41019551..ef2be5a8 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -147,7 +147,7 @@ void record_image(struct image *image)
/* Solid angle subtended by a single pixel at the centre of the CCD */
sa_per_pixel = pow(1.0/image->resolution, 2.0) / image->camera_len;
- printf("Solid angle of pixel (at centre of CCD) = %e sr\n",
+ printf("Solid angle of one pixel (at centre of CCD) = %e sr\n",
sa_per_pixel);
image->hdr = malloc(image->width * image->height * sizeof(double));
diff --git a/src/diffraction.c b/src/diffraction.c
index ce4e47ee..3d4fa6ea 100644
--- a/src/diffraction.c
+++ b/src/diffraction.c
@@ -130,19 +130,19 @@ static double complex water_factor(struct threevec q, double en)
double s;
double molecules_per_m3;
double molecules_per_m;
- const double rc = 0.5e-6; /* Radius of cylinder */
- const double rb = 1.5e-6; /* Radius of beam */
+ const double rc = 0.5e-6; /* Radius of cylinder (m) */
+ const double rb = 1.5e-6; /* Radius of beam (m) */
/* Density of water molecules */
molecules_per_m3 = WATER_DENSITY * (AVOGADRO / WATER_MOLAR_MASS);
- /* Number of water molecules per slice */
+ /* Number of water molecules per slice per metre of thickness */
molecules_per_m = (2*rb*2*rc) * molecules_per_m3 / N_WATER_SLICES;
/* s = sin(theta)/lambda = 1/2d = (1/d)/2.0 */
s = modulus(q.u, q.v, q.w) / 2.0;
- for ( x=-rc; x<rc; x+=rc/(N_WATER_SLICES/2) ) {
+ for ( x=-rc; x<=rc; x+=rc/(N_WATER_SLICES/2) ) {
double ph;
double thickness;
@@ -161,7 +161,7 @@ static double complex water_factor(struct threevec q, double en)
* molecules_per_m;
/* Correct for sampling of integration */
- return (res/n) * (2*rc);
+ return (res/(double)n) * (2.0*rc);
}