diff options
author | Thomas White <taw@bitwiz.org.uk> | 2011-08-20 12:00:19 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:36 +0100 |
commit | de17e3afdec93e2347f43f0eea7312509af8ef9c (patch) | |
tree | 6f1e02cbb8973820b03ccf904b165011aca6562e /src | |
parent | 7fa0bc44242e5faaed29ac6fe554831180b7fc92 (diff) |
Check that the unit cell makes sense
Diffstat (limited to 'src')
-rw-r--r-- | src/geometry.c | 15 | ||||
-rw-r--r-- | src/indexamajig.c | 8 | ||||
-rw-r--r-- | src/stream.c | 7 |
3 files changed, 26 insertions, 4 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); diff --git a/src/indexamajig.c b/src/indexamajig.c index fb8272ea..e69025e0 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -325,9 +325,11 @@ static void process_image(void *pp, int cookie) image.reflections = find_intersections(&image, image.indexed_cell); - integrate_reflections(&image, config_polar, - pargs->static_args.config_closer, - pargs->static_args.config_bgsub); + if ( image.reflections != NULL ) { + integrate_reflections(&image, config_polar, + pargs->static_args.config_closer, + pargs->static_args.config_bgsub); + } } else { diff --git a/src/stream.c b/src/stream.c index 316d3bb3..b5ca31bf 100644 --- a/src/stream.c +++ b/src/stream.c @@ -272,14 +272,19 @@ void write_chunk(FILE *ofh, struct image *i, int f) if ( (f & STREAM_PIXELS) || (f & STREAM_INTEGRATED) ) { + fprintf(ofh, "\n"); + if ( i->reflections != NULL ) { - fprintf(ofh, "\n"); fprintf(ofh, REFLECTION_START_MARKER"\n"); write_reflections_to_file(ofh, i->reflections, i->indexed_cell); fprintf(ofh, REFLECTION_END_MARKER"\n"); + } else { + + fprintf(ofh, "No integrated reflections.\n"); + } } |