aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-03-24 13:15:37 +0100
committerThomas White <taw@physics.org>2014-03-24 13:20:29 +0100
commit5d9cd6f40e08f498cc6ff852a6aba9d9b569fd20 (patch)
tree1ae45c136073907ee1a5d8a582027dba068117b8
parentf50355434a331e1480f30086789fa61a2c1af991 (diff)
get_ambiguities() should not return the identity operation
-rw-r--r--libcrystfel/src/symmetry.c12
-rw-r--r--src/ambigator.c10
-rw-r--r--tests/ambi_check.c34
3 files changed, 34 insertions, 22 deletions
diff --git a/libcrystfel/src/symmetry.c b/libcrystfel/src/symmetry.c
index 47ba088b..67298ec1 100644
--- a/libcrystfel/src/symmetry.c
+++ b/libcrystfel/src/symmetry.c
@@ -1511,6 +1511,7 @@ SymOpList *get_ambiguities(const SymOpList *source, const SymOpList *target)
SymOpList *tgt_reordered;
SymOpMask *used;
char *name;
+ int have_identity = 0;
n_src = num_ops(source);
n_tgt = num_ops(target);
@@ -1569,7 +1570,16 @@ SymOpList *get_ambiguities(const SymOpList *source, const SymOpList *target)
free_symoplist(src_reordered);
return NULL;
}
- add_symop(twins, intmat_copy(src_reordered->ops[i]));
+ if ( !intmat_is_identity(src_reordered->ops[i]) ) {
+ add_symop(twins, intmat_copy(src_reordered->ops[i]));
+ } else {
+ have_identity = 1;
+ }
+
+ }
+
+ if ( !have_identity ) {
+ ERROR("WARNING: Identity not found during left coset decomp\n");
}
free_symopmask(used);
diff --git a/src/ambigator.c b/src/ambigator.c
index 7e1726fd..70dcb631 100644
--- a/src/ambigator.c
+++ b/src/ambigator.c
@@ -130,7 +130,7 @@ static struct flist *asymm_and_merge(RefList *in, const SymOpList *sym,
signed int hr, kr, lr;
signed int hra, kra, lra;
- get_equiv(amb, NULL, 1, ha, ka, la, &hr, &kr, &lr);
+ get_equiv(amb, NULL, 0, ha, ka, la, &hr, &kr, &lr);
get_asymm(sym, hr, kr, lr, &hra, &kra, &lra);
/* Skip twin-proof reflections */
@@ -201,7 +201,7 @@ static struct flist *asymm_and_merge(RefList *in, const SymOpList *sym,
Reflection *cr;
get_indices(refl, &h, &k, &l);
- get_equiv(amb, NULL, 1, h, k, l, &hr, &kr, &lr);
+ get_equiv(amb, NULL, 0, h, k, l, &hr, &kr, &lr);
get_asymm(sym, hr, kr, lr, &hra, &kra, &lra);
cr = add_refl(reidx, hra, kra, lra);
@@ -641,7 +641,9 @@ static void reindex_reflections(FILE *fh, FILE *ofh, int assignment,
/* See scanf() manual page about %n to see why <3 is used */
if ( (r < 3) && !first ) return;
- get_equiv(amb, NULL, assignment, h, k, l, &h, &k, &l);
+ if ( assignment ) {
+ get_equiv(amb, NULL, 0, h, k, l, &h, &k, &l);
+ }
fprintf(ofh, "%4i %4i %4i%s", h, k, l, line+n);
@@ -874,7 +876,7 @@ int main(int argc, char *argv[])
}
STATUS("Ambiguity operations:\n");
describe_symmetry(amb);
- if ( num_equivs(amb, NULL) != 2 ) {
+ if ( num_equivs(amb, NULL) != 1 ) {
ERROR("There must be only one ambiguity operator.\n");
ERROR("Try again with a different value for -w.\n");
return 1;
diff --git a/tests/ambi_check.c b/tests/ambi_check.c
index 287249eb..c25d006a 100644
--- a/tests/ambi_check.c
+++ b/tests/ambi_check.c
@@ -273,21 +273,21 @@ int main(int argc, char *argv[])
"6mm", NULL);
/* Check some easy subgroups */
- check_subgroup("2/m", "m", 1, 1, 2, &fail);
- check_subgroup("mmm", "mm2", 1, 1, 2, &fail);
- check_subgroup("-4m2", "-4", 1, 1, 2, &fail);
- check_subgroup("-42m", "-4", 1, 1, 2, &fail);
- check_subgroup("-3m1_H", "-3_H", 1, 1, 2, &fail);
- check_subgroup("-31m_H", "-3_H", 1, 1, 2, &fail);
- check_subgroup("m-3m", "-43m", 1, 1, 2, &fail);
- check_subgroup("m-3m", "m-3", 1, 1, 2, &fail);
- check_subgroup("432", "23", 1, 1, 2, &fail);
- check_subgroup("6/m", "-3_H", 1, 1, 2, &fail);
- check_subgroup("4/m", "-4", 1, 1, 2, &fail);
- check_subgroup("622", "321_H", 1, 1, 2, &fail);
+ check_subgroup("2/m", "m", 1, 1, 1, &fail);
+ check_subgroup("mmm", "mm2", 1, 1, 1, &fail);
+ check_subgroup("-4m2", "-4", 1, 1, 1, &fail);
+ check_subgroup("-42m", "-4", 1, 1, 1, &fail);
+ check_subgroup("-3m1_H", "-3_H", 1, 1, 1, &fail);
+ check_subgroup("-31m_H", "-3_H", 1, 1, 1, &fail);
+ check_subgroup("m-3m", "-43m", 1, 1, 1, &fail);
+ check_subgroup("m-3m", "m-3", 1, 1, 1, &fail);
+ check_subgroup("432", "23", 1, 1, 1, &fail);
+ check_subgroup("6/m", "-3_H", 1, 1, 1, &fail);
+ check_subgroup("4/m", "-4", 1, 1, 1, &fail);
+ check_subgroup("622", "321_H", 1, 1, 1, &fail);
/* Tetartohedral */
- check_subgroup("6/mmm", "-3_H", 1, 1, 4, &fail);
+ check_subgroup("6/mmm", "-3_H", 1, 1, 3, &fail);
/* Check some things that are valid subgroups, but no valid ambiguities
* exist because inversions and mirrors are not allowed */
@@ -300,10 +300,10 @@ int main(int argc, char *argv[])
check_subgroup("432", "m-3", 0, 0, -1, &fail);
/* Check some pseudo-meroheral subgroups */
- check_subgroup("3_R", "1", 1, 1, 3, &fail);
- check_subgroup("-3_R", "-1", 1, 1, 3, &fail);
- check_subgroup("6", "2", 1, 1, 3, &fail);
- check_subgroup("422", "222", 1, 1, 2, &fail);
+ check_subgroup("3_R", "1", 1, 1, 2, &fail);
+ check_subgroup("-3_R", "-1", 1, 1, 2, &fail);
+ check_subgroup("6", "2", 1, 1, 2, &fail);
+ check_subgroup("422", "222", 1, 1, 1, &fail);
return fail;
}