diff options
author | Thomas White <taw@physics.org> | 2011-04-26 12:07:10 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:24 +0100 |
commit | 136d9cc93b4012bdb1283f8cf283931786811948 (patch) | |
tree | 707cb1a5b477322b7a89573ff2821845e2f0d8be /src/reflist-utils.c | |
parent | e0f621b0fa2094283f9a28155e5fbc75c74bd82c (diff) |
Work on post refinement
Diffstat (limited to 'src/reflist-utils.c')
-rw-r--r-- | src/reflist-utils.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/reflist-utils.c b/src/reflist-utils.c index ea590aaf..0a5c4863 100644 --- a/src/reflist-utils.c +++ b/src/reflist-utils.c @@ -11,6 +11,7 @@ #include <stdio.h> +#include <assert.h> #include "reflist.h" @@ -359,3 +360,40 @@ RefList *read_reflections(const char *filename) return out; } + + +RefList *asymmetric_indices(RefList *in, const char *sym, ReflItemList *obs) +{ + Reflection *refl; + RefListIterator *iter; + RefList *new; + + new = reflist_new(); + + for ( refl = first_refl(in, &iter); + refl != NULL; + refl = next_refl(refl, iter) ) { + + signed int h, k, l; + signed int ha, ka, la; + Reflection *cr; + + get_indices(refl, &h, &k, &l); + + get_asymm(h, k, l, &ha, &ka, &la, sym); + + cr = add_refl(new, ha, ka, la); + assert(cr != NULL); + + copy_data(cr, refl); + + if ( obs != NULL ) { + if ( !find_item(obs, ha, ka, la) ) { + add_item(obs, ha, ka, la); + } + } + + } + + return new; +} |