From dc854c240913d4c179f49c35f7b869e2c39b86c7 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 26 Oct 2017 15:51:29 +0200 Subject: Store scale factor in linear form --- src/merge.c | 2 +- src/partialator.c | 4 ++-- src/post-refinement.c | 2 +- src/rejection.c | 2 +- src/scaling.c | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/merge.c b/src/merge.c index 17e57c90..33221bda 100644 --- a/src/merge.c +++ b/src/merge.c @@ -189,7 +189,7 @@ static void run_merge_job(void *vwargs, int cookie) } /* Total (multiplicative) correction factor */ - corr = exp(-G) * exp(B*res*res) * get_lorentz(refl) + corr = (1.0/G) * exp(B*res*res) * get_lorentz(refl) / get_partiality(refl); if ( isnan(corr) ) { ERROR("NaN corr:\n"); diff --git a/src/partialator.c b/src/partialator.c index af04d935..033efe27 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -637,7 +637,7 @@ static void write_to_pgraph(FILE *fh, RefList *list, RefList *full, Crystal *cr, pcalc = get_partiality(refl); /* Observed partiality */ - corr = exp(-G) * exp(B*res*res) * get_lorentz(refl); + corr = (1.0/G) * exp(B*res*res) * get_lorentz(refl); Ipart = get_intensity(refl) * corr; pobs = Ipart / get_intensity(match); @@ -689,7 +689,7 @@ static void write_specgraph(RefList *full, Crystal *crystal, int in) match = find_refl(full, h, k, l); if ( match == NULL ) continue; - corr = exp(-G) * exp(B*res*res) * get_lorentz(refl); + corr = (1.0/G) * exp(B*res*res) * get_lorentz(refl); Ipart = get_intensity(refl) * corr; Ifull = get_intensity(match); esd = get_esd_intensity(match); diff --git a/src/post-refinement.c b/src/post-refinement.c index 5624b15d..579db7e4 100644 --- a/src/post-refinement.c +++ b/src/post-refinement.c @@ -115,7 +115,7 @@ double residual(Crystal *cr, const RefList *full, int free, p = get_partiality(refl); //if ( p < 0.2 ) continue; - corr = exp(-G) * exp(B*res*res) * get_lorentz(refl); + corr = (1.0/G) * exp(B*res*res) * get_lorentz(refl); int1 = get_intensity(refl) * corr; int2 = p*I_full; w = 1.0; diff --git a/src/rejection.c b/src/rejection.c index 10f13f9c..a44b697f 100644 --- a/src/rejection.c +++ b/src/rejection.c @@ -137,7 +137,7 @@ static void check_cc(Crystal *cr, RefList *full) pcalc = get_partiality(refl); /* Observed partiality */ - corr = exp(-G) * exp(B*res*res) * get_lorentz(refl); + corr = (1.0/G) * exp(B*res*res) * get_lorentz(refl); Ipart = get_intensity(refl) * corr; pobs = Ipart / get_intensity(match); diff --git a/src/scaling.c b/src/scaling.c index 0908cfb3..c7c608fe 100644 --- a/src/scaling.c +++ b/src/scaling.c @@ -183,7 +183,7 @@ static double scale_iterate(Crystal *cr, const RefList *full, } - fx = G + log(p) - log(L) - B*s*s + log(I_full); + fx = -log(G) + log(p) - log(L) - B*s*s + log(I_full); delta_I = log(I_partial) - fx; v_c = w * delta_I * gradients[k]; v_curr = gsl_vector_get(v, k); @@ -549,7 +549,7 @@ void scale_all_to_reference(Crystal **crystals, int n_crystals, for ( i=0; i