aboutsummaryrefslogtreecommitdiff
path: root/src/rejection.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-11-16 15:07:30 +0100
committerThomas White <taw@physics.org>2018-11-16 15:07:30 +0100
commit89bf2f6de2be2a276d8c349a1fa6ff6c63b5e7fe (patch)
tree43864f83d8c385dd89d30c55f14cf1c7db3bfd19 /src/rejection.c
parent6f6402ae168884b9332f07d3cf9b78ffa8cedb53 (diff)
partialator: Handle partial reflections properly in deltaCChalf
Diffstat (limited to 'src/rejection.c')
-rw-r--r--src/rejection.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/rejection.c b/src/rejection.c
index c07287b3..05acb0db 100644
--- a/src/rejection.c
+++ b/src/rejection.c
@@ -40,6 +40,7 @@
#include "rejection.h"
#include "cell-utils.h"
#include "post-refinement.h"
+#include "merge.h"
static double mean_intensity(RefList *list)
@@ -235,15 +236,19 @@ static double calculate_cchalf(RefList *template, RefList *full,
G = crystal_get_osf(exclude);
B = crystal_get_Bfac(exclude);
- /* Total (multiplicative) correction factor */
- Ii *= 1.0/G * exp(B*res*res) * get_lorentz(exrefl)
- / get_partiality(exrefl);
+ if ( get_partiality(exrefl) > MIN_PART_MERGE ) {
+
+ /* Total (multiplicative) correction factor */
+ Ii *= 1.0/G * exp(B*res*res) * get_lorentz(exrefl)
+ / get_partiality(exrefl);
+
+ /* Remove contribution of this reflection */
+ Ex -= Ii - K;
+ Ex2 -= (Ii - K)*(Ii - K);
- /* Remove contribution of this reflection */
- Ex -= Ii - K;
- Ex2 -= (Ii - K)*(Ii - K);
+ n_removed++;
- n_removed++;
+ }
exrefl = next_found_refl(exrefl);
}
@@ -282,6 +287,7 @@ static void check_deltacchalf(Crystal **crystals, int n, RefList *full)
double *vals;
double mean, sd;
int nref = 0;
+ int nnan = 0;
calculate_refl_mean_var(full);
@@ -305,15 +311,25 @@ static void check_deltacchalf(Crystal **crystals, int n, RefList *full)
//STATUS(" Delta = %f ", (cchalf - cchalfi)*100.0);
//STATUS("(nref = %i)\n", nref);
vals[i] = cchalf - cchalfi;
+ if ( isnan(vals[i]) || isinf(vals[i]) ) {
+ vals[i] = 0.0;
+ nnan++;
+ }
progress_bar(i, n-1, "Calculating deltaCChalf");
}
+ if ( nnan > 0 ) {
+ STATUS("WARNING: %i NaN or inf deltaCChalf values were "
+ "replaced with zero\n", nnan);
+ }
mean = gsl_stats_mean(vals, 1, n);
sd = gsl_stats_sd_m(vals, 1, n, mean);
STATUS("deltaCChalf = %f ± %f %%\n", mean*100.0, sd*100.0);
for ( i=0; i<n; i++ ) {
- if ( (vals[i]<0.0) && (vals[i] < mean-2.0*sd) ) {
+ if ( isnan(vals[i]) || isinf(vals[i])
+ || ((vals[i]<0.0) && (vals[i] < mean-2.0*sd)) )
+ {
crystal_set_user_flag(crystals[i], PRFLAG_DELTACCHALF);
}
}