aboutsummaryrefslogtreecommitdiff
path: root/src/rejection.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-11-22 16:19:21 +0100
committerThomas White <taw@physics.org>2018-11-22 16:20:40 +0100
commita166b0ae68b99bea3f2e08cc508a863a0f36073b (patch)
treed05946d0dd112ea30116f631250519b6bcffd7af /src/rejection.c
parentf30cc81c78493b3e0299f15a2ebf38aad2ba8e28 (diff)
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.
Diffstat (limited to 'src/rejection.c')
-rw-r--r--src/rejection.c16
1 files changed, 13 insertions, 3 deletions
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);