aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/partialator.c60
-rw-r--r--src/post-refinement.c28
-rw-r--r--src/post-refinement.h1
-rw-r--r--src/rejection.c30
4 files changed, 60 insertions, 59 deletions
diff --git a/src/partialator.c b/src/partialator.c
index 8a594116..24f8a6d1 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -100,34 +100,6 @@ static void display_progress(int n_images, int n_crystals)
}
-static const char *str_flags(flag)
-{
- switch ( flag ) {
-
- case PRFLAG_OK :
- return "OK";
-
- case PRFLAG_FEWREFL :
- return "not enough reflections";
-
- case PRFLAG_SOLVEFAIL :
- return "PR solve failed";
-
- case PRFLAG_EARLY :
- return "early rejection";
-
- case PRFLAG_CC :
- return "low CC";
-
- case PRFLAG_BIGB :
- return "B too big";
-
- default :
- return "Unknown flag";
- }
-}
-
-
static RefList *apply_max_adu(RefList *list, double max_adu)
{
RefList *nlist;
@@ -192,33 +164,6 @@ static int set_initial_params(Crystal *cr, FILE *fh)
}
-static void show_duds(Crystal **crystals, int n_crystals)
-{
- int j;
- 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]);
- assert(flag < 32);
- bads[flag]++;
- if ( flag != PRFLAG_OK ) any_bad++;
- }
-
- 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));
- }
- }
- }
-}
-
-
/* Flag a random 5% of reflections */
static void select_free_reflections(RefList *list, gsl_rng *rng)
{
@@ -696,8 +641,6 @@ int main(int argc, char *argv[])
check_rejection(crystals, n_crystals, full);
- show_duds(crystals, n_crystals);
-
write_pgraph(full, crystals, n_crystals, 0);
/* Iterate */
@@ -718,7 +661,6 @@ int main(int argc, char *argv[])
STATUS("Overall free residual: initial = %e, final = %e\n",
init_free_dev, final_free_dev);
- show_duds(crystals, n_crystals);
check_rejection(crystals, n_crystals, full);
normalise_scales(crystals, n_crystals);
@@ -773,7 +715,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(crystal_get_user_flag(crystals[i])));
+ str_prflag(crystal_get_user_flag(crystals[i])));
}
fclose(fh);
}
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 83bb0d0e..d21108fd 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -54,6 +54,34 @@
/* Maximum number of iterations of NLSq to do for each image per macrocycle. */
#define MAX_CYCLES (10)
+const char *str_prflag(enum prflag flag)
+{
+ switch ( flag ) {
+
+ case PRFLAG_OK :
+ return "OK";
+
+ case PRFLAG_FEWREFL :
+ return "not enough reflections";
+
+ case PRFLAG_SOLVEFAIL :
+ return "PR solve failed";
+
+ case PRFLAG_EARLY :
+ return "early rejection";
+
+ case PRFLAG_CC :
+ return "low CC";
+
+ case PRFLAG_BIGB :
+ return "B too big";
+
+ default :
+ return "Unknown flag";
+ }
+}
+
+
/* Returns dp(gauss)/dr at "r" */
static double gaussian_fraction_gradient(double r, double R)
{
diff --git a/src/post-refinement.h b/src/post-refinement.h
index 536dea2d..fc72918f 100644
--- a/src/post-refinement.h
+++ b/src/post-refinement.h
@@ -64,6 +64,7 @@ enum prflag
};
+extern const char *str_prflag(enum prflag flag);
extern void refine_all(Crystal **crystals, int n_crystals,
RefList *full, int nthreads, PartialityModel pmodel,
diff --git a/src/rejection.c b/src/rejection.c
index e49aaf19..cea43701 100644
--- a/src/rejection.c
+++ b/src/rejection.c
@@ -165,6 +165,34 @@ static void check_ccs(Crystal **crystals, int n_crystals, RefList *full)
}
+
+static void show_duds(Crystal **crystals, int n_crystals)
+{
+ int j;
+ 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]);
+ assert(flag < 32);
+ bads[flag]++;
+ if ( flag != PRFLAG_OK ) any_bad++;
+ }
+
+ 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_prflag(j));
+ }
+ }
+ }
+}
+
+
void check_rejection(Crystal **crystals, int n, RefList *full)
{
int i;
@@ -184,6 +212,8 @@ void check_rejection(Crystal **crystals, int n, RefList *full)
}
+ show_duds(crystals, n);
+
if ( n_acc < 2 ) {
ERROR("Not enough crystals left to proceed (%i). Sorry.\n",
n_acc);