diff options
-rw-r--r-- | src/diffraction-gpu.c | 8 | ||||
-rw-r--r-- | src/diffraction.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c index 409178b9..825f6372 100644 --- a/src/diffraction-gpu.c +++ b/src/diffraction-gpu.c @@ -113,7 +113,7 @@ void get_diffraction_gpu(struct gpu_context *gctx, struct image *image, double ax, ay, az; double bx, by, bz; double cx, cy, cz; - float k, klow; + float klow, khigh; cl_event *event; int p; float *tt_ptr; @@ -136,9 +136,9 @@ void get_diffraction_gpu(struct gpu_context *gctx, struct image *image, cell.s[6] = cx; cell.s[7] = cy; cell.s[8] = cz; /* Calculate wavelength */ - k = 1.0/image->lambda; /* Centre value */ - klow = k - k*(image->beam->bandwidth/2.0); /* Lower value */ - bwstep = k * image->beam->bandwidth / BWSAMPLING; + klow = 1.0/(image->lambda + image->beam->bandwidth/2.0); + khigh = 1.0/(image->lambda - image->beam->bandwidth/2.0); + bwstep = (khigh-klow) / BWSAMPLING; /* Orientation */ orientation.s[0] = image->orientation.w; diff --git a/src/diffraction.c b/src/diffraction.c index 66a2ba27..20490c99 100644 --- a/src/diffraction.c +++ b/src/diffraction.c @@ -301,7 +301,7 @@ void get_diffraction(struct image *image, int na, int nb, int nc, double ax, ay, az; double bx, by, bz; double cx, cy, cz; - float k, klow, bwstep; + float klow, khigh, bwstep; cell_get_cartesian(cell, &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz); @@ -311,9 +311,9 @@ void get_diffraction(struct image *image, int na, int nb, int nc, /* Needed later for Lorentz calculation */ image->twotheta = malloc(image->width * image->height * sizeof(double)); - k = 1.0/image->lambda; /* Centre value */ - klow = k - k*(image->beam->bandwidth/2.0); /* Lower value */ - bwstep = k * image->beam->bandwidth / BWSAMPLING; + klow = 1.0/(image->lambda + image->beam->bandwidth/2.0); + khigh = 1.0/(image->lambda - image->beam->bandwidth/2.0); + bwstep = (khigh-klow) / BWSAMPLING; for ( xs=0; xs<image->width*SAMPLING; xs++ ) { for ( ys=0; ys<image->height*SAMPLING; ys++ ) { |