aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-05-11 13:18:04 +0200
committerThomas White <taw@physics.org>2018-05-11 13:25:08 +0200
commitf6d95bc7f26a5900d001e98d7cf36e9a1981b7f0 (patch)
treefa9d1c671e5e064ff9284225be7d950fad878657 /src
parentb5008197d73329882cff1734a32e7aff02553eb8 (diff)
Fix up scaling definitions
Diffstat (limited to 'src')
-rw-r--r--src/merge.c11
-rw-r--r--src/scaling.c4
2 files changed, 7 insertions, 8 deletions
diff --git a/src/merge.c b/src/merge.c
index aab47ee6..14460953 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -187,7 +187,7 @@ static void run_merge_job(void *vwargs, int cookie)
}
/* Total (multiplicative) correction factor */
- corr = 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");
@@ -319,7 +319,7 @@ double residual(Crystal *cr, const RefList *full, int free,
p = get_partiality(refl);
//if ( p < 0.2 ) continue;
- corr = G * exp(B*res*res) * get_lorentz(refl);
+ corr = get_lorentz(refl) / (G * exp(-B*res*res));
int1 = get_intensity(refl) * corr;
int2 = p*I_full;
w = p;
@@ -363,7 +363,7 @@ double log_residual(Crystal *cr, const RefList *full, int free,
signed int h, k, l;
Reflection *match;
double esd, I_full, I_partial;
- double fx, dc;
+ double fx;
if ( free && !get_flag(refl) ) continue;
@@ -383,10 +383,9 @@ double log_residual(Crystal *cr, const RefList *full, int free,
if ( I_full <= 0 ) continue; /* Because log */
if ( p <= 0.0 ) continue; /* Because of log */
- fx = -log(G) + log(p) - log(L) - B*s*s + log(I_full);
- dc = log(I_partial) - fx;
+ fx = log(G) - B*s*s + log(p) + log(I_full) - log(I_partial) - log(L);
w = 1.0;
- dev += w*dc*dc;
+ dev += w*fx*fx;
if ( fh != NULL ) {
fprintf(fh, "%4i %4i %4i %e %e\n",
diff --git a/src/scaling.c b/src/scaling.c
index 7f9b4cff..cabc5952 100644
--- a/src/scaling.c
+++ b/src/scaling.c
@@ -267,7 +267,7 @@ int scale_one_crystal(Crystal *cr, const RefList *listR, int flags)
}
x[n] = s*s;
- y[n] = log(IhR) - log(pS) + log(LS) - log(IhS);
+ y[n] = log(LS) + log(IhS) -log(pS) - log(IhR);
w[n] = pS;
n++;
@@ -329,7 +329,7 @@ int scale_one_crystal(Crystal *cr, const RefList *listR, int flags)
}
crystal_set_osf(cr, exp(G));
- crystal_set_Bfac(cr, B);
+ crystal_set_Bfac(cr, -B);
free(x);
free(y);