From 33aa23c9d287ee0a34c445f7625a71d72657c061 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 20 Jul 2015 16:33:35 +0200 Subject: partialator: Tidy up handling of bad crystals --- src/partialator.c | 85 +++++++++++++++++---------------------------------- src/post-refinement.c | 4 +-- src/post-refinement.h | 10 ++++++ src/rejection.c | 5 +-- 4 files changed, 43 insertions(+), 61 deletions(-) (limited to 'src') diff --git a/src/partialator.c b/src/partialator.c index 2ad20094..70c82960 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -99,27 +99,27 @@ static void display_progress(int n_images, int n_crystals) } -static const char *str_flags(Crystal *cr) +static const char *str_flags(flag) { - switch ( crystal_get_user_flag(cr) ) { + switch ( flag ) { - case 0 : + case PRFLAG_OK : return "OK"; - case 1 : - return "bad scaling"; - - case 2 : + case PRFLAG_FEWREFL : return "not enough reflections"; - case 3 : + case PRFLAG_SOLVEFAIL : return "PR solve failed"; - case 4 : - return "PR lost too many reflections"; + case PRFLAG_EARLY : + return "early rejection"; + + case PRFLAG_CC : + return "low CC"; - case 5 : - return "Early rejection"; + case PRFLAG_BIGB : + return "B too big"; default : return "Unknown flag"; @@ -194,55 +194,26 @@ static int set_initial_params(Crystal *cr, FILE *fh) static void show_duds(Crystal **crystals, int n_crystals) { int j; - int n_dud = 0; - int n_noscale = 0; - int n_noref = 0; - int n_solve = 0; - int n_early = 0; - int n_cc = 0; + int bads[32]; + int any_bad = 0; + + for ( j=0; j<32; j++ ) bads[j] = 0; for ( j=0; jdiv, - str_flags(crystals[i])); + str_flags(crystal_get_user_flag(crystals[i]))); } fclose(fh); } diff --git a/src/post-refinement.c b/src/post-refinement.c index d62d9323..9054ed89 100644 --- a/src/post-refinement.c +++ b/src/post-refinement.c @@ -458,7 +458,7 @@ static double pr_iterate(Crystal *cr, const RefList *full, } if ( nref < num_params ) { - crystal_set_user_flag(cr, 2); + crystal_set_user_flag(cr, PRFLAG_FEWREFL); gsl_matrix_free(M); gsl_vector_free(v); return 0.0; @@ -476,7 +476,7 @@ static double pr_iterate(Crystal *cr, const RefList *full, } } else { - crystal_set_user_flag(cr, 3); + crystal_set_user_flag(cr, PRFLAG_SOLVEFAIL); } gsl_matrix_free(M); diff --git a/src/post-refinement.h b/src/post-refinement.h index b59ae24f..536dea2d 100644 --- a/src/post-refinement.h +++ b/src/post-refinement.h @@ -53,6 +53,16 @@ struct prdata double final_free_residual; }; +enum prflag +{ + PRFLAG_OK = 0, + PRFLAG_FEWREFL = 16, + PRFLAG_SOLVEFAIL = 17, + PRFLAG_EARLY = 18, + PRFLAG_CC = 19, + PRFLAG_BIGB = 20, +}; + extern void refine_all(Crystal **crystals, int n_crystals, diff --git a/src/rejection.c b/src/rejection.c index a565fec3..e49aaf19 100644 --- a/src/rejection.c +++ b/src/rejection.c @@ -39,6 +39,7 @@ #include "reflist.h" #include "rejection.h" #include "cell-utils.h" +#include "post-refinement.h" static double mean_intensity(RefList *list) @@ -147,7 +148,7 @@ static void check_cc(Crystal *cr, RefList *full) cc = gsl_stats_correlation(vec1, 1, vec2, 1, i); //printf("%f\n", cc); - if ( cc < 0.5 ) crystal_set_user_flag(cr, 6); + if ( cc < 0.5 ) crystal_set_user_flag(cr, PRFLAG_CC); free(vec1); free(vec2); @@ -176,7 +177,7 @@ void check_rejection(Crystal **crystals, int n, RefList *full) /* Reject if B factor modulus is very large */ if ( fabs(crystal_get_Bfac(crystals[i])) > 1e-18 ) { - crystal_set_user_flag(crystals[i], 1); + crystal_set_user_flag(crystals[i], PRFLAG_BIGB); } if ( crystal_get_user_flag(crystals[i]) == 0 ) n_acc++; -- cgit v1.2.3