diff options
author | Thomas White <taw@physics.org> | 2021-11-15 15:15:54 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-11-15 15:15:54 +0100 |
commit | 100ad72d704aebd964519174bf24ec730070d65f (patch) | |
tree | 2a6ab5a21e14e43700d20d534cbd40ee1710026d /libcrystfel/src | |
parent | 3dfb24e9cacf8bc62f39b0de37c5b0ddceba9e71 (diff) |
Ensure that crystal doesn't end up with invalid reflist after prediction refinement
Diffstat (limited to 'libcrystfel/src')
-rw-r--r-- | libcrystfel/src/predict-refine.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libcrystfel/src/predict-refine.c b/libcrystfel/src/predict-refine.c index 9bee242c..38aff911 100644 --- a/libcrystfel/src/predict-refine.c +++ b/libcrystfel/src/predict-refine.c @@ -274,6 +274,7 @@ static int pair_peaks(struct image *image, Crystal *cr, } reflist_free(all_reflist); + crystal_set_reflections(cr, NULL); /* Sort the pairings by excitation error and look for a transition * between good pairings and outliers */ @@ -589,6 +590,7 @@ int refine_prediction(struct image *image, Crystal *cr) if ( max_I <= 0.0 ) { ERROR("All peaks negative?\n"); free(rps); + crystal_set_reflections(cr, NULL); return 1; } for ( i=0; i<n; i++ ) { @@ -602,7 +604,11 @@ int refine_prediction(struct image *image, Crystal *cr) for ( i=0; i<MAX_CYCLES; i++ ) { update_predictions(cr); if ( iterate(rps, n, crystal_get_cell(cr), image, - &total_x, &total_y, &total_z) ) return 1; + &total_x, &total_y, &total_z) ) + { + crystal_set_reflections(cr, NULL); + return 1; + } crystal_set_det_shift(cr, total_x, total_y); //STATUS("Residual after %i = %e\n", i, // pred_residual(rps, n, image->detgeom, total_x, total_y)); |