From 86e621ad289638d7bf1440092cffd4c2ac64f982 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 16 Mar 2011 18:23:48 +0100 Subject: Remove old reflections.h --- src/reflist-utils.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 242 insertions(+), 5 deletions(-) (limited to 'src/reflist-utils.c') diff --git a/src/reflist-utils.c b/src/reflist-utils.c index 33d373b8..aac94fbf 100644 --- a/src/reflist-utils.c +++ b/src/reflist-utils.c @@ -15,6 +15,153 @@ #include "reflist.h" #include "cell.h" +#include "utils.h" +#include "reflist-utils.h" +#include "symmetry.h" + + +double *intensities_from_list(RefList *list) +{ + Reflection *refl; + RefListIterator *iter; + double *out = new_list_intensity(); + + for ( refl = first_refl(list, &iter); + refl != NULL; + refl = next_refl(refl, iter) ) { + + signed int h, k, l; + double intensity = get_intensity(refl); + + get_indices(refl, &h, &k, &l); + + set_intensity(out, h, k, l, intensity); + + } + + return out; +} + + +double *phases_from_list(RefList *list) +{ + Reflection *refl; + RefListIterator *iter; + double *out = new_list_phase(); + + for ( refl = first_refl(list, &iter); + refl != NULL; + refl = next_refl(refl, iter) ) { + + signed int h, k, l; + double phase = get_phase(refl); + + get_indices(refl, &h, &k, &l); + + set_phase(out, h, k, l, phase); + + } + + return out; + +} + + +unsigned char *flags_from_list(RefList *list) +{ + Reflection *refl; + RefListIterator *iter; + unsigned char *out = new_list_flag(); + + for ( refl = first_refl(list, &iter); + refl != NULL; + refl = next_refl(refl, iter) ) { + + signed int h, k, l; + + get_indices(refl, &h, &k, &l); + + set_flag(out, h, k, l, 1); + + } + + return out; + +} + + +int check_list_symmetry(RefList *list, const char *sym) +{ + unsigned char *flags; + Reflection *refl; + RefListIterator *iter; + + flags = flags_from_list(list); + + for ( refl = first_refl(list, &iter); + refl != NULL; + refl = next_refl(refl, iter) ) { + + int j; + int found = 0; + signed int h, k, l; + + get_indices(refl, &h, &k, &l); + + for ( j=0; j INDMAX ) continue; + if ( abs(le) > INDMAX ) continue; + if ( abs(ke) > INDMAX ) continue; + + found += lookup_flag(flags, he, ke, le); + + } + + if ( found > 1 ) { + free(flags); + return 1; /* Symmetry is wrong! */ + } + + } + + free(flags); + + return 0; +} + + +int find_equiv_in_list(RefList *list, signed int h, signed int k, + signed int l, const char *sym, signed int *hu, + signed int *ku, signed int *lu) +{ + int i; + int found = 0; + + for ( i=0; i