From f289a626ccc0e0fb74f28acd9bd714f44343eacb Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 26 Aug 2019 16:57:04 +0200 Subject: cell_tool: Just do all the comparisons, get rid of --csl --- src/cell_tool.c | 52 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/cell_tool.c b/src/cell_tool.c index 0942ca15..5fef5d9f 100644 --- a/src/cell_tool.c +++ b/src/cell_tool.c @@ -67,13 +67,12 @@ static void show_help(const char *s) " --tolerance= Set the tolerances for cell comparison.\n" " Default: 5,1.5 (axis percentage, angle deg).\n" " --highres=n Resolution limit (Angstroms) for --rings\n" -" --csl Allow --compare to find coincidence site lattice relationships.\n" ); } static int comparecells(UnitCell *cell, const char *comparecell, - double ltl, double atl, int csl) + double ltl, double atl) { UnitCell *cell2; RationalMatrix *m; @@ -98,10 +97,9 @@ static int comparecells(UnitCell *cell, const char *comparecell, tolerance[4] = atl; tolerance[5] = atl; - STATUS("------------------> The comparison results:\n"); - if ( !compare_derivative_cell_parameters(cell, cell2, tolerance, csl, &m) ) { + STATUS("------------------> Reindexed (strictly the same lattice):\n"); + if ( !compare_reindexed_cell_parameters(cell, cell2, tolerance, &m) ) { STATUS("No relationship found between lattices.\n"); - return 0; } else { UnitCell *trans; STATUS("Relationship found. To become similar to the reference" @@ -117,7 +115,44 @@ static int comparecells(UnitCell *cell, const char *comparecell, } - rtnl_mtx_free(m); + STATUS("------------------> Derivative lattice " + "(strictly the same lattice):\n"); + if ( !compare_derivative_cell_parameters(cell, cell2, tolerance, 0, &m) ) { + STATUS("No relationship found between lattices.\n"); + } else { + UnitCell *trans; + STATUS("Relationship found. To become similar to the reference" + " cell, the input cell should be transformed by:\n"); + rtnl_mtx_print(m); + STATUS("Transformed version of input unit cell:\n"); + trans = cell_transform_rational(cell, m); + cell_print(trans); + cell_free(trans); + STATUS("NB transformed cell might not really be triclinic, " + "it's just that I don't (yet) know how to work out what " + "it is.\n"); + rtnl_mtx_free(m); + } + + STATUS("------------------> Coincidence site lattice " + "(not strictly the same lattice):\n"); + if ( !compare_derivative_cell_parameters(cell, cell2, tolerance, 1, &m) ) { + STATUS("No relationship found between lattices.\n"); + return 0; + } else { + UnitCell *trans; + STATUS("Relationship found. To become similar to the reference" + " cell, the input cell should be transformed by:\n"); + rtnl_mtx_print(m); + STATUS("Transformed version of input unit cell:\n"); + trans = cell_transform_rational(cell, m); + cell_print(trans); + cell_free(trans); + STATUS("NB transformed cell might not really be triclinic, " + "it's just that I don't (yet) know how to work out what " + "it is.\n"); + rtnl_mtx_free(m); + } return 0; } @@ -442,7 +477,6 @@ int main(int argc, char *argv[]) float highres; double rmax = 1/(2.0e-10); char *trans_str = NULL; - int csl = 0; /* Long options */ const struct option longopts[] = { @@ -461,7 +495,6 @@ int main(int argc, char *argv[]) {"transform", 1, NULL, 4}, {"highres", 1, NULL, 5}, - {"csl", 0, &csl, 1}, {0, 0, NULL, 0} }; @@ -588,8 +621,7 @@ int main(int argc, char *argv[]) if ( mode == CT_FINDAMBI ) return find_ambi(cell, sym, ltl, atl); if ( mode == CT_UNCENTER ) return uncenter(cell, out_file); if ( mode == CT_RINGS ) return all_rings(cell, sym, rmax); - if ( mode == CT_COMPARE ) return comparecells(cell, comparecell, - ltl, atl, csl); + if ( mode == CT_COMPARE ) return comparecells(cell, comparecell, ltl, atl); if ( mode == CT_TRANSFORM ) return transform(cell, trans_str, out_file); if ( mode == CT_CHOICES ) return cell_choices(cell); -- cgit v1.2.3