diff options
author | Thomas White <taw@physics.org> | 2009-11-20 19:56:44 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2009-11-20 19:56:44 +0100 |
commit | 94daaeb94aa78ec7b1fb4badb4475161b7532473 (patch) | |
tree | a4e07cf0fe7a3eee3facd2fa76708c13a66aad19 | |
parent | f2d53ec0f0912178a7ec9748a899ed09b59a7cb5 (diff) |
Tidy up
Doesn't really change anything..
-rw-r--r-- | src/detector.c | 2 | ||||
-rw-r--r-- | src/diffraction.c | 10 |
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); } |