From e06952e9eefb0affb65d5361d1919d28bee5974d Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 15 Oct 2018 16:01:47 +0200 Subject: Remove cells_are_similar() from API There are two functions with this name. Avoid confusion. --- src/cell_tool.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/cell_tool.c b/src/cell_tool.c index 3450c299..085134b3 100644 --- a/src/cell_tool.c +++ b/src/cell_tool.c @@ -68,6 +68,34 @@ 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; + UnitCell *pcell1, *pcell2; + + /* Compare primitive cells, not centered */ + pcell1 = uncenter_cell(cell1, &tfn1); + pcell2 = uncenter_cell(cell2, &tfn2); + + cell_get_parameters(pcell1, &a1, &b1, &c1, &al1, &be1, &ga1); + cell_get_parameters(pcell2, &a2, &b2, &c2, &al2, &be2, &ga2); + + cell_free(pcell1); + cell_free(pcell2); + + 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 ( !within_tolerance(al1, al2, atl) ) return 0; + if ( !within_tolerance(be1, be2, atl) ) return 0; + if ( !within_tolerance(ga1, ga2, atl) ) return 0; + + return 1; +} + + static int comparecells(UnitCell *cell, const char *comparecell, double ltl, double atl) { @@ -122,7 +150,7 @@ static int comparecells(UnitCell *cell, const char *comparecell, tfn = tfn_from_intmat(m); nc = cell_transform(cell, tfn); - if ( cells_are_similar(cell2, nc, ltl, atl) ) { + if ( cells_the_same(cell2, nc, ltl, atl) ) { STATUS("-----------------------------------------------" "-------------------------------------------\n"); cell_print(nc); @@ -303,7 +331,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_are_similar(cell, nc, ltl, atl) ) { + if ( cells_the_same(cell, nc, ltl, atl) ) { if ( !intmat_is_identity(m) ) add_symop(ops, m); STATUS("-----------------------------------------------" "-------------------------------------------\n"); -- cgit v1.2.3