diff options
author | Tom White <weiss@jade.(none)> | 2008-09-25 12:56:45 +0100 |
---|---|---|
committer | Thomas White <taw27@cam.ac.uk> | 2008-10-02 17:54:49 +0100 |
commit | c65b4fabdf765eeb522a7575df1509dd2e37a5c0 (patch) | |
tree | 74c436cdb5cb21fc98b3c34379bed833a4ab443c | |
parent | 346b9adf9a5f7dc8338bdf206042deb2816c255f (diff) |
More instrumentation stuff
-rw-r--r-- | src/refine.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/refine.c b/src/refine.c index 20da997..9333674 100644 --- a/src/refine.c +++ b/src/refine.c @@ -37,12 +37,14 @@ /* Refine debug */ #define REFINE_DEBUG 1 +#define REFINE_DEBUG_MORE 0 typedef struct { - signed int h; signed int k; signed int l; - double dx; double dy; - double xx; double xy; double xz; - double yx; double yy; double yz; + signed int h; signed int k; signed int l; /* Indicies of reflection */ + double dx; double dy; /* Deviation vector for this reflection in nm^-1 */ + double xx; double xy; double xz; /* x,y,z components of "image x" */ + double yx; double yy; double yz; /* x,y,z components of "image y" */ + int image; /* Image number this dev came from, for debugging purposes */ } Deviation; void refine_do_sequence(ControlContext *ctx) { @@ -126,12 +128,12 @@ static double refine_mean_dev(Deviation *d, int nf, Basis *devcell) { /* Project into original image */ dx = xdf*d[f].xx + ydf*d[f].xy + zdf*d[f].xz; dy = xdf*d[f].yx + ydf*d[f].yy + zdf*d[f].yz; - //if ( REFINE_DEBUG ) printf("%2i %2i %2i dx=%8.5f dy=%8.5f => ", - // d[f].h, d[f].k, d[f].l, dx/DISPFACTOR, dy/DISPFACTOR); dx -= d[f].dx; dy -= d[f].dy; - //if ( REFINE_DEBUG ) printf("%8.5f %8.5f\n", dx/DISPFACTOR, dy/DISPFACTOR); + + if ( REFINE_DEBUG_MORE ) printf("Image %2i ref %3i %3i %3i dev %8.5f %8.5f\n", d[f].image, + d[f].h, d[f].k, d[f].l, dx/DISPFACTOR, dy/DISPFACTOR); fom += sqrt(dx*dx + dy*dy); @@ -227,6 +229,8 @@ double refine_do_cell(ControlContext *ctx) { mapping_rotate(1.0, 0.0, 0.0, &d[f].xx, &d[f].xy, &d[f].xz, image->omega, image->tilt); mapping_rotate(0.0, 1.0, 0.0, &d[f].yx, &d[f].yy, &d[f].yz, image->omega, image->tilt); + d[f].image = i; + f++; } @@ -247,7 +251,8 @@ double refine_do_cell(ControlContext *ctx) { devcell_try_best = malloc(sizeof(Basis)); for ( it=1; it<=10000; it++ ) { int found = 0; - if ( REFINE_DEBUG ) printf("Iteration %i starts at dev %14.12f\n", it, mean_dev/DISPFACTOR); + if ( REFINE_DEBUG_MORE ) printf("Iteration %i starts at dev %14.12f\n", + it, mean_dev/DISPFACTOR); for ( comp=0; comp<18; comp++ ) { memcpy(devcell_try, devcell, sizeof(Basis)); switch ( comp ) { @@ -271,7 +276,7 @@ double refine_do_cell(ControlContext *ctx) { case 17 : devcell_try->c.z -= 0.0001e9; break; } mean_dev_try = refine_mean_dev(d, nf, devcell_try); - if ( REFINE_DEBUG ) printf("Direction %2i, new dev=%14.12f (%+14.12f)\n", + if ( REFINE_DEBUG_MORE ) printf("Direction %2i, new dev=%14.12f (%+14.12f)\n", comp, mean_dev_try/DISPFACTOR, (mean_dev_try-mean_dev)/DISPFACTOR); if ( mean_dev_try < mean_dev ) { mean_dev = mean_dev_try; |