aboutsummaryrefslogtreecommitdiff
path: root/src/post-refinement.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-02-26 14:09:39 +0100
committerThomas White <taw@physics.org>2018-02-27 17:12:42 +0100
commit28c9ef4669302897e29552df5700fd59ffca5e04 (patch)
tree6b49535b274b22f0ce90d9776b52fe6bb7247c5f /src/post-refinement.c
parent2544056df3dedfbf6b1780aaec13fbeb3b2242c3 (diff)
Trap very large profile radius values
Diffstat (limited to 'src/post-refinement.c')
-rw-r--r--src/post-refinement.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 7e5420d3..bc276fa7 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -324,6 +324,12 @@ static double residual_f(const gsl_vector *v, void *pp)
crystal_set_image(cr, &im);
apply_parameters(v, pv->initial, pv->rv, cr);
+ if ( fabs(crystal_get_profile_radius(cr)) > 5e9 ) {
+ crystal_free(cr);
+ if ( pv->verbose ) STATUS("radius > 5e9\n");
+ return GSL_NAN;
+ }
+
if ( im.lambda <= 0.0 ) {
crystal_free(cr);
if ( pv->verbose ) STATUS("lambda < 0\n");
@@ -857,6 +863,10 @@ static void do_pr_refine(Crystal *cr, const RefList *full,
write_specgraph(cr, full, cycle, serial);
}
+ if ( crystal_get_profile_radius(cr) > 5e9 ) {
+ ERROR("Very large radius: crystal %i\n", serial);
+ }
+
gsl_multimin_fminimizer_free(min);
gsl_vector_free(priv.initial);
gsl_vector_free(priv.vals);