diff options
author | Thomas White <taw@physics.org> | 2010-06-30 19:02:22 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:26:52 +0100 |
commit | 44187d0be3e33fb9ab1515698919947074d266ad (patch) | |
tree | 2ce812dce46b7c1ff3244bf5d97c246094d48390 /src | |
parent | 29d2a374f2f820e6ea0e4bd9c4aa6617393eea0f (diff) |
More work on symmetry
Diffstat (limited to 'src')
-rw-r--r-- | src/symmetry.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/src/symmetry.c b/src/symmetry.c index 3df45dc0..921041d4 100644 --- a/src/symmetry.c +++ b/src/symmetry.c @@ -34,11 +34,12 @@ static int check_cond(signed int h, signed int k, signed int l, const char *sym) if ( strcmp(sym, "1") == 0 ) return ( 1 ); if ( strcmp(sym, "6") == 0 ) - return ( (h>=0) && (k>=0) ); + return ( ((h>0) && (k>=0)) || ((h==0) && (k==0)) ); if ( strcmp(sym, "6/m") == 0 ) - return ( (h>=0) && (k>=0) && (l>=0) ); + return ( (((h>0) && (k>=0)) || ((h==0) && (k==0))) && (l>=0) ); if ( strcmp(sym, "6/mmm") == 0 ) - return ( (h>=0) && (k>=0) && (l>=0) && (h>=k) ); + return ( (((h>0) && (k>=0)) || ((h==0) && (k==0))) && (l>=0) + && (h>=k) ); /* TODO: Add more groups here */ @@ -58,9 +59,16 @@ int num_equivs(signed int h, signed int k, signed int l, const char *sym) { if ( strcmp(sym, "1") == 0 ) return 1; - if ( strcmp(sym, "6") == 0 ) return 6; /* FIXME */ + if ( strcmp(sym, "6") == 0 ) { + if ( (h==0) && (k==0) ) return 2; /* a */ + return 6; /* b */ + } - if ( strcmp(sym, "6/m") == 0 ) return 12; /* FIXME */ + if ( strcmp(sym, "6/m") == 0 ) { + if ( (h==0) && (k==0) ) return 2; /* a */ + if ( l == 0 ) return 6; /* b */ + return 12; /* c */ + } if ( strcmp(sym, "6/mmm") == 0 ) { if ( (h==0) && (k==0) ) return 2; /* a */ @@ -82,12 +90,21 @@ void get_equiv(signed int h, signed int k, signed int l, signed int *he, signed int *ke, signed int *le, const char *sym, int idx) { + signed int i = -h-k; + if ( strcmp(sym, "1") == 0 ) { *he = h; *ke = k; *le = l; return; } if ( strcmp(sym, "6") == 0 ) { - signed int i = -h-k; + /* a */ + if ( (h==0) && (k==0) ) { + switch ( idx ) { + case 0 : *he = 0; *ke = 0; *le = l; return; + case 1 : *he = 0; *ke = 0; *le = -l; return; + } + } + /* b */ switch ( idx ) { case 0 : *he = h; *ke = k; *le = l; return; case 1 : *he = i; *ke = h; *le = l; return; @@ -99,7 +116,14 @@ void get_equiv(signed int h, signed int k, signed int l, } if ( strcmp(sym, "6/m") == 0 ) { - signed int i = -h-k; + /* a */ + if ( (h==0) && (k==0) ) { + switch ( idx ) { + case 0 : *he = 0; *ke = 0; *le = l; return; + case 1 : *he = 0; *ke = 0; *le = -l; return; + } + } + /* b-c */ switch ( idx ) { case 0 : *he = h; *ke = k; *le = l; return; case 1 : *he = i; *ke = h; *le = l; return; @@ -117,15 +141,14 @@ void get_equiv(signed int h, signed int k, signed int l, } if ( strcmp(sym, "6/mmm") == 0 ) { - signed int i = -h-k; - /* Special table for a */ + /* a */ if ( (h==0) && (k==0) ) { switch ( idx ) { case 0 : *he = 0; *ke = 0; *le = l; return; case 1 : *he = 0; *ke = 0; *le = -l; return; } } - /* Common table for b-g */ + /* b-g */ switch ( idx ) { case 0 : *he = h; *ke = k; *le = l; return; case 1 : *he = i; *ke = h; *le = l; return; |