From b70749514f280e038ebf734a2deb0fbbc84a063a Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 31 Jan 2011 22:16:45 +0100 Subject: Fix Kabsch scaling...! --- src/hrs-scaling.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/hrs-scaling.c b/src/hrs-scaling.c index 13c945e9..4a91adc2 100644 --- a/src/hrs-scaling.c +++ b/src/hrs-scaling.c @@ -140,26 +140,30 @@ static double s_vha(signed int hat, signed int kat, signed int lat, } -static double s_uh(struct image *images, int n, double uha) +static double s_uh(struct image *images, int n, + signed int h, signed int k, signed int l, const char *sym) { - int k; + int a; double val = 0.0; - for ( k=0; kh; + const signed int k = it->k; + const signed int l = it->l; /* Determine the "solution" vector component */ - vha = s_vha(it->h, it->k, it->l, images, n, sym, a); - uha = s_uha(it->h, it->k, it->l, images, n, sym, a); - uh = s_uh(images, n, uha); - Ih = s_vh(images, n, vha) / uh; + vha = s_vha(h, k, l, images, n, sym, a); + uha = s_uha(h, k, l, images, n, sym, a); + uh = s_uh(images, n, h, k, l, sym); + Ih = s_vh(images, n, h, k, l, sym) / uh; rha = vha - image_a->osf * uha * Ih; vc = Ih * rha; vc_tot += vc; @@ -221,10 +228,8 @@ static double iterate_scale(struct image *images, int n, bcomp = b; if ( b > crossed ) bcomp--; - vhb = s_vha(it->h, it->k, it->l, images, n, - sym, b); - uhb = s_uha(it->h, it->k, it->l, images, n, - sym, b); + vhb = s_vha(h, k, l, images, n, sym, b); + uhb = s_uha(h, k, l, images, n, sym, b); rhb = vhb - image_b->osf * uhb * Ih; mc = (rha*vhb + vha*rhb - vha*vhb) / uh; -- cgit v1.2.3