aboutsummaryrefslogtreecommitdiff
path: root/src/post-refinement.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2015-05-09 00:28:42 +0200
committerThomas White <taw@physics.org>2015-05-19 13:57:14 +0200
commitd5c4f2c4f68ac0893b7f37d8835cd01c849360e8 (patch)
tree3bcd528efd02a611fc571c9761f180a9b40fab48 /src/post-refinement.c
parent143981305d0e3859e60a65d9f0b3d2ab147cdd52 (diff)
Minimise Ipart-GpIfull/L instead of Ipart-pIfull/GL
It's about a million times easier
Diffstat (limited to 'src/post-refinement.c')
-rw-r--r--src/post-refinement.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 51645f50..3008b7af 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -174,7 +174,7 @@ static double volume_fraction(double rlow, double rhigh, double pr,
}
-/* Return the gradient of p/G wrt parameter 'k' given the current status
+/* Return the gradient of pG wrt parameter 'k' given the current status
* of the crystal. */
double gradient(Crystal *cr, int k, Reflection *refl, PartialityModel pmodel)
{
@@ -188,7 +188,7 @@ double gradient(Crystal *cr, int k, Reflection *refl, PartialityModel pmodel)
get_partial(refl, &rlow, &rhigh, &p);
if ( k == GPARAM_OSF ) {
- return -p/(osf*osf);
+ return p;
}
if ( k == GPARAM_R ) {
@@ -203,7 +203,7 @@ double gradient(Crystal *cr, int k, Reflection *refl, PartialityModel pmodel)
Rghigh = volume_fraction_rgradient(rhigh, R, pmodel);
gr = 4.0*psph/(3.0*D) + (4.0*R/(3.0*D))*(Rglow - Rghigh);
- return gr / osf;
+ return gr * osf;
}
@@ -222,12 +222,12 @@ double gradient(Crystal *cr, int k, Reflection *refl, PartialityModel pmodel)
ds = 2.0 * resolution(crystal_get_cell(cr), hs, ks, ls);
gr = (ds/2.0)*(glow+ghigh) - 4.0*R*psph*ds/(3.0*D*D);
- return gr / osf;
+ return gr * osf;
}
gr = r_gradient(crystal_get_cell(cr), k, refl, image) * (glow-ghigh);
- return gr / osf;
+ return gr * osf;
}
@@ -429,7 +429,7 @@ static double pr_iterate(Crystal *cr, const RefList *full,
}
- delta_I = I_partial - (p * I_full / (L*G));
+ delta_I = I_partial - (G * p * I_full / L);
v_c = w * delta_I * gradients[k];
v_curr = gsl_vector_get(v, k);
gsl_vector_set(v, k, v_curr + v_c);
@@ -512,7 +512,7 @@ static double guide_dev(Crystal *cr, const RefList *full)
// h, k, l, G, p, I_partial, I_full,
// I_partial - p*G*I_full);
- dev += pow(I_partial - p*I_full/(G*L), 2.0);
+ dev += pow(I_partial - G*p*I_full/L, 2.0);
}