aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-11-19 17:02:32 +0100
committerThomas White <taw@physics.org>2015-11-19 17:02:32 +0100
commite81e335daf509166fc234c8835203a80d5b21e0d (patch)
tree670f60d0b7902b12bb84152299ec243235efb801 /src
parentb07c8c3652d85f78262a776187e15ab41f098089 (diff)
Maximum number of iterations for scaling
Diffstat (limited to 'src')
-rw-r--r--src/scaling.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/scaling.c b/src/scaling.c
index 05e741ca..77a64384 100644
--- a/src/scaling.c
+++ b/src/scaling.c
@@ -403,6 +403,7 @@ void scale_all(Crystal **crystals, int n_crystals, int nthreads,
struct scale_args task_defaults;
struct queue_args qargs;
double old_res, new_res;
+ int niter = 0;
task_defaults.crystal = NULL;
task_defaults.pmodel = pmodel;
@@ -447,6 +448,11 @@ void scale_all(Crystal **crystals, int n_crystals, int nthreads,
STATUS("Mean B = %e\n", meanB);
reflist_free(full);
+ niter++;
- } while ( fabs(new_res-old_res) >= 0.01*old_res );
+ } while ( (fabs(new_res-old_res) >= 0.01*old_res) && (niter < 10) );
+
+ if ( niter == 10 ) {
+ ERROR("Too many iterations - giving up!\n");
+ }
}