aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-07-23 11:25:10 +0200
committerThomas White <taw@physics.org>2015-07-23 11:25:10 +0200
commitb9df4629055f939cfbc4d0d61a4290e7a6974998 (patch)
tree0eb088835908d7f2d39e58b006ca4b056ba121f3 /src
parent77ef5407a9e42c9b6f02b079fb0bb390e933a71c (diff)
Fix PR gradients (again - reverts 22dee8348b165d33262112ed1bbaf7f574b96c7e)
The gradients are correct, the test way wrong.
Diffstat (limited to 'src')
-rw-r--r--src/post-refinement.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 6630cfc9..16fc1791 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -449,6 +449,12 @@ static double pr_iterate(Crystal *cr, const RefList *full,
/* Calculate all gradients for this reflection */
for ( k=0; k<num_params; k++ ) {
gradients[k] = gradient(cr, rv[k], refl, pmodel);
+
+ /* Gradients affecting the "p" part of the residual
+ * need to account for it being ln(p) */
+ if ( (rv[k] != GPARAM_OSF) && (rv[k] != GPARAM_BFAC) ) {
+ gradients[k] /= p;
+ }
}
for ( k=0; k<num_params; k++ ) {