diff options
author | Tom White <weiss@jade.(none)> | 2008-09-24 14:27:41 +0100 |
---|---|---|
committer | Thomas White <taw27@cam.ac.uk> | 2008-10-02 17:54:49 +0100 |
commit | 26c4b9f45e5db32ac30f58b0cc9275c968920c17 (patch) | |
tree | 93655702870425ef0fd23edfc6534e321ecfb836 | |
parent | 6442946314d25c55958039471fb0a676de32fbe6 (diff) |
Stop when refinement isn't going anywhere
-rw-r--r-- | src/refine.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/refine.c b/src/refine.c index 55e7868..0c20cad 100644 --- a/src/refine.c +++ b/src/refine.c @@ -273,11 +273,16 @@ double refine_do_cell(ControlContext *ctx) { found = 1; } } - if ( found ) memcpy(devcell, devcell_try_best, sizeof(Basis)); + if ( found ) { + memcpy(devcell, devcell_try_best, sizeof(Basis)); + } else { + break; + } if ( !(it % 1000) ) printf("After %5i iterations: mean dev = %13.8f nm^1\n", it, mean_dev/DISPFACTOR); } free(devcell_try); free(devcell_try_best); + printf("Final mean dev (%5i iterations) = %13.8f nm^1\n", it, mean_dev/DISPFACTOR); /* Apply the final values to the cell */ ctx->cell->a.x += devcell->a.x; ctx->cell->b.x += devcell->b.x; ctx->cell->c.x += devcell->c.x; |