aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-08-26 16:57:04 +0200
committerThomas White <taw@physics.org>2019-08-26 16:57:04 +0200
commitf289a626ccc0e0fb74f28acd9bd714f44343eacb (patch)
treea1222b0d41d50915ad49ac59c88fd598d38df1f4 /src
parent184a21098ac1325c2c02a24ac315584a464532a7 (diff)
cell_tool: Just do all the comparisons, get rid of --csl
Diffstat (limited to 'src')
-rw-r--r--src/cell_tool.c52
1 files changed, 42 insertions, 10 deletions
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=<tol> 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);