aboutsummaryrefslogtreecommitdiff
path: root/src/geometry.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/geometry.c')
-rw-r--r--src/geometry.c57
1 files changed, 8 insertions, 49 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);