aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/geometry.c57
-rw-r--r--src/geometry.h8
-rw-r--r--src/partialator.c8
-rw-r--r--src/post-refinement.c2
4 files changed, 14 insertions, 61 deletions
diff --git a/src/geometry.c b/src/geometry.c
index f94980d3..fa66ed71 100644
--- a/src/geometry.c
+++ b/src/geometry.c
@@ -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);
diff --git a/src/geometry.h b/src/geometry.h
index c47f4a27..486f1a60 100644
--- a/src/geometry.h
+++ b/src/geometry.h
@@ -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 */
diff --git a/src/partialator.c b/src/partialator.c
index 252d6cfd..b3d40b02 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -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);
diff --git a/src/post-refinement.c b/src/post-refinement.c
index d8783c6b..d53c803d 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -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);