diff options
author | Thomas White <taw@physics.org> | 2013-03-08 15:23:15 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2013-04-17 17:33:48 +0200 |
commit | 698179b8bf305d0794d0bd205243c17682b7dc4a (patch) | |
tree | 0c48ff917fd82569c057209653654b970a47e0d8 | |
parent | 2d3209e0ad03ea6bc72a91f0bf34c7d5a3ba3732 (diff) |
pr_gradient_check: Improved checking
-rw-r--r-- | tests/pr_gradient_check.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/pr_gradient_check.c b/tests/pr_gradient_check.c index 1ca3a424..8896e58f 100644 --- a/tests/pr_gradient_check.c +++ b/tests/pr_gradient_check.c @@ -320,7 +320,7 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, vec2[n_line] = grad; n_line++; - if ( fabs(cgrad) < 5e-8 ) { + if ( (fabs(cgrad) < 5e-8) && (fabs(grad) < 5e-8) ) { n_small++; continue; } @@ -328,14 +328,15 @@ static double test_gradients(Crystal *cr, double incr_val, int refine, total += fabs(cgrad - grad); ntot++; - if ( !within_tolerance(grad, cgrad, 10.0) ) + if ( !within_tolerance(grad, cgrad, 10.0) + || !within_tolerance(cgrad, grad, 10.0) ) { - //STATUS("!- %s %3i %3i %3i" - // " %10.2Le %10.2e ratio = %5.2Lf" - // " %10.2e %10.2e\n", - // str, h, k, l, grad, cgrad, cgrad/grad, - // r1, r2); + STATUS("!- %s %3i %3i %3i" + " %10.2Le %10.2e ratio = %5.2Lf" + " %10.2e %10.2e\n", + str, h, k, l, grad, cgrad, cgrad/grad, + r1, r2); n_bad++; } else { |