From a166b0ae68b99bea3f2e08cc508a863a0f36073b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 22 Nov 2018 16:19:21 +0100 Subject: Count crystals with no reflections in various FoMs This is the most common cause of NaN residuals, so it seems better to report that there weren't enough reflections than to report a NaN. --- src/rejection.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/rejection.c') diff --git a/src/rejection.c b/src/rejection.c index b3a3cb67..6ec59151 100644 --- a/src/rejection.c +++ b/src/rejection.c @@ -289,6 +289,7 @@ static void check_deltacchalf(Crystal **crystals, int n, RefList *full) double mean, sd; int nref = 0; int nnan = 0; + int nnon = 0; if ( calculate_refl_mean_var(full) ) { STATUS("No reflection contributions for deltaCChalf " @@ -315,13 +316,22 @@ static void check_deltacchalf(Crystal **crystals, int n, RefList *full) //STATUS("Without = %f", cchalfi*100.0); //STATUS(" Delta = %f ", (cchalf - cchalfi)*100.0); //STATUS("(nref = %i)\n", nref); - vals[i] = cchalf - cchalfi; - if ( isnan(vals[i]) || isinf(vals[i]) ) { + if ( nref == 0 ) { vals[i] = 0.0; - nnan++; + nnon++; + } else { + vals[i] = cchalf - cchalfi; + if ( isnan(vals[i]) || isinf(vals[i]) ) { + vals[i] = 0.0; + nnan++; + } } progress_bar(i, n-1, "Calculating deltaCChalf"); } + if ( nnon > 0 ) { + STATUS("WARNING: %i patterns had no reflections in deltaCChalf " + "calculation (I set deltaCChalf=zero for them)\n", nnon); + } if ( nnan > 0 ) { STATUS("WARNING: %i NaN or inf deltaCChalf values were " "replaced with zero\n", nnan); -- cgit v1.2.3