aboutsummaryrefslogtreecommitdiff
path: root/tests/pr_p_gradient_check.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2016-11-10 17:02:14 +0100
committerThomas White <taw@physics.org>2018-02-27 17:12:41 +0100
commitea1178d014eadb9fe8e24935693a5380b709ef33 (patch)
tree39ae4995a2da892917d7796e0f36e5568da1cea0 /tests/pr_p_gradient_check.c
parent77cf2edd09bb01ae331935f467064c751f6e338e (diff)
New partiality model from Ginn et al.
Diffstat (limited to 'tests/pr_p_gradient_check.c')
-rw-r--r--tests/pr_p_gradient_check.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/tests/pr_p_gradient_check.c b/tests/pr_p_gradient_check.c
index 5322fcca..b9da05bc 100644
--- a/tests/pr_p_gradient_check.c
+++ b/tests/pr_p_gradient_check.c
@@ -59,7 +59,7 @@ static void scan_partialities(RefList *reflections, RefList *compare,
{
signed int h, k, l;
Reflection *refl2;
- double rlow, rhigh, p;
+ double p;
get_indices(refl, &h, &k, &l);
refl2 = find_refl(compare, h, k, l);
@@ -69,7 +69,7 @@ static void scan_partialities(RefList *reflections, RefList *compare,
continue;
}
- get_partial(refl2, &rlow, &rhigh, &p);
+ p = get_partiality(refl2);
vals[idx][i] = p;
if ( unlikely(p < 0.0) ) {
ERROR("Negative partiality! %3i %3i %3i %f\n",
@@ -306,8 +306,6 @@ static double test_gradients(Crystal *cr, double incr_val, int refine,
i++;
} else {
- double r1, r2, p;
-
grad1 = (vals[1][i] - vals[0][i]) / incr_val;
grad2 = (vals[2][i] - vals[1][i]) / incr_val;
grad = (grad1 + grad2) / 2.0;
@@ -315,8 +313,6 @@ static double test_gradients(Crystal *cr, double incr_val, int refine,
cgrad = gradient(cr, refine, refl, pmodel);
- get_partial(refl, &r1, &r2, &p);
-
if ( isnan(cgrad) ) {
n_nan++;
continue;
@@ -343,11 +339,11 @@ static double test_gradients(Crystal *cr, double incr_val, int refine,
{
if ( !quiet ) {
- STATUS("!- %s %3i %3i %3i"
- " %10.2Le %10.2e ratio = %5.2Lf"
- " %10.2e %10.2e\n",
+ STATUS("!- %s %3i %3i %3i "
+ "%10.2Le %10.2e "
+ "ratio = %5.2Lf\n",
str, h, k, l, grad, cgrad,
- cgrad/grad, r1, r2);
+ cgrad/grad);
}
n_bad++;
@@ -447,18 +443,15 @@ int main(int argc, char *argv[])
rng = gsl_rng_alloc(gsl_rng_mt19937);
- for ( i=0; i<2; i++ ) {
+ for ( i=0; i<1; i++ ) {
UnitCell *rot;
double val;
PartialityModel pmodel;
if ( i == 0 ) {
- pmodel = PMODEL_SCSPHERE;
- STATUS("Testing SCSphere model:\n");
- } else if ( i == 1 ) {
- pmodel = PMODEL_SCGAUSSIAN;
- STATUS("Testing SCGaussian model.\n");
+ pmodel = PMODEL_XSPHERE;
+ STATUS("Testing XSphere model:\n");
} else {
ERROR("WTF?\n");
return 1;