From 698179b8bf305d0794d0bd205243c17682b7dc4a Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 8 Mar 2013 15:23:15 +0100 Subject: pr_gradient_check: Improved checking --- tests/pr_gradient_check.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'tests') 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 { -- cgit v1.2.3