aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-08-05 14:25:22 +0200
committerThomas White <taw@physics.org>2019-08-16 10:26:59 +0200
commitea74744a59728bd375dda10a9386b502eb5056c2 (patch)
treeea23b7623f7d357b73475cecf7e536904051a581 /libcrystfel
parentb9bfccba1564f365581639a1a6856ddff682a13c (diff)
Use new cell comparison functions for indexing
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/index.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index 0f613e45..b187e119 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -543,32 +543,39 @@ void map_all_peaks(struct image *image)
static int check_cell(IndexingFlags flags, Crystal *cr, UnitCell *target,
- float *tolerance)
+ double *tolerance)
{
- if ( (flags & INDEXING_CHECK_CELL_COMBINATIONS)
- || (flags & INDEXING_CHECK_CELL_AXES) )
- {
- UnitCell *out;
- int reduce;
-
- if ( flags & INDEXING_CHECK_CELL_COMBINATIONS )
- {
- reduce = 1;
- } else {
- reduce = 0;
- }
+ UnitCell *out;
+ IntegerMatrix *im;
+ RationalMatrix *rm;
- out = match_cell(crystal_get_cell(cr),
- target, 0, tolerance, reduce);
+ /* Check at all? */
+ if ( ! ((flags & INDEXING_CHECK_CELL_COMBINATIONS)
+ || (flags & INDEXING_CHECK_CELL_AXES)) ) return 0;
- if ( out == NULL ) {
- return 1;
- }
+ if ( compare_permuted_cell_parameters(crystal_get_cell(cr), target,
+ tolerance, &im) )
+ {
+ out = cell_transform_intmat(crystal_get_cell(cr), im);
+ cell_free(crystal_get_cell(cr));
+ crystal_set_cell(cr, out);
+ intmat_free(im);
+ return 0;
+ }
+ if ( (flags & INDEXING_CHECK_CELL_COMBINATIONS )
+ && compare_reindexed_cell_parameters(crystal_get_cell(cr), target,
+ tolerance, 0, &rm) )
+ {
+ out = cell_transform_rational(crystal_get_cell(cr), rm);
cell_free(crystal_get_cell(cr));
crystal_set_cell(cr, out);
+ rtnl_mtx_free(rm);
+ return 0;
}
- return 0;
+
+ return 1;
+
}