From 9686edbcb2b5aeb4a553779c895b228d2ac56528 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sun, 31 Oct 2010 10:41:22 +0100 Subject: indexamajig: Add other cell reduction possibilities, and remove --no-match --- src/cell.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/cell.c') diff --git a/src/cell.c b/src/cell.c index b6accd58..7002f9fa 100644 --- a/src/cell.c +++ b/src/cell.c @@ -759,6 +759,28 @@ UnitCell *match_cell(UnitCell *cell, UnitCell *template, int verbose) } +int cells_similar(UnitCell *cell1, UnitCell *cell2) +{ + double a1, b1, c1, al1, be1, ga1; + double a2, b2, c2, al2, be2, ga2; + double ltl = 5.0; /* percent */ + double angtol = deg2rad(1.5); + + 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) > angtol ) return 0; + if ( fabs(be1-be2) > angtol ) return 0; + if ( fabs(ga1-ga2) > angtol ) return 0; + + return 1; +} + + /* Return sin(theta)/lambda = 1/2d. Multiply by two if you want 1/d */ double resolution(UnitCell *cell, signed int h, signed int k, signed int l) { -- cgit v1.2.3