aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/facetron.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/facetron.c b/src/facetron.c
index a0c2b6e4..cf4f099e 100644
--- a/src/facetron.c
+++ b/src/facetron.c
@@ -43,6 +43,7 @@
/* Refineable parameters */
enum {
REF_SCALE,
+ REF_DIV,
NUM_PARAMS
};
@@ -86,11 +87,21 @@ struct refine_args
static double gradient(struct image *image, int k,
struct cpeak spot, double I_partial)
{
+ double ds;
+ double nom, den;
+
+ ds = 2.0 * resolution(image->indexed_cell, spot.h, spot.k, spot.l);
+
switch ( k ) {
case REF_SCALE :
return I_partial;
+ case REF_DIV :
+ nom = sqrt(2.0) * ds * sin(image->div);
+ den = sqrt(1.0 - cos(image->div));
+ return nom/den;
+
}
ERROR("No gradient defined for parameter %i\n", k);
@@ -107,6 +118,11 @@ static void apply_shift(struct image *image, int k, double shift)
image->osf += shift;
break;
+ case REF_DIV :
+ STATUS("Shifting div by %e\n", shift);
+ image->div += shift;
+ break;
+
default :
ERROR("No shift defined for parameter %i\n", k);
abort();