diff options
author | Thomas White <taw@physics.org> | 2020-10-22 11:44:01 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-10-22 11:44:01 +0200 |
commit | a8ae2b0fb99b29dd85f78d2fe6753bc033f8938a (patch) | |
tree | 5572676d89f0732c532e2324a2d0e395a96ad6e5 /libcrystfel | |
parent | 8a8130d9bf8908477e64cabf4affca5d1c7b93c7 (diff) |
compare_cell_parameters: Accept R/P pair as equivalent
See 0f18ff76a3d1f5979db for some discussion.
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/cell-utils.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c index 482ea111..2e2e431a 100644 --- a/libcrystfel/src/cell-utils.c +++ b/libcrystfel/src/cell-utils.c @@ -1312,6 +1312,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 @@ -1336,7 +1348,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); |