From cec863e72ad15da7553ef813f8fcc6c08dd292f8 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 10 Oct 2012 17:42:33 +0200 Subject: Tie off loose ends This whole idea is rubbish. There's no way to communicate the setting information via the H-M spacegroup symbol in this way, except in a few circumstances. See ITA (2005) section 4.3. This simplifies matters a lot. There's no need for any extra parsing, because the "_uaX" system is sufficient, and is the best that can be done without inventing a whole new system for point group symbols. --- libcrystfel/src/symmetry.c | 49 +++++++++++++++++----------------------------- tests/symmetry_check.c | 9 +++------ 2 files changed, 21 insertions(+), 37 deletions(-) diff --git a/libcrystfel/src/symmetry.c b/libcrystfel/src/symmetry.c index a6713f1f..5ea22e98 100644 --- a/libcrystfel/src/symmetry.c +++ b/libcrystfel/src/symmetry.c @@ -892,7 +892,7 @@ static SymOpList *make_m3barm() } -static SymOpList *getpg_old(const char *sym) +static SymOpList *getpg_uac(const char *sym) { /* Triclinic */ if ( strcmp(sym, "-1") == 0 ) return make_1bar(); @@ -971,7 +971,7 @@ static int char_count(const char *a, char b) } -static SymOpList *getpg_old_ua(const char *sym, size_t s) +static SymOpList *getpg_arbitrary_ua(const char *sym, size_t s) { char ua; char *pg_type; @@ -990,7 +990,7 @@ static SymOpList *getpg_old_ua(const char *sym, size_t s) return NULL; } - pg = getpg_old(pg_type); + pg = getpg_uac(pg_type); if ( pg == NULL ) { ERROR("Unrecognised point group type '%s'\n", pg_type); @@ -1043,46 +1043,33 @@ static SymOpList *getpg_old_ua(const char *sym, size_t s) **/ SymOpList *get_pointgroup(const char *sym) { - int n_space, n_underscore; + int n_underscore; - n_space = char_count(sym, ' '); n_underscore = char_count(sym, '_'); - if ( n_space == 0 ) { + /* No spaces nor underscores -> old system */ + if ( n_underscore == 0 ) return getpg_uac(sym); - /* No spaces nor underscores -> old system */ - if ( n_underscore == 0 ) return getpg_old(sym); + /* No spaces and 1 underscore -> old system + lattice or UA */ + if ( n_underscore == 1 ) { - /* No spaces and 1 underscore -> old system + lattice or UA */ - if ( n_underscore == 1 ) { + const char *s; - const char *s; - - s = strchr(sym, '_'); - assert(s != NULL); - s++; - - /* Old system with H/R lattice? */ - if ( (s[0] == 'H') || (s[0] == 'R') ) { - return getpg_old(sym); - } - - /* Old system with unique axis */ - return getpg_old_ua(sym, s-sym); + s = strchr(sym, '_'); + assert(s != NULL); + s++; + /* Old system with H/R lattice? */ + if ( (s[0] == 'H') || (s[0] == 'R') ) { + return getpg_uac(sym); } - } + /* Old system with unique axis */ + return getpg_arbitrary_ua(sym, s-sym); - if ( n_space > 4 ) { - ERROR("Unrecognised point group '%s'\n", sym); - return NULL; } - /* 1-4 spaces -> new system, possibly with UA and/or lattice */ - - /* FIXME: Implementation */ - + ERROR("Unrecognised point group '%s'\n", sym); return NULL; } diff --git a/tests/symmetry_check.c b/tests/symmetry_check.c index 648814d0..cfc68f08 100644 --- a/tests/symmetry_check.c +++ b/tests/symmetry_check.c @@ -403,12 +403,9 @@ int main(int argc, char *argv[]) check_pg_props( "4/m_uaa", 8, 1, &fail); check_pg_props( "4/m_uab", 8, 1, &fail); check_pg_props( "4/m_uac", 8, 1, &fail); - - /* Check "new style" parsing */ - STATUS("\nNew style:\n"); - check_pg_props( "2 1 1", 2, 0, &fail); - check_pg_props( "1 2 1", 2, 0, &fail); - check_pg_props( "1 1 2", 2, 0, &fail); + check_pg_props( "23_uaa", 12, 0, &fail); + check_pg_props( "23_uab", 12, 0, &fail); + check_pg_props( "23_uac", 12, 0, &fail); return fail; } -- cgit v1.2.3