aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-10-23 14:18:40 +0200
committerThomas White <taw@physics.org>2019-03-11 16:49:36 +0100
commit481c13eac53cce18272ff3ef3e4994170c7d2e62 (patch)
treeb90d9fcda17a07d51fd919be4fd88a090da7e783 /src
parent483593eab5edf7be2f769a8d2db9ac0f38329c8a (diff)
Change horribly confusing names of unit cell comparison functions
cells_are_similar -> compare_cell_parameters_and_orientation compare_cells -> compare_reindexed_cell_parameters_and_orientation cell_tool.c:cells_the_same -> cellutils.c:compare_cell_parameters All comparisons now done in real space, checking that centering is the same, and without uncentering anything.
Diffstat (limited to 'src')
-rw-r--r--src/cell_tool.c28
-rw-r--r--src/whirligig.c13
2 files changed, 9 insertions, 32 deletions
diff --git a/src/cell_tool.c b/src/cell_tool.c
index 1a2f33fb..ee82f332 100644
--- a/src/cell_tool.c
+++ b/src/cell_tool.c
@@ -68,30 +68,6 @@ static void show_help(const char *s)
}
-static int cells_the_same(UnitCell *cell1, UnitCell *cell2, float ltl, float atl)
-{
- double a1, b1, c1, al1, be1, ga1;
- double a2, b2, c2, al2, be2, ga2;
- UnitCellTransformation *tfn1, *tfn2;
-
- /* Centering must match: we don't arbitrarte primitive vs centered,
- * different cell choices etc */
- if ( cell_get_centering(cell1) != cell_get_centering(cell2) ) return 0;
-
- cell_get_parameters(cell1, &a1, &b1, &c1, &al1, &be1, &ga1);
- cell_get_parameters(cell2, &a2, &b2, &c2, &al2, &be2, &ga2);
-
- if ( !within_tolerance(a1, a2, ltl) ) return 0;
- if ( !within_tolerance(b1, b2, ltl) ) return 0;
- if ( !within_tolerance(c1, c2, ltl) ) return 0;
- if ( fabs(al1-al2) > atl ) return 0;
- if ( fabs(be1-be2) > atl ) return 0;
- if ( fabs(ga1-ga2) > atl ) return 0;
-
- return 1;
-}
-
-
static int comparecells(UnitCell *cell, const char *comparecell,
double ltl, double atl)
{
@@ -146,7 +122,7 @@ static int comparecells(UnitCell *cell, const char *comparecell,
tfn = tfn_from_intmat(m);
nc = cell_transform(cell, tfn);
- if ( cells_the_same(cell2, nc, ltl, atl) ) {
+ if ( compare_cell_parameters(cell2, nc, ltl, atl) ) {
STATUS("-----------------------------------------------"
"-------------------------------------------\n");
cell_print(nc);
@@ -327,7 +303,7 @@ static int find_ambi(UnitCell *cell, SymOpList *sym, double ltl, double atl)
tfn = tfn_from_intmat(m);
nc = cell_transform(cell, tfn);
- if ( cells_the_same(cell, nc, ltl, atl) ) {
+ if ( compare_cell_parameters(cell, nc, ltl, atl) ) {
if ( !intmat_is_identity(m) ) add_symop(ops, m);
STATUS("-----------------------------------------------"
"-------------------------------------------\n");
diff --git a/src/whirligig.c b/src/whirligig.c
index f5a435c2..54ade40a 100644
--- a/src/whirligig.c
+++ b/src/whirligig.c
@@ -309,9 +309,9 @@ static IntegerMatrix *try_all(struct window *win, int n1, int n2,
for ( i=0; i<i1->n_crystals; i++ ) {
for ( j=0; j<i2->n_crystals; j++ ) {
- if ( compare_cells(crystal_get_cell(i1->crystals[i]),
- crystal_get_cell(i2->crystals[j]),
- 0.1, deg2rad(5.0), &m) )
+ if ( compare_reindexed_cell_parameters_and_orientation(crystal_get_cell(i1->crystals[i]),
+ crystal_get_cell(i2->crystals[j]),
+ 0.1, deg2rad(5.0), &m) )
{
if ( !crystal_used(win, n1, i)
&& !crystal_used(win, n2, j) )
@@ -377,9 +377,10 @@ static int try_join(struct window *win, int sn)
for ( j=0; j<win->img[win->join_ptr].n_crystals; j++ ) {
Crystal *cr2;
cr2 = win->img[win->join_ptr].crystals[j];
- if ( compare_cells(ref, crystal_get_cell(cr2),
- 0.1, deg2rad(5.0),
- &win->mat[sn][win->join_ptr]) ) {
+ if ( compare_reindexed_cell_parameters_and_orientation(ref, crystal_get_cell(cr2),
+ 0.1, deg2rad(5.0),
+ &win->mat[sn][win->join_ptr]) )
+ {
win->ser[sn][win->join_ptr] = j;
cell_free(ref);
return 1;