aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-05-25 17:50:51 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:28 +0100
commit2c2bb0426ceff2ddc9284b506102b967d768dadf (patch)
tree0f9fc7380c0cf1555b63a535a564e0d3caba0c7b /src
parent54fee1620387697a5624d9573f541bf0c081ae11 (diff)
PR gradient check
Diffstat (limited to 'src')
-rw-r--r--src/cell.c8
-rw-r--r--src/geometry.c1
-rw-r--r--src/post-refinement.c19
-rw-r--r--src/post-refinement.h20
-rw-r--r--src/utils.h7
5 files changed, 29 insertions, 26 deletions
diff --git a/src/cell.c b/src/cell.c
index ff9ff3d9..ee00248d 100644
--- a/src/cell.c
+++ b/src/cell.c
@@ -614,14 +614,6 @@ void cell_print(UnitCell *cell)
#define MAX_CAND (1024)
-static int within_tolerance(double a, double b, double percent)
-{
- double tol = a * (percent/100.0);
- if ( fabs(b-a) < tol ) return 1;
- return 0;
-}
-
-
static int right_handed(struct rvec a, struct rvec b, struct rvec c)
{
struct rvec aCb;
diff --git a/src/geometry.c b/src/geometry.c
index c5e85b12..de2ee1b4 100644
--- a/src/geometry.c
+++ b/src/geometry.c
@@ -217,6 +217,7 @@ static int check_reflection(struct image *image, double mres, int output,
refl = add_refl(reflections, h, k, l);
set_detector_pos(refl, 0.0, xda, yda);
set_partial(refl, rlow, rhigh, part, clamp_low, clamp_high);
+ set_symmetric_indices(refl, h, k, l);
set_redundancy(refl, 1);
if ( output ) {
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 4ebaffd9..285fe037 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -32,23 +32,6 @@
#define MAX_CYCLES (5)
-/* Refineable parameters */
-enum {
- REF_ASX,
- REF_BSX,
- REF_CSX,
- REF_ASY,
- REF_BSY,
- REF_CSY,
- REF_ASZ,
- REF_BSZ,
- REF_CSZ,
- NUM_PARAMS,
- REF_DIV,
- REF_R,
-};
-
-
/* Returns dp/dr at "r" */
static double partiality_gradient(double r, double profile_radius)
{
@@ -86,7 +69,7 @@ static double partiality_rgradient(double r, double profile_radius)
/* Return the gradient of parameter 'k' given the current status of 'image'. */
-static double gradient(struct image *image, int k, Reflection *refl, double r)
+double gradient(struct image *image, int k, Reflection *refl, double r)
{
double ds, tt, azix, aziy;
double nom, den;
diff --git a/src/post-refinement.h b/src/post-refinement.h
index 3c8d8587..5b71cbd5 100644
--- a/src/post-refinement.h
+++ b/src/post-refinement.h
@@ -24,8 +24,28 @@
#include "utils.h"
+/* Refineable parameters */
+enum {
+ REF_ASX,
+ REF_BSX,
+ REF_CSX,
+ REF_ASY,
+ REF_BSY,
+ REF_CSY,
+ REF_ASZ,
+ REF_BSZ,
+ REF_CSZ,
+ NUM_PARAMS,
+ REF_DIV,
+ REF_R,
+};
+
+
extern void pr_refine(struct image *image, const RefList *full,
const char *sym);
+/* Exported so it can be poked by tests/pr_gradient_check */
+extern double gradient(struct image *image, int k, Reflection *refl, double r);
+
#endif /* POST_REFINEMENT_H */
diff --git a/src/utils.h b/src/utils.h
index 4433023f..a11cd59e 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -140,6 +140,13 @@ static inline double angle_between(double x1, double y1, double z1,
return acos(cosine);
}
+static inline int within_tolerance(double a, double b, double percent)
+{
+ double tol = a * (percent/100.0);
+ if ( fabs(b-a) < fabs(tol) ) return 1;
+ return 0;
+}
+
/* ----------------------------- Useful macros ------------------------------ */