From 2089e6e3c0a34430239dce596bc27db30611ac2f Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 26 Oct 2020 15:06:38 +0100 Subject: Label all uses of cell tolerances I'm sick of fixing this same issue over and over again. New rule: any code handling unit cell tolerances MUST be labelled with details of units. --- libcrystfel/src/cell-utils.c | 3 +++ libcrystfel/src/index.c | 2 ++ 2 files changed, 5 insertions(+) (limited to 'libcrystfel') diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c index 2e2e431a..22610ce1 100644 --- a/libcrystfel/src/cell-utils.c +++ b/libcrystfel/src/cell-utils.c @@ -1354,6 +1354,7 @@ int compare_cell_parameters(UnitCell *cell, UnitCell *reference, cell_get_parameters(cell, &a1, &b1, &c1, &al1, &be1, &ga1); cell_get_parameters(reference, &a2, &b2, &c2, &al2, &be2, &ga2); + /* within_tolerance() takes a percentage */ if ( !within_tolerance(a1, a2, tols[0]*100.0) ) return 0; if ( !within_tolerance(b1, b2, tols[1]*100.0) ) return 0; if ( !within_tolerance(c1, c2, tols[2]*100.0) ) return 0; @@ -1399,6 +1400,7 @@ static double moduli_check(double ax, double ay, double az, * \returns non-zero if the cells match. * */ +/* 'tols' is in frac (not %) and radians */ int compare_cell_parameters_and_orientation(UnitCell *cell, UnitCell *reference, const double *tols) { @@ -1454,6 +1456,7 @@ int compare_cell_parameters_and_orientation(UnitCell *cell, UnitCell *reference, * \returns non-zero if the cells match. * */ +/* 'tols' is in frac (not %) and radians */ int compare_permuted_cell_parameters_and_orientation(UnitCell *cell, UnitCell *reference, const double *tols, diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index f9c02c28..457fd7fe 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -354,6 +354,7 @@ IndexingMethod *parse_indexing_methods(const char *method_list, } +/* 'tols' is in frac (not %) and radians */ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, const DataTemplate *dtempl, float *tols, IndexingFlags flags, @@ -776,6 +777,7 @@ static int try_indexer(struct image *image, IndexingMethod indm, for ( j=0; jcrystals[j]; + /* 'tols' is in frac (not %) and radians */ const double tols[] = {0.1, 0.1, 0.1, deg2rad(5.0), deg2rad(5.0), -- cgit v1.2.3