aboutsummaryrefslogtreecommitdiff
path: root/src/refine.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/refine.c')
-rw-r--r--src/refine.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/refine.c b/src/refine.c
index b3ac84a..5de8df3 100644
--- a/src/refine.c
+++ b/src/refine.c
@@ -80,7 +80,8 @@ void refine_do_sequence(ControlContext *ctx) {
reproject_lattice_changed(ctx);
fit = refine_do_cell(ctx);
- printf("RF: omega_offs=%f deg, fit=%f nm^-1\n", rad2deg(omega_offs), fit/DISPFACTOR);
+ printf("RF: omega_offs=%f deg, fit=%f nm^-1\n", rad2deg(omega_offs),
+ fit/DISPFACTOR);
fit_vals[idx++] = fit;
if ( fit < fit_best ) {
fit_best = fit;
@@ -254,21 +255,25 @@ static double refine_iteration(SimplexVertex *s, Deviation *d, int nf) {
/* Is the worst vertex any better? */
fom_new = refine_mean_dev(d, nf, s, v_worst);
- if ( REFINE_DEBUG ) printf("New mean deviation for the worst vertex after reflection is %f nm^-1\n", fom_new/DISPFACTOR);
+ if ( REFINE_DEBUG ) printf("New mean deviation for the worst vertex after reflection is %f nm^-1\n",
+ fom_new/DISPFACTOR);
if ( fom_new > fom_worst ) {
double fom_new_new;
/* It's worse than before. Contract in 1D and see if that helps. */
if ( REFINE_DEBUG ) printf("Worse. Trying a 1D contraction...\n");
- refine_simplex_transform(s, v_worst, -0.5); /* Minus puts it back on the original side of the 'good' face */
+ /* Minus puts it back on the original side of the 'good' face */
+ refine_simplex_transform(s, v_worst, -0.5);
fom_new_new = refine_mean_dev(d, nf, s, v_worst);
- if ( REFINE_DEBUG ) printf("Mean deviation after 1D contraction is %f nm^-1\n", fom_new_new/DISPFACTOR);
+ if ( REFINE_DEBUG ) printf("Mean deviation after 1D contraction is %f nm^-1\n",
+ fom_new_new/DISPFACTOR);
if ( fom_new_new > fom_second_worst ) {
int i;
- if ( REFINE_DEBUG ) printf("Not as good as the second worst vertex: contracting around the best vertex (%i)\n", v_best);
+ if ( REFINE_DEBUG ) printf("Not as good as the second worst vertex: contracting around the "
+ "best vertex (%i)\n", v_best);
for ( i=0; i<=NUM_PARAMS; i++ ) {
if ( i != v_best ) refine_simplex_contract(s, i, v_best);
}
@@ -346,7 +351,8 @@ double refine_do_cell(ControlContext *ctx) {
int j;
if ( !ctx->images->images[i].rflist ) {
- ctx->images->images[i].rflist = reproject_get_reflections(&ctx->images->images[i], ctx->cell_lattice);
+ ctx->images->images[i].rflist = reproject_get_reflections(&ctx->images->images[i],
+ ctx->cell_lattice);
}
for ( j=0; j<ctx->images->images[i].rflist->n_features; j++ ) {
@@ -385,7 +391,8 @@ double refine_do_cell(ControlContext *ctx) {
/* Determine the difference vector */
dix = rf->partner->x - rf->x;
diy = rf->partner->y - rf->y;
- //printf("RF: Feature %3i: %3i %3i %3i dev = %+9.5f %+9.5f px ", j, d[f].h, d[f].k, d[f].l, dix, diy);
+ //printf("RF: Feature %3i: %3i %3i %3i dev = %+9.5f %+9.5f px ", j, d[f].h, d[f].k, d[f].l,
+ // dix, diy);
old_x = rf->partner->x;
old_y = rf->partner->y;
@@ -437,7 +444,8 @@ double refine_do_cell(ControlContext *ctx) {
if ( REFINE_DEBUG ) printf("------------------- Simplex method iteration %i -------------------\n", it);
conv = refine_iteration(s, d, nf);
if ( conv < tol ) {
- if ( REFINE_DEBUG ) printf("RF: Converged after %i iterations (%f nm^-1)\n", it, conv/DISPFACTOR);
+ if ( REFINE_DEBUG ) printf("RF: Converged after %i iterations (%f nm^-1)\n", it,
+ conv/DISPFACTOR);
break;
}