aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-09-29 16:45:14 +0200
committerThomas White <taw@physics.org>2015-09-29 16:45:14 +0200
commitcd377d9555c13d6046e78a894e989b20f1cb4880 (patch)
treec6b92133f4b4c110992ef70f57bea80728a2423c /src
parent895db9c0e0d2c118f99432a851d9a56715420354 (diff)
Make prototypes of residual() and log_residual() agree
Diffstat (limited to 'src')
-rw-r--r--src/post-refinement.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 818911df..3e6ffd0f 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -670,12 +670,14 @@ static double pr_iterate(Crystal *cr, const RefList *full,
}
-static double log_residual(Crystal *cr, const RefList *full, int free)
+static double log_residual(Crystal *cr, const RefList *full, int verbose,
+ int free, int *pn_used)
{
double dev = 0.0;
double G, B;
Reflection *refl;
RefListIterator *iter;
+ int n_used = 0;
G = crystal_get_osf(cr);
B = crystal_get_Bfac(cr);
@@ -714,9 +716,11 @@ static double log_residual(Crystal *cr, const RefList *full, int free)
dev += w*dc*dc;
}
+ if ( pn_used != NULL ) *pn_used = n_used;
return dev;
}
+
static double residual(Crystal *cr, const RefList *full, int verbose, int free,
int *pn_used)
{
@@ -798,8 +802,8 @@ void all_residuals(Crystal **crystals, int n_crystals, RefList *full,
r = residual(crystals[i], full, 0, 0, NULL);
free_r = residual(crystals[i], full, 0, 1, NULL);
- log_r = log_residual(crystals[i], full, 0);
- free_log_r = log_residual(crystals[i], full, 1);
+ log_r = log_residual(crystals[i], full, 0, 0, NULL);
+ free_log_r = log_residual(crystals[i], full, 0, 1, NULL);
if ( isnan(r) || isnan(free_r)
|| isnan(log_r) || isnan(free_log_r) ) continue;
@@ -863,13 +867,13 @@ static void do_scale_refine(Crystal *cr, const RefList *full,
int i, done;
double old_dev;
- old_dev = log_residual(cr, full, 0);
+ old_dev = log_residual(cr, full, 0, 0, NULL);
if ( verbose ) {
STATUS("Initial G=%.2f, B=%e\n",
crystal_get_osf(cr), crystal_get_Bfac(cr));
STATUS("Scaling initial dev = %10.5e, free dev = %10.5e\n",
- old_dev, log_residual(cr, full, 0));
+ old_dev, log_residual(cr, full, 0, 1, NULL));
}
i = 0;
@@ -880,12 +884,12 @@ static void do_scale_refine(Crystal *cr, const RefList *full,
scale_iterate(cr, full, pmodel);
- dev = log_residual(cr, full, 0);
+ dev = log_residual(cr, full, 0, 0, NULL);
if ( fabs(dev - old_dev) < dev*0.01 ) done = 1;
if ( verbose ) {
STATUS("Scaling %2i: dev = %10.5e, free dev = %10.5e\n",
- i+1, dev, log_residual(cr, full, 0));
+ i+1, dev, log_residual(cr, full, 0, 0, NULL));
}
i++;