diff options
author | Thomas White <taw@physics.org> | 2018-11-30 17:04:13 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-11-30 17:04:13 +0100 |
commit | a977dfd051fb0483cf27693fc8e950c99e7c88ed (patch) | |
tree | 074684efd4bd5310852670e7d8abe1d4e6b515f5 /src/rejection.c | |
parent | 6e9655241ff531b300d38d3e2f5a1e5c7d69f7b3 (diff) |
Factorise correction of intensity for G, B, p and L
There were no fewer than 8 different places in the code where these
factors needed to be applied. They all need to agree on conventions
such as whether the intensities in the pattern should be multiplied or
divided by G to "correct" them. They were not.
This commit reduces the number of places to three: one function
(actually two functions, so that the value before partiality can also be
calculated consistently), plus log_residual and scale_one_crystal, where
slightly different logarithmic versions are used instead.
Diffstat (limited to 'src/rejection.c')
-rw-r--r-- | src/rejection.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/rejection.c b/src/rejection.c index 6ec59151..5d1041fa 100644 --- a/src/rejection.c +++ b/src/rejection.c @@ -143,11 +143,7 @@ static int calculate_refl_mean_var(RefList *full) G = crystal_get_osf(c->contrib_crystals[j]); B = crystal_get_Bfac(c->contrib_crystals[j]); - Ii = get_intensity(c->contribs[j]); - - /* Total (multiplicative) correction factor */ - Ii *= 1.0/G * exp(B*res*res) * get_lorentz(c->contribs[j]) - / get_partiality(c->contribs[j]); + Ii = correct_reflection(c->contribs[j], G, B, res); Ex += Ii - K; Ex2 += (Ii - K) * (Ii - K); @@ -232,16 +228,13 @@ static double calculate_cchalf(RefList *template, RefList *full, while ( exrefl != NULL ) { double G, B; - double Ii = get_intensity(exrefl); G = crystal_get_osf(exclude); B = crystal_get_Bfac(exclude); 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); + double Ii = correct_reflection(exrefl, G, B, res); /* Remove contribution of this reflection */ Ex -= Ii - K; |