Commit 8d936be1 authored by Thomas White's avatar Thomas White
Browse files

Make post refinement go a LOT faster

parent 5d6141ce
......@@ -272,10 +272,9 @@ RefList *find_intersections(struct image *image, UnitCell *cell)
}
/* Predict reflections in "image" */
void predict_corresponding_reflections(struct image *image, const char *sym,
int *n_expected, int *n_found,
int *n_notfound)
/* Calculate partialities and apply them to the image's reflections */
void update_partialities(struct image *image,
int *n_expected, int *n_found, int *n_notfound)
{
Reflection *refl;
RefListIterator *iter;
......@@ -284,9 +283,9 @@ void predict_corresponding_reflections(struct image *image, const char *sym,
double bsx, bsy, bsz;
double csx, csy, csz;
*n_expected = 0;
*n_found = 0;
*n_notfound = 0;
if ( n_expected != NULL ) *n_expected = 0;
if ( n_found != NULL) *n_found = 0;
if ( n_notfound != NULL) *n_notfound = 0;
cell_get_reciprocal(image->indexed_cell, &asx, &asy, &asz,
&bsx, &bsy, &bsz, &csx, &csy, &csz);
......@@ -311,10 +310,10 @@ void predict_corresponding_reflections(struct image *image, const char *sym,
asx,asy,asz,bsx,bsy,bsz,csx,csy,csz);
if ( vals == NULL ) {
(*n_notfound)++;
if ( n_notfound != NULL) (*n_notfound)++;
continue;
}
(*n_found)++;
if ( n_found != NULL) (*n_found)++;
/* Transfer partiality stuff */
get_partial(vals, &r1, &r2, &p, &clamp1, &clamp2);
......@@ -323,46 +322,6 @@ void predict_corresponding_reflections(struct image *image, const char *sym,
/* Transfer detector location */
get_detector_pos(vals, &x, &y);
set_detector_pos(refl, 0.0, x, y);
}
reflist_free(predicted);
}
/* Calculate partialities and apply them to the image's raw_reflections */
void update_partialities(struct image *image)
{
Reflection *refl;
RefListIterator *iter;
RefList *predicted;
predicted = find_intersections(image, image->indexed_cell);
for ( refl = first_refl(image->reflections, &iter);
refl != NULL;
refl = next_refl(refl, iter) )
{
Reflection *p_peak;
double r1, r2, p;
signed int h, k, l;
int clamp1, clamp2;
/* Get predicted indices and location */
get_symmetric_indices(refl, &h, &k, &l);
/* Look for this reflection in the pattern */
p_peak = find_refl(predicted, h, k, l);
if ( p_peak == NULL ) {
set_partial(refl, 0.0, 0.0, 0.0, -1, +1);
continue;
} else {
/* Transfer partiality stuff */
get_partial(p_peak, &r1, &r2, &p, &clamp1, &clamp2);
set_partial(refl, r1, r2, p, clamp1, clamp2);
}
}
reflist_free(predicted);
......
......@@ -21,11 +21,7 @@
extern RefList *find_intersections(struct image *image, UnitCell *cell);
extern void predict_corresponding_reflections(struct image *image,
const char *sym, int *n_expected,
int *n_found, int *n_notfound);
extern void update_partialities(struct image *image);
extern void update_partialities(struct image *image,
int *n_expected, int *n_found, int *n_notfound);
#endif /* GEOMETRY_H */
......@@ -452,8 +452,7 @@ int main(int argc, char *argv[])
reflist_free(cur->reflections);
cur->reflections = as;
predict_corresponding_reflections(cur, sym, &n_expected,
&n_found, &n_notfound);
update_partialities(cur, &n_expected, &n_found, &n_notfound);
nobs += select_scalable_reflections(cur->reflections,
reference);
......@@ -513,9 +512,8 @@ int main(int argc, char *argv[])
struct image *cur = &images[j];
predict_corresponding_reflections(cur, sym, &n_expected,
&n_found,
&n_notfound);
update_partialities(cur, &n_expected,
&n_found, &n_notfound);
nobs += select_scalable_reflections(cur->reflections,
reference);
......
......@@ -505,7 +505,7 @@ void pr_refine(struct image *image, const RefList *full)
max_shift = pr_iterate(image, full);
update_partialities(image);
update_partialities(image, NULL, NULL, NULL);
if ( verbose ) {
dev = guide_dev(image, full);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment