aboutsummaryrefslogtreecommitdiff
path: root/src/symmetry.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-07-17 20:28:16 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:54 +0100
commit003a1a19a55913633c2e212af840cb4d0390d304 (patch)
tree88f8ddbb0378804395b51806c9dd41803167e6ba /src/symmetry.c
parent84a7190c4bd7893e1bfdd37522a46fb0d085ed5c (diff)
compare_hkl: Take symmetry into account
Diffstat (limited to 'src/symmetry.c')
-rw-r--r--src/symmetry.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/symmetry.c b/src/symmetry.c
index 4bc8d115..54b7f5cc 100644
--- a/src/symmetry.c
+++ b/src/symmetry.c
@@ -352,3 +352,50 @@ ReflItemList *get_twins(ReflItemList *items, const char *holo, const char *mero)
return ops;
}
+
+
+static void scold_user_about_symmetry(signed int h, signed int k, signed int l,
+ signed int he, signed int ke,
+ signed int le)
+{
+ ERROR("Symmetrically equivalent reflection (%i %i %i) found for "
+ "%i %i %i in the input.\n", he, ke, le, h, k, l);
+ ERROR("This indicates that you lied to me about the symmetry of the "
+ "input reflections. ");
+ ERROR("I won't be able to give you a meaningful result in this "
+ "situation, so I'm going to give up right now. ");
+ ERROR("Please reconsider your previous processing of the data, and "
+ "perhaps try again with a lower symmetry for the '-y' option.\n");
+ abort();
+}
+
+
+int find_unique_equiv(ReflItemList *items, signed int h, signed int k,
+ signed int l, const char *mero, signed int *hu,
+ signed int *ku, signed int *lu)
+{
+ int i;
+ int found = 0;
+
+ for ( i=0; i<num_equivs(h, k, l, mero); i++ ) {
+
+ signed int he, ke, le;
+ int f;
+ get_equiv(h, k, l, &he, &ke, &le, mero, i);
+ f = find_item(items, he, ke, le);
+
+ /* There must only be one equivalent. If there are more, it
+ * indicates that the user lied about the input symmetry. */
+ if ( f && found ) {
+ scold_user_about_symmetry(he, ke, le, *hu, *ku, *lu);
+ }
+
+ if ( f && !found ) {
+ *hu = he; *ku = ke; *lu = le;
+ found = 1;
+ }
+
+ }
+
+ return found;
+}