aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-02-22 15:08:24 +0100
committerThomas White <taw@physics.org>2018-02-27 17:12:41 +0100
commitf61a2210c6afd5ff222e271c450fdc08cf2b4475 (patch)
tree0d7419ac4a21013bca60aaa2d11e56afc1fcf373
parentaccccf0bd80fb4395cb82c84b702c8a08939ecc6 (diff)
Horrible restraint to keep algorithm from drifting too far
-rw-r--r--libcrystfel/src/geometry.c2
-rw-r--r--src/post-refinement.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/libcrystfel/src/geometry.c b/libcrystfel/src/geometry.c
index 43cf25f2..7f5e8635 100644
--- a/libcrystfel/src/geometry.c
+++ b/libcrystfel/src/geometry.c
@@ -523,6 +523,8 @@ static double do_integral(double q2, double zl, double R,
const double N = 1.5; /* Pointiness of spectrum */
FILE *fh = NULL;
+ assert(R*R < q2);
+
/* Range over which P is different from zero */
k0 = (R*R - q2)/(2.0*(zl+R));
k1 = (R*R - q2)/(2.0*(zl-R));
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 318d1733..da3f6683 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -294,6 +294,11 @@ static double residual_f(const gsl_vector *v, void *pp)
struct image im;
Crystal *cr;
double res;
+ int i;
+
+ for ( i=0; i<v->size; i++ ) {
+ if ( gsl_vector_get(v, i) > 100.0 ) return INFINITY;
+ }
cr = crystal_copy(pv->cr);
im = *crystal_get_image(cr);