diff options
author | Thomas White <taw@physics.org> | 2011-08-11 14:51:26 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:36 +0100 |
commit | 9dccffae8faeb230f7b175aabcd539b02ec853d5 (patch) | |
tree | 661e529ce560aa5e0fa32f13690080829bf6a0d6 /src | |
parent | 45810fe8f509521683260aebd1a1b9d7a3d0d5de (diff) |
Tweak order of cell refinement
Diffstat (limited to 'src')
-rw-r--r-- | src/reax.c | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -102,8 +102,8 @@ static double check_dir(struct dvec *dir, ImageFeatureList *flist, /* Refine a direct space vector. From Clegg (1984) */ -static double refine_vector(double *x, double *y, double *z, - ImageFeatureList *flist) +static double iterate_refine_vector(double *x, double *y, double *z, + ImageFeatureList *flist) { int fi, n, err; gsl_matrix *C; @@ -200,20 +200,19 @@ static void refine_cell(struct image *image, UnitCell *cell, int i; double sm; + cell_get_cartesian(cell, &ax, &ay, &az, &bx, &by, &bz, &cx, &cy, &cz); i = 0; do { - cell_get_cartesian(cell, &ax, &ay, &az, - &bx, &by, &bz, - &cx, &cy, &cz); - sm = refine_vector(&ax, &ay, &az, flist); - sm += refine_vector(&bx, &by, &bz, flist); - sm += refine_vector(&cx, &cy, &cz, flist); - cell_set_cartesian(cell, ax, ay, az, bx, by, bz, cx, cy, cz); + sm = iterate_refine_vector(&ax, &ay, &az, flist); + sm += iterate_refine_vector(&bx, &by, &bz, flist); + sm += iterate_refine_vector(&cx, &cy, &cz, flist); i++; } while ( (sm > 0.001e-9) && (i<10) ); + cell_set_cartesian(cell, ax, ay, az, bx, by, bz, cx, cy, cz); + if ( i == 10 ) { cell_free(image->indexed_cell); image->indexed_cell = NULL; @@ -270,13 +269,12 @@ static void fine_search(struct reax_private *p, ImageFeatureList *flist, max = m; s = i; } + } assert(s>0); modv = (double)s / (2.0*pmax); *x *= modv; *y *= modv; *z *= modv; - - refine_vector(x, y, z, flist); } @@ -424,6 +422,9 @@ void reax_index(IndexingPrivate *pp, struct image *image, UnitCell *cell) fftw_free(fft_in); fftw_free(fft_out); + + /* We fill in indexed_cell but none of the candidate_cells, which + * bypasses any cell reduction which is selected. */ } |