aboutsummaryrefslogtreecommitdiff
path: root/src/partialator.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-09-24 16:51:59 +0200
committerThomas White <taw@physics.org>2015-09-25 13:06:36 +0200
commit895db9c0e0d2c118f99432a851d9a56715420354 (patch)
treede108ccb3a31fc17dad5b227869d504e83c00065 /src/partialator.c
parent63741b85b77d5a822e95318f549fe4d2392e29b8 (diff)
partialator: Rationalise residual calculation and display
Diffstat (limited to 'src/partialator.c')
-rw-r--r--src/partialator.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/partialator.c b/src/partialator.c
index de08df34..81c5ab37 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -585,6 +585,20 @@ static void normalise_scales(Crystal **crystals, int n_crystals)
}
+static void show_all_residuals(Crystal **crystals, int n_crystals,
+ RefList *full)
+{
+ double dev, free_dev, log_dev, free_log_dev;
+
+ all_residuals(crystals, n_crystals, full,
+ &dev, &free_dev, &log_dev, &free_log_dev);
+ STATUS("Residuals:"
+ " linear linear free log log free\n");
+ STATUS(" ");
+ STATUS("%15e %15e %15e %15e\n", dev, free_dev, log_dev, free_log_dev);
+}
+
+
int main(int argc, char *argv[])
{
int c;
@@ -990,29 +1004,15 @@ int main(int argc, char *argv[])
/* Iterate */
for ( i=0; i<n_iter; i++ ) {
- double init_dev, init_free_dev;
- double init_log_dev, init_free_log_dev;
- double final_dev, final_free_dev;
- double final_log_dev, final_free_log_dev;
+ show_all_residuals(crystals, n_crystals, full);
STATUS("Refinement cycle %i of %i\n", i+1, n_iter);
/* Refine all crystals to get the best fit */
refine_all(crystals, n_crystals, full, nthreads, pmodel,
- no_scale, no_pr, max_B,
- &init_dev, &init_free_dev,
- &init_log_dev, &init_free_log_dev,
- &final_dev, &final_free_dev,
- &final_log_dev, &final_free_log_dev);
-
- STATUS("Overall residual: initial = %e, final = %e\n",
- init_dev, final_dev);
- STATUS("Overall free residual: initial = %e, final = %e\n",
- init_free_dev, final_free_dev);
- STATUS("Overall log residual: initial = %e, final = %e\n",
- init_log_dev, final_log_dev);
- STATUS("Overall log free residual: initial = %e, final = %e\n",
- init_free_log_dev, final_free_log_dev);
+ no_scale, no_pr, max_B);
+
+ show_all_residuals(crystals, n_crystals, full);
check_rejection(crystals, n_crystals, full);
normalise_scales(crystals, n_crystals);
@@ -1026,6 +1026,8 @@ int main(int argc, char *argv[])
}
+ show_all_residuals(crystals, n_crystals, full);
+
/* Output results */
STATUS("Writing overall results to %s\n", outfile);
write_reflist_2(outfile, full, sym);