diff options
author | Thomas White <taw@physics.org> | 2014-09-30 16:58:29 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-09-30 16:58:29 +0200 |
commit | 015ffcd77acc4b7f3178753b21e6591fd8212e4c (patch) | |
tree | 45f96bce23cb229067bfaf97434b9fd621b695ee /tests/pr_p_gradient_check.c | |
parent | b57deca8061316d2fc09dedcf8a91fa7523f081f (diff) |
Cell vector gradients for SCSphere, plus general rationalisation
Diffstat (limited to 'tests/pr_p_gradient_check.c')
-rw-r--r-- | tests/pr_p_gradient_check.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/pr_p_gradient_check.c b/tests/pr_p_gradient_check.c index b224f9b4..a6a2f47e 100644 --- a/tests/pr_p_gradient_check.c +++ b/tests/pr_p_gradient_check.c @@ -59,8 +59,7 @@ static void scan_partialities(RefList *reflections, RefList *compare, { signed int h, k, l; Reflection *refl2; - double r1, r2, p; - int clamp_low, clamp_high; + double rlow, rhigh, p; get_indices(refl, &h, &k, &l); refl2 = find_refl(compare, h, k, l); @@ -70,8 +69,13 @@ static void scan_partialities(RefList *reflections, RefList *compare, continue; } - get_partial(refl2, &r1, &r2, &p, &clamp_low, &clamp_high); + get_partial(refl2, &rlow, &rhigh, &p); vals[idx][i] = p; + if ( unlikely(p < 0.0) ) { + ERROR("Negative partiality! %3i %3i %3i %f\n", + h, k, l, p); + } + i++; } } @@ -293,7 +297,6 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, } else { double r1, r2, p; - int cl, ch; grad1 = (vals[1][i] - vals[0][i]) / incr_val; grad2 = (vals[2][i] - vals[1][i]) / incr_val; @@ -302,7 +305,7 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, cgrad = p_gradient(cr, refine, refl, pmodel); - get_partial(refl, &r1, &r2, &p, &cl, &ch); + get_partial(refl, &r1, &r2, &p); if ( isnan(cgrad) ) { n_nan++; @@ -447,7 +450,8 @@ int main(int argc, char *argv[]) STATUS("Testing SCSphere model:\n"); } else if ( i == 1 ) { pmodel = PMODEL_SCGAUSSIAN; - STATUS("Testing SCGaussian model.\n"); + STATUS("NOT Testing SCGaussian model.\n"); + continue; } else { ERROR("WTF?\n"); return 1; |