aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-07-01 18:10:24 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:31 +0100
commitf249b77f9d3110381b729adca8c061f9fa00d09a (patch)
tree2447e0f8c6ee5129db75efcb8db030100de08630
parent0ec021f6e448c7341e1fb0959a9acc3cb8bd6f9a (diff)
Remove anything which deletes a reflection or optimises a RefList
-rw-r--r--src/compare_hkl.c49
-rw-r--r--src/partialator.c1
-rw-r--r--src/reflist-utils.c7
-rw-r--r--tests/list_check.c89
4 files changed, 20 insertions, 126 deletions
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index 08cbabbd..0ed48311 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -265,9 +265,9 @@ int main(int argc, char *argv[])
int ncom;
RefList *list1;
RefList *list2;
+ RefList *list1_transformed;
RefList *list2_transformed;
RefList *ratio;
- RefList *deleteme;
int config_shells = 0;
char *pdb = NULL;
int rej1 = 0;
@@ -384,9 +384,9 @@ int main(int argc, char *argv[])
}
/* Find common reflections (taking symmetry into account) */
+ list1_transformed = reflist_new();
list2_transformed = reflist_new();
ratio = reflist_new();
- deleteme = reflist_new();
for ( refl1 = first_refl(list1, &iter);
refl1 != NULL;
refl1 = next_refl(refl1, iter) )
@@ -403,11 +403,11 @@ int main(int argc, char *argv[])
get_indices(refl1, &h, &k, &l);
if ( !find_equiv_in_list(list2, h, k, l, sym, &he, &ke, &le) ) {
- /* No common reflection */
- add_refl(deleteme, h, k, l);
continue;
}
+ copy_data(add_refl(list1_transformed, h, k, l), refl1);
+
refl2 = find_refl(list2, he, ke, le);
assert(refl2 != NULL);
@@ -457,22 +457,7 @@ int main(int argc, char *argv[])
STATUS("%i,%i reflections: %i in common\n",
num_reflections(list1), num_reflections(list2), ncom);
- /* Trim reflections from 'list1' which had no equivalents in 'list2' */
- for ( refl1 = first_refl(deleteme, &iter);
- refl1 != NULL;
- refl1 = next_refl(refl1, iter) ) {
-
- signed int h, k, l;
- Reflection *del;
-
- get_indices(refl1, &h, &k, &l);
- del = find_refl(list1, h, k, l);
- assert(del != NULL);
-
- delete_refl(del);
-
- }
- reflist_free(deleteme);
+ reflist_free(list1);
reflist_free(list2);
/* Trimming the other way round is not necessary,
@@ -480,49 +465,51 @@ int main(int argc, char *argv[])
arr2 = intensities_from_list(list2_transformed);
reflist_free(list2_transformed);
- R1 = stat_r1_ignore(list1, arr2, &scale_r1fi, config_unity);
+ R1 = stat_r1_ignore(list1_transformed, arr2, &scale_r1fi, config_unity);
STATUS("R1(F) = %5.4f %% (scale=%5.2e)"
" (ignoring negative intensities)\n",
R1*100.0, scale_r1fi);
- R1 = stat_r1_zero(list1, arr2, &scale_r1, config_unity);
+ R1 = stat_r1_zero(list1_transformed, arr2, &scale_r1, config_unity);
STATUS("R1(F) = %5.4f %% (scale=%5.2e)"
" (zeroing negative intensities)\n",
R1*100.0, scale_r1);
- R2 = stat_r2(list1, arr2, &scale_r2, config_unity);
+ R2 = stat_r2(list1_transformed, arr2, &scale_r2, config_unity);
STATUS("R2(I) = %5.4f %% (scale=%5.2e)\n", R2*100.0, scale_r2);
- R1i = stat_r1_i(list1, arr2, &scale_r1i, config_unity);
+ R1i = stat_r1_i(list1_transformed, arr2, &scale_r1i, config_unity);
STATUS("R1(I) = %5.4f %% (scale=%5.2e)\n", R1i*100.0, scale_r1i);
- Rdiff = stat_rdiff_ignore(list1, arr2, &scale_rdig, config_unity);
+ Rdiff = stat_rdiff_ignore(list1_transformed, arr2, &scale_rdig,
+ config_unity);
STATUS("Rint(F) = %5.4f %% (scale=%5.2e)"
" (ignoring negative intensities)\n",
Rdiff*100.0, scale_rdig);
- Rdiff = stat_rdiff_zero(list1, arr2, &scale, config_unity);
+ Rdiff = stat_rdiff_zero(list1_transformed, arr2, &scale, config_unity);
STATUS("Rint(F) = %5.4f %% (scale=%5.2e)"
" (zeroing negative intensities)\n",
Rdiff*100.0, scale);
- Rdiff = stat_rdiff_intensity(list1, arr2, &scale_rintint, config_unity);
+ Rdiff = stat_rdiff_intensity(list1_transformed, arr2, &scale_rintint,
+ config_unity);
STATUS("Rint(I) = %5.4f %% (scale=%5.2e)\n",
Rdiff*100.0, scale_rintint);
- pearson = stat_pearson_i(list1, arr2);
+ pearson = stat_pearson_i(list1_transformed, arr2);
STATUS("Pearson r(I) = %5.4f\n", pearson);
- pearson = stat_pearson_f_ignore(list1, arr2);
+ pearson = stat_pearson_f_ignore(list1_transformed, arr2);
STATUS("Pearson r(F) = %5.4f (ignoring negative intensities)\n",
pearson);
- pearson = stat_pearson_f_zero(list1, arr2);
+ pearson = stat_pearson_f_zero(list1_transformed, arr2);
STATUS("Pearson r(F) = %5.4f (zeroing negative intensities)\n",
pearson);
if ( config_shells ) {
- plot_shells(list1, arr2, scale_r1i,
+ plot_shells(list1_transformed, arr2, scale_r1i,
cell, sym, rmin_fix, rmax_fix);
}
diff --git a/src/partialator.c b/src/partialator.c
index ae13f147..101fe29f 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -350,7 +350,6 @@ int main(int argc, char *argv[])
/* This is the raw list of reflections */
as = asymmetric_indices(images[n_usable_patterns].reflections,
sym);
- optimise_reflist(as);
reflist_free(images[n_usable_patterns].reflections);
images[n_usable_patterns].reflections = as;
diff --git a/src/reflist-utils.c b/src/reflist-utils.c
index 0ae1f31b..016fa317 100644
--- a/src/reflist-utils.c
+++ b/src/reflist-utils.c
@@ -302,10 +302,7 @@ RefList *read_reflections_from_file(FILE *fh)
if ( rval == NULL ) continue;
chomp(line);
- if ( strcmp(line, REFLECTION_END_MARKER) == 0 ) {
- optimise_reflist(out);
- return out;
- }
+ if ( strcmp(line, REFLECTION_END_MARKER) == 0 ) return out;
r = sscanf(line, "%i %i %i %f %s %f %s %i %f %f",
&h, &k, &l, &intensity, phs, &sigma, ress, &cts,
@@ -321,7 +318,7 @@ RefList *read_reflections_from_file(FILE *fh)
double ph;
char *v;
- refl = add_serialised_refl(out, h, k, l);
+ refl = add_refl(out, h, k, l);
set_int(refl, intensity);
set_detector_pos(refl, 0.0, fs, ss);
set_esd_intensity(refl, sigma);
diff --git a/tests/list_check.c b/tests/list_check.c
index 180aeb6a..5e943c72 100644
--- a/tests/list_check.c
+++ b/tests/list_check.c
@@ -87,8 +87,6 @@ static int test_lists(int num_items)
}
- optimise_reflist(list);
-
/* Iterate over the list and check we find everything */
int count = 0;
for ( refl = first_refl(list, &iter);
@@ -154,93 +152,6 @@ static int test_lists(int num_items)
}
- /* Delete some reflections */
- for ( i=0; i<num_items/2; i++ ) {
-
- int j;
- signed int h, k, l;
- Reflection *refl;
-
- h = check[i].h;
- k = check[i].k;
- l = check[i].l;
-
- refl = find_refl(list, h, k, l);
- delete_refl(refl);
-
- /* Update all counts */
- for ( j=0; j<num_items; j++ ) {
- if ( (check[j].h == h) && (check[j].k == k)
- && (check[j].l == l) ) check[j].num--;
- }
-
- }
-
- /* Check that the deleted reflections can no longer be found */
- for ( i=0; i<num_items; i++ ) {
-
- signed int h, k, l;
- Reflection *refl;
-
- h = check[i].h;
- k = check[i].k;
- l = check[i].l;
-
- if ( check[i].num > 0 ) continue;
-
- refl = find_refl(list, h, k, l);
- if ( refl != NULL ) {
-
- fprintf(stderr, "Found %3i %i %3i after deletion.\n",
- h, k, l);
- return 1;
-
- }
-
- }
-
- /* Delete remaining duplicates */
- for ( i=0; i<num_items; i++ ) {
-
- signed int h, k, l;
- Reflection *refl;
-
- if ( check[i].num == 0 ) continue;
-
- h = check[i].h;
- k = check[i].k;
- l = check[i].l;
- refl = find_refl(list, h, k, l);
-
- do {
- int j;
- signed int ha, ka, la;
- Reflection *next;
- get_indices(refl, &ha, &ka, &la);
- next = next_found_refl(refl);
- delete_refl(refl);
- refl = next;
- for ( j=0; j<num_items; j++ ) {
- if ( (check[j].h == h) && (check[j].k == k)
- && (check[j].l == l) ) check[j].num--;
- }
- } while ( refl != NULL );
-
- if ( check[i].num != 0 ) {
- fprintf(stderr, "Found too few duplicates (%i) for "
- "%3i %3i %3i\n", check[i].num, h, k, l);
- return 1;
- }
-
- refl = find_refl(list, h, k, l);
- if ( refl != NULL ) {
- fprintf(stderr, "Found too many duplicates for "
- "%3i %3i %3i\n", h, k, l);
- return 1;
- }
-
- }
-
reflist_free(list);
free(check);