aboutsummaryrefslogtreecommitdiff
path: root/tests/symmetry_check.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-07-20 19:08:33 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:34 +0100
commit93f5d444a533651154a7cf507f02c1eb40fad087 (patch)
tree23c9d2b78b27ffb2502524fb8797c54e278a41c6 /tests/symmetry_check.c
parentc1103a3d7f0cdbc06f74c46fdcc02b06264aeb5e (diff)
More PG checking
Diffstat (limited to 'tests/symmetry_check.c')
-rw-r--r--tests/symmetry_check.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/tests/symmetry_check.c b/tests/symmetry_check.c
index bda6961e..b3d4cb34 100644
--- a/tests/symmetry_check.c
+++ b/tests/symmetry_check.c
@@ -22,10 +22,20 @@
#include "../src/utils.h"
-static void check_nequiv(const char *pg, int answer, int *fail)
+static const char *maybenot(int v)
+{
+ if ( v ) {
+ return "";
+ } else {
+ return " not";
+ }
+}
+
+
+static void check_pg_props(const char *pg, int answer, int centro, int *fail)
{
SymOpList *sym;
- int n;
+ int n, c;
//STATUS("**************************************** Testing '%s'\n", pg);
@@ -33,11 +43,18 @@ static void check_nequiv(const char *pg, int answer, int *fail)
n = num_equivs(sym, NULL);
if ( n != answer ) {
- ERROR("Number of equivalents in '%s' is %i (not %i)\n",
+ ERROR("Number of equivalents in '%s' is %i (not %i).\n",
pg, n, answer);
*fail = 1;
}
+ c = is_centrosymmetric(sym);
+ if ( c != centro ) {
+ ERROR("'%s' should%s be centrosymmetric, but is%s.\n",
+ pg, maybenot(centro), maybenot(c));
+ *fail = 1;
+ }
+
free_symoplist(sym);
}
@@ -46,11 +63,18 @@ int main(int argc, char *argv[])
{
int fail = 0;
- check_nequiv( "1", 1, &fail);
- check_nequiv( "-1", 2, &fail);
- check_nequiv( "2", 2, &fail);
- check_nequiv( "m", 2, &fail);
- check_nequiv("2/m", 4, &fail);
+ check_pg_props( "1", 1, 0, &fail);
+ check_pg_props( "-1", 2, 1, &fail);
+
+ check_pg_props( "2", 2, 0, &fail);
+ check_pg_props( "m", 2, 0, &fail);
+ check_pg_props("2/m", 4, 1, &fail);
+
+ check_pg_props("222", 4, 0, &fail);
+ check_pg_props("mm2", 4, 0, &fail);
+ check_pg_props("mmm", 8, 1, &fail);
+
+ check_pg_props( "4", 4, 0, &fail);
return fail;
}