diff options
-rw-r--r-- | src/partialator.c | 19 | ||||
-rw-r--r-- | src/post-refinement.c | 11 | ||||
-rw-r--r-- | src/scaling.h | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/partialator.c b/src/partialator.c index a72eda50..46a5a25f 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -1236,6 +1236,13 @@ int main(int argc, char *argv[]) STATUS("Scaling and refinement cycle %i of %i\n", i+1, n_iter); + if ( !no_pr ) { + + r = (reference != NULL) ? reference : full; + refine_all(crystals, n_crystals, r, nthreads, pmodel); + + } + if ( !no_scale ) { if ( reference == NULL ) { @@ -1257,18 +1264,6 @@ int main(int argc, char *argv[]) } } - if ( !no_pr ) { - - r = (reference != NULL) ? reference : full; - refine_all(crystals, n_crystals, r, nthreads, pmodel); - - reflist_free(full); - full = merge_intensities(crystals, n_crystals, nthreads, - pmodel, min_measurements, - push_res, 1); - - } - check_rejection(crystals, n_crystals, full, max_B); reflist_free(full); full = merge_intensities(crystals, n_crystals, nthreads, 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 ); diff --git a/src/scaling.h b/src/scaling.h index 7b055003..85e8c8ab 100644 --- a/src/scaling.h +++ b/src/scaling.h @@ -41,6 +41,8 @@ extern double log_residual(Crystal *cr, const RefList *full, int free, int *pn_used, const char *filename); +extern int linear_scale(RefList *list1, const RefList *list2, double *G); + extern void scale_all(Crystal **crystals, int n_crystals, int nthreads, PartialityModel pmodel); |