aboutsummaryrefslogtreecommitdiff
path: root/src/reflist-utils.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-08-02 15:09:34 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:35 +0100
commitee25b4c412c3759158eae3153170cb7940aee143 (patch)
tree13545931778c8f780e773e0f5e8af44d4dd7cddd /src/reflist-utils.c
parent6a30e47ab458cd89f8aa3ed9b48af719cb936988 (diff)
Simplify render_hkl --zone-axis
Diffstat (limited to 'src/reflist-utils.c')
-rw-r--r--src/reflist-utils.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/reflist-utils.c b/src/reflist-utils.c
index af43b1ff..d6272217 100644
--- a/src/reflist-utils.c
+++ b/src/reflist-utils.c
@@ -414,3 +414,64 @@ RefList *asymmetric_indices(RefList *in, const SymOpList *sym)
return new;
}
+
+
+/**
+ * resolution_limits:
+ * @list: A %RefList
+ * @cell: A %UnitCell
+ * @rmin: Place to store the minimum 1/d value
+ * @rmax: Place to store the maximum 1/d value
+ *
+ * This function calculates the minimum and maximum values of 1/d, where
+ * 2dsin(theta) = wavelength. The answers are in m^-1.
+ **/
+void resolution_limits(RefList *list, UnitCell *cell,
+ double *rmin, double *rmax)
+{
+ Reflection *refl;
+ RefListIterator *iter;
+
+ *rmin = INFINITY;
+ *rmax = 0.0;
+
+ for ( refl = first_refl(list, &iter);
+ refl != NULL;
+ refl = next_refl(refl, iter) )
+ {
+ double r;
+ signed int h, k, l;
+
+ get_indices(refl, &h, &k, &l);
+ r = 2.0 * resolution(cell, h, k, l);
+
+ if ( r > *rmax ) *rmax = r;
+ if ( r < *rmin ) *rmin = r;
+ }
+}
+
+
+/**
+ * max_intensity:
+ * @list: A %RefList
+ *
+ * Returns: The maximum intensity in @list.
+ **/
+double max_intensity(RefList *list)
+{
+ Reflection *refl;
+ RefListIterator *iter;
+ double max;
+
+ max = -INFINITY;
+
+ for ( refl = first_refl(list, &iter);
+ refl != NULL;
+ refl = next_refl(refl, iter) )
+ {
+ double val = get_intensity(refl);
+ if ( val > max ) max = val;
+ }
+
+ return max;
+}