aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-10-22 11:44:01 +0200
committerThomas White <taw@physics.org>2020-10-22 11:46:31 +0200
commit95a2d852c23b12a2fded6bed6330f1d8d201d873 (patch)
tree261013be2d61b308bd85435aa5ed9a37433718a8
parent3b2772959a8ebc43ec165af317d1599ec371429f (diff)
compare_cell_parameters: Accept R/P pair as equivalent
See 0f18ff76a3d1f5979db for some discussion.
-rw-r--r--libcrystfel/src/cell-utils.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c
index d269e703..8e8b4c55 100644
--- a/libcrystfel/src/cell-utils.c
+++ b/libcrystfel/src/cell-utils.c
@@ -1270,6 +1270,18 @@ double cell_get_volume(UnitCell *cell)
}
+/* Return true if the two centering symbols are identical,
+ * or if they are a pair of R/P, which should be considered the
+ * same for the purposes of cell comparison */
+static int centering_equivalent(char cen1, char cen2)
+{
+ if ( cen1 == cen2 ) return 1;
+ if ( (cen1=='P') && (cen2=='R') ) return 1;
+ if ( (cen1=='R') && (cen2=='P') ) return 1;
+ return 0;
+}
+
+
/**
* \param cell: A UnitCell
* \param reference: Another UnitCell
@@ -1294,7 +1306,8 @@ int compare_cell_parameters(UnitCell *cell, UnitCell *reference,
/* Centering must match: we don't arbitrate primitive vs centered,
* different cell choices etc */
- if ( cell_get_centering(cell) != cell_get_centering(reference) ) return 0;
+ if ( !centering_equivalent(cell_get_centering(cell),
+ cell_get_centering(reference)) ) return 0;
cell_get_parameters(cell, &a1, &b1, &c1, &al1, &be1, &ga1);
cell_get_parameters(reference, &a2, &b2, &c2, &al2, &be2, &ga2);