aboutsummaryrefslogtreecommitdiff
path: root/src/cell.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-10-31 10:41:22 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:04 +0100
commit9686edbcb2b5aeb4a553779c895b228d2ac56528 (patch)
treead741bdba9bc91c27c27a82c11485db925b82f52 /src/cell.c
parent6c823bf1a6ce09e716c486dc116a358e93457a17 (diff)
indexamajig: Add other cell reduction possibilities, and remove --no-match
Diffstat (limited to 'src/cell.c')
-rw-r--r--src/cell.c22
1 files changed, 22 insertions, 0 deletions
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)
{