aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-10-22 10:55:52 +0200
committerThomas White <taw@physics.org>2019-10-22 10:55:52 +0200
commite5bd22e532c65c4980f8fcda566e9228f730a743 (patch)
tree8affa9de050f785a9e83e4030eff6a6f1dd36946
parent883e26767fb61d6af5381cbecf8fb2ff33210be7 (diff)
Add some warnings and assertions
-rw-r--r--libcrystfel/src/cell-utils.c4
-rw-r--r--libcrystfel/src/index.c1
2 files changed, 5 insertions, 0 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c
index f96554dd..f9ef3218 100644
--- a/libcrystfel/src/cell-utils.c
+++ b/libcrystfel/src/cell-utils.c
@@ -1842,6 +1842,9 @@ static void mult_in_place(IntegerMatrix *T, IntegerMatrix *M)
{
int i, j;
IntegerMatrix *tmp = intmat_times_intmat(T, M);
+ assert(intmat_det(M) == 1);
+ assert(intmat_det(T) == 1);
+ assert(intmat_det(tmp) == 1);
for ( i=0; i<3; i++ ) {
for ( j=0; j<3; j++ ) {
intmat_set(T, i, j, intmat_get(tmp, i, j));
@@ -1934,6 +1937,7 @@ IntegerMatrix *reduce_g6(struct g6 g, double epsrel)
intmat_set(M, 2, 2, LT(g.F, 0.0) ? -1 : 1);
mult_in_place(T, M);
+ assert(intmat_det(M) == 1);
g.D = fabs(g.D);
g.E = fabs(g.E);
g.F = fabs(g.F);
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index d24e8355..2dead425 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -592,6 +592,7 @@ static int check_cell(IndexingFlags flags, Crystal *cr, UnitCell *target,
cell_free(crystal_get_cell(cr));
crystal_set_cell(cr, out);
rtnl_mtx_free(rm);
+ if ( !right_handed(out) ) STATUS("WARNING: left handed\n");
/* Copy the target cell's lattice type and unique axis
* onto the crystal's cell. The cell from compare_r_c_p doesn't