aboutsummaryrefslogtreecommitdiff
path: root/src/geometry.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-08-20 12:00:19 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:36 +0100
commitde17e3afdec93e2347f43f0eea7312509af8ef9c (patch)
tree6f1e02cbb8973820b03ccf904b165011aca6562e /src/geometry.c
parent7fa0bc44242e5faaed29ac6fe554831180b7fc92 (diff)
Check that the unit cell makes sense
Diffstat (limited to 'src/geometry.c')
-rw-r--r--src/geometry.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/geometry.c b/src/geometry.c
index 2329b0c7..56bb2b0a 100644
--- a/src/geometry.c
+++ b/src/geometry.c
@@ -236,9 +236,24 @@ RefList *find_intersections(struct image *image, UnitCell *cell)
int hmax, kmax, lmax;
double mres;
signed int h, k, l;
+ double a, b, c, al, be, ga;
reflections = reflist_new();
+ /* Cell angle check from Foadi and Evans (2011) */
+ cell_get_parameters(cell, &a, &b, &c, &al, &be, &ga);
+ if ( al + be + ga >= 2.0*M_PI ) return NULL;
+ if ( al + be - ga >= 2.0*M_PI ) return NULL;
+ if ( al - be + ga >= 2.0*M_PI ) return NULL;
+ if ( - al + be + ga >= 2.0*M_PI ) return NULL;
+ if ( al + be + ga <= 0.0 ) return NULL;
+ if ( al + be - ga <= 0.0 ) return NULL;
+ if ( al - be + ga <= 0.0 ) return NULL;
+ if ( - al + be + ga <= 0.0 ) return NULL;
+ if ( isnan(al) ) return NULL;
+ if ( isnan(be) ) return NULL;
+ if ( isnan(ga) ) return NULL;
+
cell_get_reciprocal(cell, &asx, &asy, &asz,
&bsx, &bsy, &bsz,
&csx, &csy, &csz);