aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-10-07 12:09:23 +0200
committerThomas White <taw@physics.org>2020-10-07 12:09:23 +0200
commitccbf9608b201f424e1bf0204629eb8bd637fe880 (patch)
treec8529693e6692bdbeaac76583ceace54ea6fe95c
parent62183aacf906f4aff771295aa378cff039dd50ff (diff)
TakeTwo: Fix get_chiral_holohedry for "hexagonal H"
Fixes CRYS-240
-rw-r--r--libcrystfel/src/indexers/taketwo.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/libcrystfel/src/indexers/taketwo.c b/libcrystfel/src/indexers/taketwo.c
index c27b50c7..83a1384c 100644
--- a/libcrystfel/src/indexers/taketwo.c
+++ b/libcrystfel/src/indexers/taketwo.c
@@ -531,7 +531,7 @@ static double matrix_trace(gsl_matrix *a)
return tr;
}
-static char *add_ua(const char *inp, char ua)
+static char *add_unique_axis(const char *inp, char ua)
{
char *pg = malloc(64);
if ( pg == NULL ) return NULL;
@@ -544,12 +544,13 @@ static char *get_chiral_holohedry(UnitCell *cell)
{
LatticeType lattice = cell_get_lattice_type(cell);
char *pg;
- char *pgout = 0;
+ int add_ua = 1;
switch (lattice)
{
case L_TRICLINIC:
pg = "1";
+ add_ua = 0;
break;
case L_MONOCLINIC:
@@ -558,6 +559,7 @@ static char *get_chiral_holohedry(UnitCell *cell)
case L_ORTHORHOMBIC:
pg = "222";
+ add_ua = 0;
break;
case L_TETRAGONAL:
@@ -566,11 +568,13 @@ static char *get_chiral_holohedry(UnitCell *cell)
case L_RHOMBOHEDRAL:
pg = "3_R";
+ add_ua = 0;
break;
case L_HEXAGONAL:
if ( cell_get_centering(cell) == 'H' ) {
pg = "3_H";
+ add_ua = 0;
} else {
pg = "622";
}
@@ -578,6 +582,7 @@ static char *get_chiral_holohedry(UnitCell *cell)
case L_CUBIC:
pg = "432";
+ add_ua = 0;
break;
default:
@@ -585,26 +590,11 @@ static char *get_chiral_holohedry(UnitCell *cell)
break;
}
- switch (lattice)
- {
- case L_TRICLINIC:
- case L_ORTHORHOMBIC:
- case L_RHOMBOHEDRAL:
- case L_CUBIC:
- pgout = strdup(pg);
- break;
-
- case L_MONOCLINIC:
- case L_TETRAGONAL:
- case L_HEXAGONAL:
- pgout = add_ua(pg, cell_get_unique_axis(cell));
- break;
-
- default:
- break;
+ if ( add_ua ) {
+ return add_unique_axis(pg, cell_get_unique_axis(cell));
+ } else {
+ return strdup(pg);
}
-
- return pgout;
}