diff options
author | Thomas White <taw@physics.org> | 2011-05-10 16:17:51 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:25 +0100 |
commit | 5b4a682c4d2dac7d87fc5627ec2f0b8547248462 (patch) | |
tree | e15d9858d184dc94b13f3a03c2a7d74427d31f6d /src/post-refinement.c | |
parent | 2b2cb2c85316e9379a9e93fde5293df823cadf5e (diff) |
Fix sign of gradients
If clamp_low is not set, increasing the magnitude of the scattering
vector decreases the partiality.
Diffstat (limited to 'src/post-refinement.c')
-rw-r--r-- | src/post-refinement.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c index 9131905e..2dc7d433 100644 --- a/src/post-refinement.c +++ b/src/post-refinement.c @@ -121,10 +121,10 @@ static double gradient(struct image *image, int k, Reflection *refl, double r) /* Calculate the gradient of partiality wrt excitation error. */ g = 0.0; if ( clamp_low == 0 ) { - g += partiality_gradient(r1, r); + g -= partiality_gradient(r1, r); } if ( clamp_high == 0 ) { - g -= partiality_gradient(r2, r); + g += partiality_gradient(r2, r); } //STATUS("clamp status low=%i high=%i\n", clamp_low, clamp_high); //STATUS("excitation errors %e %e\n", r1, r2); @@ -151,11 +151,11 @@ 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(azi) * g; case REF_BSX : - return -ks * sin(tt) * cos(azi) * g; + return ks * sin(tt) * cos(azi) * g; case REF_CSX : - return -ls * sin(tt) * cos(azi) * g; + return ls * sin(tt) * cos(azi) * g; case REF_ASY : return hs * sin(tt) * sin(azi) * g; case REF_BSY : |