aboutsummaryrefslogtreecommitdiff
path: root/src/post-refinement.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/post-refinement.c')
-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++ ) {