From e81b216071cce94906544552476b101378f616f1 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 14 Feb 2011 17:34:41 -0800 Subject: Set matrix elements to zero if no common reflections (NB broken) --- src/hrs-scaling.c | 48 +++++++++++++++++++++++++++++++++++++++++++++--- src/hrs-scaling.h | 5 +++-- src/partialator.c | 8 ++++++-- 3 files changed, 54 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/hrs-scaling.c b/src/hrs-scaling.c index 99490251..e2adaaf6 100644 --- a/src/hrs-scaling.c +++ b/src/hrs-scaling.c @@ -35,6 +35,45 @@ #define MAX_CYCLES (30) +char *find_common_reflections(struct image *images, int n) +{ + int i; + char *cref; + + cref = calloc(n*n, sizeof(char)); + + for ( i=0; i a ) continue; + /* Zero if no common reflections */ + if ( cref[a+n*b] != 0 ) continue; + uhb = uha_arr[b]; vhb = vha_arr[b]; rhb = vhb - image_b->osf * uhb * Ih; @@ -336,7 +378,7 @@ static void normalise_osfs(struct image *images, int n) /* Scale the stack of images */ double *scale_intensities(struct image *images, int n, const char *sym, - ReflItemList *obs) + ReflItemList *obs, char *cref) { int m; double *I_full; @@ -350,7 +392,7 @@ double *scale_intensities(struct image *images, int n, const char *sym, i = 0; do { - max_shift = iterate_scale(images, n, obs, sym); + max_shift = iterate_scale(images, n, obs, sym, cref); STATUS("Iteration %2i: max shift = %5.2f\n", i, max_shift); i++; normalise_osfs(images, n); diff --git a/src/hrs-scaling.h b/src/hrs-scaling.h index ae384aa8..04a321e3 100644 --- a/src/hrs-scaling.h +++ b/src/hrs-scaling.h @@ -20,8 +20,9 @@ #include "image.h" -extern double *scale_intensities(struct image *image, int n, const char *sym, - ReflItemList *obs); +extern double *scale_intensities(struct image *images, int n, const char *sym, + ReflItemList *obs, char *cref); +extern char *find_common_reflections(struct image *images, int n); #endif /* HRS_SCALING_H */ diff --git a/src/partialator.c b/src/partialator.c index 309343cb..e99b2291 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -161,6 +161,7 @@ int main(int argc, char *argv[]) int n_found = 0; int n_expected = 0; int n_notfound = 0; + char *cref; /* Long options */ const struct option longopts[] = { @@ -379,12 +380,13 @@ int main(int argc, char *argv[]) STATUS("Mean measurements per unique reflection: %5.2f\n", (double)n_found / num_items(obs)); + cref = find_common_reflections(images, n_total_patterns); cts = new_list_count(); /* Make initial estimates */ STATUS("Performing initial scaling.\n"); select_scalable_reflections(images, n_total_patterns); - I_full = scale_intensities(images, n_total_patterns, sym, obs); + I_full = scale_intensities(images, n_total_patterns, sym, obs, cref); /* Iterate */ for ( i=0; i