aboutsummaryrefslogtreecommitdiff
path: root/src/hrs-scaling.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-02-06 22:28:46 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:13 +0100
commitf649cc8921b73d85123950c066859f7afe7451b2 (patch)
tree277579e9a9a3bc9c52857f3c8b1a424b7a2b474b /src/hrs-scaling.c
parentbbb90c2f911b071adca3e4cafec36913ae6d3599 (diff)
Banish "struct cpeak" forever
Diffstat (limited to 'src/hrs-scaling.c')
-rw-r--r--src/hrs-scaling.c50
1 files changed, 19 insertions, 31 deletions
diff --git a/src/hrs-scaling.c b/src/hrs-scaling.c
index f2ddaaba..d5d96ffc 100644
--- a/src/hrs-scaling.c
+++ b/src/hrs-scaling.c
@@ -28,6 +28,7 @@
#include "geometry.h"
#include "cell.h"
#include "utils.h"
+#include "reflist.h"
/* Maximum number of iterations of NLSq scaling per macrocycle. */
@@ -39,20 +40,18 @@ static void s_uhavha(signed int hat, signed int kat, signed int lat,
{
double uha_val = 0.0;
double vha_val = 0.0;
- struct cpeak *spots = image->cpeaks;
- int hi;
+ RefList *reflections = image->reflections;
+ Reflection *refl;
- for ( hi=0; hi<image->n_cpeaks; hi++ ) {
+ for ( refl = find_refl(reflections, hat, kat, lat);
+ refl != NULL;
+ refl = next_found_refl(refl) ) {
double ic, sigi;
- if ( !spots[hi].scalable ) continue;
+ if ( !get_scalable(refl) ) continue;
- if ( spots[hi].h != hat ) continue;
- if ( spots[hi].k != kat ) continue;
- if ( spots[hi].l != lat ) continue;
-
- ic = spots[hi].intensity / spots[hi].p;
+ ic = get_intensity(refl) / get_partiality(refl);
sigi = sqrt(fabs(ic));
uha_val += 1.0 / pow(sigi, 2.0);
@@ -278,49 +277,38 @@ static double *lsq_intensities(struct image *images, int n,
I_full = new_list_intensity();
for ( i=0; i<num_items(obs); i++ ) {
- signed int h, k, l;
struct refl_item *it = get_item(obs, i);
double num = 0.0;
double den = 0.0;
int m;
- get_asymm(it->h, it->k, it->l, &h, &k, &l, sym);
-
/* For each frame */
for ( m=0; m<n; m++ ) {
double G;
- int a;
+ Reflection *refl;
G = images[m].osf;
- /* For each peak */
- for ( a=0; a<images[m].n_cpeaks; a++ ) {
-
- signed int ha, ka, la;
+ for ( refl = find_refl(images[m].reflections,
+ it->h, it->k, it->l);
+ refl != NULL;
+ refl = next_found_refl(refl) ) {
- if ( !images[m].cpeaks[a].scalable ) continue;
+ double p;
- /* Correct reflection? */
- get_asymm(images[m].cpeaks[a].h,
- images[m].cpeaks[a].k,
- images[m].cpeaks[a].l,
- &ha, &ka, &la, sym);
- if ( ha != h ) continue;
- if ( ka != k ) continue;
- if ( la != l ) continue;
+ if ( !get_scalable(refl) ) continue;
- num += images[m].cpeaks[a].intensity
- * images[m].cpeaks[a].p * G;
+ p = get_partiality(refl);
- den += pow(images[m].cpeaks[a].p, 2.0)
- * pow(G, 2.0);
+ num += get_intensity(refl) * p * G;
+ den += pow(p, 2.0) * pow(G, 2.0);
}
}
- set_intensity(I_full, h, k, l, num/den);
+ set_intensity(I_full, it->h, it->k, it->l, num/den);
}