aboutsummaryrefslogtreecommitdiff
path: root/src/post-refinement.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-02-27 13:42:42 +0100
committerThomas White <taw@physics.org>2018-02-27 17:12:41 +0100
commit07d1ff916b1731143f3ce7d76e4d1d2a5052a9ca (patch)
tree31388babc284703cdb539b4f31aed20f1cda0f42 /src/post-refinement.c
parent42fecffa4b8fb382fc9d1f24cf81357ee32730e7 (diff)
Residual and scaling fixes
Diffstat (limited to 'src/post-refinement.c')
-rw-r--r--src/post-refinement.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 2eae8e91..e1a2e05a 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -92,6 +92,10 @@ double residual(Crystal *cr, const RefList *full, int free,
double B = crystal_get_Bfac(cr);
UnitCell *cell = crystal_get_cell(cr);
+ if ( linear_scale(crystal_get_reflections(cr), full, &G) ) {
+ return INFINITY;
+ }
+
for ( refl = first_refl(crystal_get_reflections(cr), &iter);
refl != NULL;
refl = next_refl(refl, iter) )
@@ -120,10 +124,9 @@ double residual(Crystal *cr, const RefList *full, int free,
int2 = p*I_full;
w = 1.0;
- if ( int1 + int2 < 0.0 ) continue;
num += fabs(int1 - int2) * w;
- den += (int1 + int2) * w/2.0;
+ den += fabs(int1 + int2) * w/2.0;
n_used++;
@@ -295,7 +298,7 @@ static double residual_f(const gsl_vector *v, void *pp)
crystal_set_image(cr, &im);
apply_parameters(v, pv->initial, pv->rv, cr);
- if ( crystal_get_profile_radius(cr) < 0.0 ) {
+ if ( crystal_get_profile_radius(cr) <= 0.0 ) {
crystal_free(cr);
return INFINITY;
}
@@ -439,7 +442,7 @@ static void do_pr_refine(Crystal *cr, const RefList *full,
res, size);
}
- status = gsl_multimin_test_size(min->size, 0.1);
+ status = gsl_multimin_test_size(min->size, 0.005);
} while ( status == GSL_CONTINUE && n_iter < 1000 );