From 05c119d324e8792b2a7b83de86e4c082d401ea77 Mon Sep 17 00:00:00 2001 From: Yaroslav Gevorkov Date: Tue, 5 Nov 2019 15:56:57 +0100 Subject: bug fix in Ewald sphere width calculation --- libcrystfel/src/geometry.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libcrystfel/src/geometry.c') diff --git a/libcrystfel/src/geometry.c b/libcrystfel/src/geometry.c index 5230c642..e5506334 100644 --- a/libcrystfel/src/geometry.c +++ b/libcrystfel/src/geometry.c @@ -290,17 +290,16 @@ static Reflection *check_reflection(struct image *image, Crystal *cryst, g = spectrum_get_gaussian(image->spectrum, i); /* Project lattice point onto Ewald sphere */ - x = xl; + x = xl; y = yl; z = zl + g.kcen; norm = 1.0/sqrt(x*x+y*y+z*z); x *= norm; y *= norm; z *= norm; - z -= 1.0; /* Width of Ewald sphere in the direction of the projection */ - sigma_proj = sqrt(x*x+y*y+z*z)*g.sigma; + sigma_proj = (1-z)*g.sigma; mean_variance(g.kcen, g.area, &sumw_k, &mean_k, &M2_k); M2_k += g.area * g.sigma * g.sigma; @@ -310,6 +309,7 @@ static Reflection *check_reflection(struct image *image, Crystal *cryst, x *= g.kcen; y *= g.kcen; z *= g.kcen; + z -= g.kcen; /* Three because the general case fails in extreme cases */ if ( w0 / w1 <= DBL_MIN ) { -- cgit v1.2.3