aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-05-10 16:58:40 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:26 +0100
commit39854387bd8fcf4f5a8c89ccb39a6a0f0171985a (patch)
tree6d50f41692773fe88233b98d232f4b7ac794f232
parentf0fa4f72b89eacc72b40eb7ecfa244d1dce6582a (diff)
Correct gradients for y components
Problems with zeroes in normal matrix
-rw-r--r--src/post-refinement.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 087cca67..27ce6605 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -37,10 +37,10 @@ enum {
REF_ASX,
REF_BSX,
REF_CSX,
- NUM_PARAMS,
REF_ASY,
REF_BSY,
REF_CSY,
+ NUM_PARAMS,
REF_ASZ,
REF_BSZ,
REF_CSZ,
@@ -89,7 +89,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 ds, tt, azi;
+ double ds, tt, azix, aziy;
double nom, den;
double g;
double asx, asy, asz;
@@ -112,7 +112,8 @@ static double gradient(struct image *image, int k, Reflection *refl, double r)
ds = 2.0 * resolution(image->indexed_cell, hs, ks, ls);
tt = angle_between(0.0, 0.0, 1.0, xl, yl, zl+1.0/image->lambda);
- azi = angle_between(1.0, 0.0, 0.0, xl, yl, 0.0);
+ azix = angle_between(1.0, 0.0, 0.0, xl, yl, 0.0);
+ aziy = angle_between(0.0, 1.0, 0.0, xl, yl, 0.0);
//STATUS("d*=%.2e, 2theta=%.2f deg, azi=%.2f deg\n",
// ds, rad2deg(tt), rad2deg(azi));
@@ -151,17 +152,17 @@ static double gradient(struct image *image, int k, Reflection *refl, double r)
/* Cell parameters and orientation */
case REF_ASX :
- return hs * sin(tt) * cos(azi) * g;
+ return hs * sin(tt) * cos(azix) * g;
case REF_BSX :
- return ks * sin(tt) * cos(azi) * g;
+ return ks * sin(tt) * cos(azix) * g;
case REF_CSX :
- return ls * sin(tt) * cos(azi) * g;
+ return ls * sin(tt) * cos(azix) * g;
case REF_ASY :
- return hs * sin(tt) * sin(azi) * g;
+ return hs * sin(tt) * cos(aziy) * g;
case REF_BSY :
- return ks * sin(tt) * sin(azi) * g;
+ return ks * sin(tt) * cos(aziy) * g;
case REF_CSY :
- return ls * sin(tt) * sin(azi) * g;
+ return ls * sin(tt) * cos(aziy) * g;
case REF_ASZ :
return hs * cos(tt) * g;
case REF_BSZ :