aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-03-06 12:00:27 +0100
committerThomas White <taw@physics.org>2019-03-11 16:49:37 +0100
commitf231e9e1a8293f103acffced3c295116e9f17a52 (patch)
treedc4820949465f2bb566671c0707725d897a221ac
parent4f11a9f8530178cfb510f11c7bc4b1829bbd0be4 (diff)
Tidy up cell comparison
-rw-r--r--libcrystfel/src/cell-utils.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c
index 3a5ef782..7e622023 100644
--- a/libcrystfel/src/cell-utils.c
+++ b/libcrystfel/src/cell-utils.c
@@ -1972,11 +1972,9 @@ int compare_reindexed_cell_parameters(UnitCell *cell_in, UnitCell *reference_in,
Rational *cand_b;
Rational *cand_c;
int ncand_a, ncand_b, ncand_c;
- int i;
int ia, ib;
RationalMatrix *MCiA;
RationalMatrix *CBMCiA;
- int ret = 0;
/* Actually compare against primitive version of reference */
reference = uncenter_cell(reference_in, &CBint, NULL);
@@ -1999,25 +1997,6 @@ int compare_reindexed_cell_parameters(UnitCell *cell_in, UnitCell *reference_in,
cand_b = find_candidates(b, av, bv, cv, ltl, &ncand_b);
cand_c = find_candidates(c, av, bv, cv, ltl, &ncand_c);
- STATUS("Candidates for a: %i\n", ncand_a);
- for ( i=0; i<10; i++ ) {
- STATUS("%s %s %s\n", rtnl_format(cand_a[3*i+0]),
- rtnl_format(cand_a[3*i+1]),
- rtnl_format(cand_a[3*i+2]));
- }
- STATUS("Candidates for b: %i\n", ncand_b);
- for ( i=0; i<10; i++ ) {
- STATUS("%s %s %s\n", rtnl_format(cand_b[3*i+0]),
- rtnl_format(cand_b[3*i+1]),
- rtnl_format(cand_b[3*i+2]));
- }
- STATUS("Candidates for c: %i\n", ncand_c);
- for ( i=0; i<10; i++ ) {
- STATUS("%s %s %s\n", rtnl_format(cand_c[3*i+0]),
- rtnl_format(cand_c[3*i+1]),
- rtnl_format(cand_c[3*i+2]));
- }
-
m = rtnl_mtx_new(3, 3);
MCiA = rtnl_mtx_new(3, 3);
CBMCiA = rtnl_mtx_new(3, 3);
@@ -2080,13 +2059,24 @@ int compare_reindexed_cell_parameters(UnitCell *cell_in, UnitCell *reference_in,
rtnl_mtx_mtxmult(m, CiA, MCiA);
rtnl_mtx_mtxmult(CB, MCiA, CBMCiA);
*pmb = CBMCiA;
- ret = 1;
-
cell_free(test);
+ rtnl_mtx_free(m);
+ rtnl_mtx_free(MCiA);
+ /* Not CBMCiA because we are returning it */
+ free(cand_a);
+ free(cand_b);
+ free(cand_c);
+ return 1;
}
}
}
- return ret;
+ rtnl_mtx_free(m);
+ rtnl_mtx_free(MCiA);
+ rtnl_mtx_free(CBMCiA);
+ free(cand_a);
+ free(cand_b);
+ free(cand_c);
+ return 0;
}