aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-10-10 17:42:33 +0200
committerThomas White <taw@physics.org>2012-10-11 18:17:04 +0200
commitcec863e72ad15da7553ef813f8fcc6c08dd292f8 (patch)
treea6bdb0bab8619beb7bda84934934d0cfd31e6274
parent179d2c77e413bff38d46248ea88d7ab01005ad33 (diff)
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.
-rw-r--r--libcrystfel/src/symmetry.c49
-rw-r--r--tests/symmetry_check.c9
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;
}