aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-05-18 14:55:39 +0200
committerThomas White <taw@physics.org>2017-05-18 14:55:39 +0200
commit68ecea6c609544db3086a146c3ead2c91aa1cb76 (patch)
treeb5477e75c748f8a545a373f37a356bcb9cf29129 /libcrystfel
parent9d798b597f0a8ff93387c65d5f5124d7329aba83 (diff)
Implement get_chiral_holohedry()
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/taketwo.c96
1 files changed, 76 insertions, 20 deletions
diff --git a/libcrystfel/src/taketwo.c b/libcrystfel/src/taketwo.c
index e99e3dca..8751d6d1 100644
--- a/libcrystfel/src/taketwo.c
+++ b/libcrystfel/src/taketwo.c
@@ -957,38 +957,94 @@ static int find_seed(struct SpotVec *obs_vecs, int obs_vec_count,
return (best_rotation != NULL);
}
-static int generate_rotation_sym_ops(struct TakeTwoCell *ttCell)
+
+static char *add_ua(const char *inp, char ua)
{
- LatticeType lattice = cell_get_lattice_type(ttCell->cell);
- SymOpList rawList;
+ char *pg = malloc(64);
+ if ( pg == NULL ) return NULL;
+ snprintf(pg, 63, "%s_ua%c", inp, ua);
+ return pg;
+}
- switch (lattice) {
+
+static char *get_chiral_holohedry(UnitCell *cell)
+{
+ LatticeType lattice = cell_get_lattice_type(cell);
+ char *pg = malloc(64);
+ char *pgout;
+
+ if ( pg == NULL ) return NULL;
+
+ switch (lattice)
+ {
case L_TRICLINIC:
- // ...get parental guidance for unusually accurate candidness?
- rawList = getpg_uac("1");
- break;
+ pg = "1";
+ break;
+
case L_MONOCLINIC:
- rawList = getpg_uac("2");
- break;
+ pg = "2";
+ break;
+
case L_ORTHORHOMBIC:
- rawList = getpg_uac("222");
- break;
+ pg = "222";
+ break;
+
case L_TETRAGONAL:
- rawList = getpg_uac("422");
- break;
+ pg = "422";
+ break;
+
case L_RHOMBOHEDRAL:
- rawList = getpg_uac("312_H"); // uhmmm, sure?
- break;
+ pg = "3_R";
+ break;
+
case L_HEXAGONAL:
- rawList = getpg_uac("622");
- break;
+ if ( cell_get_centering(cell) == 'H' ) {
+ pg = "3_H";
+ } else {
+ pg = "622";
+ }
+ break;
+
+ case L_CUBIC:
+ pg = "432";
+ break;
+
+ default:
+ pg = "error";
+ break;
+ }
+
+ switch (lattice)
+ {
+ case L_TRICLINIC:
+ case L_ORTHORHOMBIC:
+ case L_RHOMBOHEDRAL:
case L_CUBIC:
- rawList = getpg_uac("432");
- break;
+ 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;
+ break;
}
+ return pgout;
+}
+
+
+static int generate_rotation_sym_ops(struct TakeTwoCell *ttCell)
+{
+ SymOpList *rawList;
+
+ char *pg = get_chiral_holohedry(ttCell->cell);
+ rawList = get_pointgroup(pg);
+ free(pg);
+
/* Now we must convert these into rotation matrices rather than hkl
* transformations (affects triclinic, monoclinic, rhombohedral and
* hexagonal space groups only) */