From a977dfd051fb0483cf27693fc8e950c99e7c88ed Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 30 Nov 2018 17:04:13 +0100 Subject: 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. --- src/post-refinement.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/post-refinement.c') diff --git a/src/post-refinement.c b/src/post-refinement.c index 0a799b9e..b1af92db 100644 --- a/src/post-refinement.c +++ b/src/post-refinement.c @@ -559,7 +559,7 @@ void write_specgraph(Crystal *crystal, const RefList *full, refl != NULL; refl = next_refl(refl, iter) ) { - double corr, Ipart, Ifull, pobs, pcalc; + double Ipart, Ifull, pobs, pcalc; double res; signed int h, k, l; Reflection *match; @@ -573,8 +573,7 @@ void write_specgraph(Crystal *crystal, const RefList *full, /* Don't calculate pobs if reference reflection is weak */ if ( fabs(get_intensity(match)) / get_esd_intensity(match) < 3.0 ) continue; - corr = G * exp(B*res*res) * get_lorentz(refl); - Ipart = get_intensity(refl) * corr; + Ipart = correct_reflection_nopart(refl, G, B, res); Ifull = get_intensity(match); pobs = Ipart / Ifull; pcalc = get_partiality(refl); -- cgit v1.2.3