aboutsummaryrefslogtreecommitdiff
path: root/src/predict-refine.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-03-29 08:11:21 -0700
committerThomas White <taw@physics.org>2015-04-20 15:50:39 +0200
commit69f9a5646f12f6055328e28c03ced984e9d6cbd5 (patch)
tree49215c901c18029cbf0295c6e2b5bba600c360ea /src/predict-refine.c
parentfb6317cf0679a8a847133360d6e35fc8f0bfbec9 (diff)
Add GPARAM_DETX, GPARAM_DETY and GPARAM_CLEN
Diffstat (limited to 'src/predict-refine.c')
-rw-r--r--src/predict-refine.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/predict-refine.c b/src/predict-refine.c
index ff5fa862..28c9fdc7 100644
--- a/src/predict-refine.c
+++ b/src/predict-refine.c
@@ -235,7 +235,7 @@ static double x_gradient(int param, struct reflpeak *rp, struct detector *det,
tt = asin(lambda * resolution(cell, h, k, l));
clen = rp->panel->clen;
azi = atan2(yh, xh);
- azf = 2.0*cos(azi); /* FIXME: Why factor of 2? */
+ azf = cos(azi);
switch ( param ) {
@@ -258,13 +258,22 @@ static double x_gradient(int param, struct reflpeak *rp, struct detector *det,
return 0.0;
case GPARAM_ASZ :
- return -h * lambda * clen * azf * sin(tt) / (cos(tt)*cos(tt));
+ return -h * lambda * clen * 2*azf * sin(tt) / (cos(tt)*cos(tt));
case GPARAM_BSZ :
- return -k * lambda * clen * azf * sin(tt) / (cos(tt)*cos(tt));
+ return -k * lambda * clen * 2*azf * sin(tt) / (cos(tt)*cos(tt));
case GPARAM_CSZ :
- return -l * lambda * clen * azf * sin(tt) / (cos(tt)*cos(tt));
+ return -l * lambda * clen * 2*azf * sin(tt) / (cos(tt)*cos(tt));
+
+ case GPARAM_DETX :
+ return -1;
+
+ case GPARAM_DETY :
+ return 0;
+
+ case GPARAM_CLEN :
+ return azf * cos(tt);
}
@@ -290,7 +299,7 @@ static double y_gradient(int param, struct reflpeak *rp, struct detector *det,
tt = asin(lambda * resolution(cell, h, k, l));
clen = rp->panel->clen;
azi = atan2(yh, xh);
- azf = 2.0*sin(azi); /* FIXME: Why factor of 2? */
+ azf = sin(azi);
switch ( param ) {
@@ -313,14 +322,22 @@ static double y_gradient(int param, struct reflpeak *rp, struct detector *det,
return l * lambda * clen / cos(tt);
case GPARAM_ASZ :
- return -h * lambda * clen * azf * sin(tt) / (cos(tt)*cos(tt));
+ return -h * lambda * clen * 2*azf * sin(tt) / (cos(tt)*cos(tt));
case GPARAM_BSZ :
- return -k * lambda * clen * azf * sin(tt) / (cos(tt)*cos(tt));
+ return -k * lambda * clen * 2*azf * sin(tt) / (cos(tt)*cos(tt));
case GPARAM_CSZ :
- return -l * lambda * clen * azf * sin(tt) / (cos(tt)*cos(tt));
+ return -l * lambda * clen * 2*azf * sin(tt) / (cos(tt)*cos(tt));
+
+ case GPARAM_DETX :
+ return 0;
+
+ case GPARAM_DETY :
+ return -1;
+ case GPARAM_CLEN :
+ return azf * cos(tt);
}
ERROR("Positional gradient requested for parameter %i?\n", param);