diff options
-rw-r--r-- | libcrystfel/src/cell-utils.c | 33 | ||||
-rw-r--r-- | libcrystfel/src/cell-utils.h | 4 | ||||
-rw-r--r-- | src/partialator.c | 13 |
3 files changed, 47 insertions, 3 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c index 22610ce1..93dea212 100644 --- a/libcrystfel/src/cell-utils.c +++ b/libcrystfel/src/cell-utils.c @@ -3,7 +3,7 @@ * * Unit Cell utility functions * - * Copyright © 2012-2020 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2021 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * Copyright © 2012 Lorenzo Galli * @@ -1312,6 +1312,37 @@ double cell_get_volume(UnitCell *cell) } +/** + * \param cell: A %UnitCell + * + * \returns the value of 1/d for the lowest order reflection + * that is not systematically absent according to the centering. + * + */ +double lowest_reflection(UnitCell *cell) +{ + signed int h, k, l; + double lowres = INFINITY; + + /* FIXME: Inelegant and nasty. Anyone want to work out + * all the possible cases? */ + for ( h=0; h<4; h++ ) { + for ( k=0; k<4; k++ ) { + for ( l=0; l<4; l++ ) { + if ( (h==0) && (k==0) && (l==0) ) continue; + if ( !forbidden_reflection(cell, h, k, l) ) { + double r = resolution(cell, h, k, l); + if ( r < lowres ) { + lowres = r; + } + } + } + } + } + return lowres; +} + + /* Return true if the two centering symbols are identical, * or if they are a pair of R/P, which should be considered the * same for the purposes of cell comparison */ diff --git a/libcrystfel/src/cell-utils.h b/libcrystfel/src/cell-utils.h index 00563ee6..0a110bf2 100644 --- a/libcrystfel/src/cell-utils.h +++ b/libcrystfel/src/cell-utils.h @@ -3,7 +3,7 @@ * * Unit Cell utility functions * - * Copyright © 2012-2020 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2021 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * Copyright © 2012 Lorenzo Galli * @@ -79,6 +79,8 @@ extern int forbidden_reflection(UnitCell *cell, extern double cell_get_volume(UnitCell *cell); +extern double lowest_reflection(UnitCell *cell); + extern int compare_cell_parameters(UnitCell *cell, UnitCell *reference, const double *tols); diff --git a/src/partialator.c b/src/partialator.c index 31ebb8c9..8422c05a 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -3,7 +3,7 @@ * * Scaling and post refinement for coherent nanocrystallography * - * Copyright © 2012-2020 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2021 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * * Authors: @@ -1430,12 +1430,23 @@ int main(int argc, char *argv[]) Crystal **crystals_new; RefList *cr_refl; struct image *image_for_crystal; + double lowest_r; n_crystals_seen++; if ( n_crystals_seen <= start_after ) continue; if ( crystal_get_resolution_limit(image->crystals[i]) < min_res ) continue; + lowest_r = lowest_reflection(crystal_get_cell(image->crystals[i])); + if ( crystal_get_profile_radius(image->crystals[i]) > 0.2*lowest_r ) { + ERROR("Rejecting %s %s crystal %i because " + "profile radius is obviously too big (%e %e).\n", + image->filename, image->ev, i, + crystal_get_profile_radius(image->crystals[i]), + lowest_r); + continue; + } + crystals_new = realloc(crystals, (n_crystals+1)*sizeof(Crystal *)); if ( crystals_new == NULL ) { |