aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/partialator.c85
-rw-r--r--src/post-refinement.c4
-rw-r--r--src/post-refinement.h10
-rw-r--r--src/rejection.c5
4 files changed, 43 insertions, 61 deletions
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; j<n_crystals; j++ ) {
int flag;
flag = crystal_get_user_flag(crystals[j]);
- if ( flag != 0 ) n_dud++;
- switch ( flag ) {
-
- case 0:
- break;
-
- case 1:
- n_noscale++;
- break;
-
- case 2:
- n_noref++;
- break;
-
- case 3:
- n_solve++;
- break;
-
- case 5:
- n_early++;
- break;
-
- case 6:
- n_cc++;
- break;
-
- default:
- STATUS("Unknown flag %i\n", flag);
- break;
- }
+ assert(flag < 32);
+ bads[flag]++;
+ if ( flag != PRFLAG_OK ) any_bad++;
}
- if ( n_dud ) {
- STATUS("%i bad crystals:\n", n_dud);
- STATUS(" %i scaling failed.\n", n_noscale);
- STATUS(" %i not enough reflections.\n", n_noref);
- STATUS(" %i solve failed.\n", n_solve);
- STATUS(" %i early rejection.\n", n_early);
- STATUS(" %i bad CC.\n", n_cc);
+ if ( any_bad ) {
+ STATUS("%i bad crystals:\n", any_bad);
+ for ( j=0; j<32; j++ ) {
+ if ( bads[j] ) {
+ STATUS(" %i %s\n", bads[j], str_flags(j));
+ }
+ }
}
}
@@ -658,7 +629,7 @@ int main(int argc, char *argv[])
as = asymmetric_indices(cr_refl, sym);
crystal_set_reflections(cr, as);
- crystal_set_user_flag(cr, 0);
+ crystal_set_user_flag(cr, PRFLAG_OK);
reflist_free(cr_refl);
if ( set_initial_params(cr, sparams_fh) ) {
@@ -792,7 +763,7 @@ int main(int argc, char *argv[])
crystal_get_osf(crystals[i]),
crystal_get_Bfac(crystals[i])*1e20,
crystal_get_image(crystals[i])->div,
- 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++;