diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hrs-scaling.c | 50 | ||||
-rw-r--r-- | src/reflist.c | 49 | ||||
-rw-r--r-- | src/reflist.h | 1 |
3 files changed, 69 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); } diff --git a/src/reflist.c b/src/reflist.c index 990bc535..7f5d011e 100644 --- a/src/reflist.c +++ b/src/reflist.c @@ -77,6 +77,11 @@ Reflection *find_refl(RefList *list, INDICES) } +Reflection *next_found_refl(Reflection *refl) +{ +} + + /********************************** Getters ***********************************/ double get_excitation_error(Reflection *refl) @@ -94,6 +99,27 @@ void get_indices(Reflection *refl, signed int *h, signed int *k, signed int *l) } +double get_partiality(Reflection *refl) +{ +} + + +double get_intensity(Reflection *refl) +{ +} + + +void get_partial(Reflection *refl, double *r1, double *r2, double *p, + int *clamp_low, int *clamp_high) +{ +} + + +int get_scalable(Reflection *refl) +{ +} + + /********************************** Setters ***********************************/ void set_detector_pos(Reflection *refl, double exerr, double x, double y) @@ -107,6 +133,22 @@ void set_partial(Reflection *refl, double r1, double r2, double p, } +void set_indices(Reflection *refl, + signed int h, signed int k, signed int l) +{ +} + + +void set_int(Reflection *refl, double intensity) +{ +} + + +void set_scalable(Reflection *refl, int scalable) +{ +} + + /********************************* Insertion **********************************/ Reflection *add_refl(RefList *list, INDICES) @@ -120,6 +162,13 @@ Reflection *add_refl_with_det_pos(RefList *refl, INDICES, double exerr, } +/********************************** Deletion **********************************/ + +void delete_refl(Reflection *refl) +{ +} + + /********************************* Iteration **********************************/ Reflection *first_refl(RefList *list) diff --git a/src/reflist.h b/src/reflist.h index 0ba09a3b..d1f0d53c 100644 --- a/src/reflist.h +++ b/src/reflist.h @@ -28,6 +28,7 @@ extern void reflist_free(RefList *list); /* Search */ extern Reflection *find_refl(RefList *list, INDICES); +extern Reflection *next_found_refl(Reflection *refl); /* Get */ extern double get_excitation_error(Reflection *refl); |