From 629934d82e202ea04b334c49efffe09aaa0f1c4e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 14 Aug 2014 15:07:21 +0200 Subject: Remove "sphere", "thin" and "gaussian" partiality models, add "scgaussian" --- libcrystfel/src/geometry.c | 68 ++++++------------------------------------- libcrystfel/src/geometry.h | 9 ++---- libcrystfel/src/integration.c | 3 +- 3 files changed, 13 insertions(+), 67 deletions(-) (limited to 'libcrystfel') diff --git a/libcrystfel/src/geometry.c b/libcrystfel/src/geometry.c index aff19198..8952486d 100644 --- a/libcrystfel/src/geometry.c +++ b/libcrystfel/src/geometry.c @@ -121,18 +121,10 @@ static double partiality(PartialityModel pmodel, case PMODEL_UNITY: return 1.0; - case PMODEL_SPHERE: - plow = 3.0*qlow*qlow - 2.0*qlow*qlow*qlow; - phigh = 3.0*qhigh*qhigh - 2.0*qhigh*qhigh*qhigh; - return plow - phigh; - - case PMODEL_GAUSSIAN: + case PMODEL_SCGAUSSIAN: plow = 0.5 * gsl_sf_erf(ng * rlow / (sqrt(2.0)*r)); phigh = 0.5 * gsl_sf_erf(ng * rhigh / (sqrt(2.0)*r)); - return plow - phigh; - - case PMODEL_THIN: - return 1.0 - (rmid*rmid)/(r*r); + return 4.0*(plow-phigh)*r / (3.0*D); case PMODEL_SCSPHERE: plow = 3.0*qlow*qlow - 2.0*qlow*qlow*qlow; @@ -157,7 +149,7 @@ static Reflection *check_reflection(struct image *image, Crystal *cryst, Reflection *refl; double cet, cez; /* Centre of Ewald sphere */ double pr; - double L, D; + double D; double del; /* Don't predict 000 */ @@ -198,44 +190,13 @@ static Reflection *check_reflection(struct image *image, Crystal *cryst, return NULL; } - /* Conditions for reflection to be excited at all */ - switch ( pmodel ) { - - case PMODEL_UNITY: /* PMODEL_UNITY shouldn't end up here */ - case PMODEL_SPHERE: - case PMODEL_GAUSSIAN: - case PMODEL_SCSPHERE: - if ( (signbit(rlow) == signbit(rhigh)) - && (fabs(rlow) > pr) - && (fabs(rhigh) > pr) ) return NULL; - break; - - case PMODEL_THIN: - if ( fabs(rmid) > pr ) return NULL; - break; - - } + /* Condition for reflection to be excited at all */ + if ( (signbit(rlow) == signbit(rhigh)) + && (fabs(rlow) > pr) + && (fabs(rhigh) > pr) ) return NULL; D = rlow - rhigh; - /* Lorentz factor is determined direction from the r values, before - * clamping. The multiplication by 0.01e9 to make the - * correction factor vaguely near 1. */ - switch ( pmodel ) { - - case PMODEL_SPHERE: - case PMODEL_GAUSSIAN: - L = LORENTZ_SCALE / D; - break; - - case PMODEL_UNITY: /* PMODEL_UNITY shouldn't end up here */ - case PMODEL_THIN: - case PMODEL_SCSPHERE: - L = 1.0; - break; - - } - /* If the "lower" Ewald sphere is a long way away, use the * position at which the Ewald sphere would just touch the * reflection. @@ -282,19 +243,8 @@ static Reflection *check_reflection(struct image *image, Crystal *cryst, set_detector_pos(refl, 0.0, xda, yda); } - if ( pmodel != PMODEL_THIN ) { - set_partial(refl, rlow, rhigh, part, clamp_low, clamp_high); - } else { - /* If we are using the TES (Thin Ewald Sphere) model, we abuse - * the fields as follows: - * rlow = the r value for the middle (only) Ewald sphere - * rhigh = 0.0 - * clamp_low = 0 - * clamp_high = +1 - */ - set_partial(refl, rmid, 0.0, part, 0, +1); - } - set_lorentz(refl, L); + set_partial(refl, rlow, rhigh, part, clamp_low, clamp_high); + set_lorentz(refl, 1.0); set_symmetric_indices(refl, h, k, l); set_redundancy(refl, 1); diff --git a/libcrystfel/src/geometry.h b/libcrystfel/src/geometry.h index d8d226f0..ccdea1c2 100644 --- a/libcrystfel/src/geometry.h +++ b/libcrystfel/src/geometry.h @@ -46,23 +46,18 @@ extern "C" { /** * PartialityModel: - * @PMODEL_SPHERE : Intersection of sphere with excited volume of reciprocal - * space. * @PMODEL_UNITY : Set all all partialities and Lorentz factors to 1. - * @PMODEL_GAUSSIAN : Gaussian profiles in 3D - * @PMODEL_THIN : Thin Ewald sphere intersecting sphere * @PMODEL_SCSPHERE : Sphere model with source coverage factor included + * @PMODEL_SCGAUSSIAN : Gaussian model with source coverage factor included * * A %PartialityModel describes a geometrical model which can be used to * calculate spot partialities and Lorentz correction factors. **/ typedef enum { - PMODEL_SPHERE, PMODEL_UNITY, - PMODEL_GAUSSIAN, - PMODEL_THIN, PMODEL_SCSPHERE, + PMODEL_SCGAUSSIAN, } PartialityModel; diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c index 635a7c74..34bde83a 100644 --- a/libcrystfel/src/integration.c +++ b/libcrystfel/src/integration.c @@ -1914,7 +1914,8 @@ void integrate_all_2(struct image *image, IntegrationMethod meth, IntDiag int_diag, signed int idh, signed int idk, signed int idl) { - integrate_all_3(image, meth, PMODEL_SPHERE, 0.0, ir_inn, ir_mid, ir_out, + integrate_all_3(image, meth, PMODEL_SCSPHERE, 0.0, + ir_inn, ir_mid, ir_out, int_diag, idh, idk, idl); } -- cgit v1.2.3