aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-08-15 10:41:47 +0200
committerThomas White <taw@physics.org>2013-09-13 14:31:31 +0200
commit620d8f4c8a9e1805594a9240550f383b27368543 (patch)
tree55c9478ce68096bf8ca638f1e9d99a1b9c81ab95 /src
parentf56ec1433c41a23fd2f476069876477961bfc0c6 (diff)
Stop PR when mean change in partiality is small
Diffstat (limited to 'src')
-rw-r--r--src/partialator.c4
-rw-r--r--src/post-refinement.c15
2 files changed, 12 insertions, 7 deletions
diff --git a/src/partialator.c b/src/partialator.c
index ad6d9a49..97d2b689 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -607,13 +607,15 @@ int main(int argc, char *argv[])
RefList *as;
int n_gained = 0;
int n_lost = 0;
+ double mean_p_change = 0.0;
cryst = images[i].crystals[j];
crystal_set_image(cryst, &images[i]);
/* Now it's safe to do the following */
update_partialities_2(cryst, pmodel,
- &n_gained, &n_lost);
+ &n_gained, &n_lost,
+ &mean_p_change);
assert(n_gained == 0); /* That'd just be silly */
as = crystal_get_reflections(cryst);
nobs += select_scalable_reflections(as, reference);
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 05e1829a..43cc002b 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -661,11 +661,12 @@ static void free_backup_crystal(Crystal *cr)
struct prdata pr_refine(Crystal *cr, const RefList *full,
PartialityModel pmodel)
{
- double max_shift, dev;
+ double dev;
int i;
Crystal *backup;
const int verbose = 0;
struct prdata prdata;
+ double mean_p_change = 0.0;
if ( verbose ) {
dev = guide_dev(cr, full);
@@ -692,15 +693,17 @@ struct prdata pr_refine(Crystal *cr, const RefList *full,
&bsx, &bsy, &bsz, &csx, &csy, &csz);
prdata.n_filtered = 0;
- max_shift = pr_iterate(cr, full, pmodel, &prdata);
+ pr_iterate(cr, full, pmodel, &prdata);
- update_partialities_2(cr, pmodel, &n_gained, &n_lost);
+ update_partialities_2(cr, pmodel, &n_gained, &n_lost,
+ &mean_p_change);
if ( verbose ) {
dev = guide_dev(cr, full);
- STATUS("PR Iteration %2i: max shift = %10.2f"
+ STATUS("PR Iteration %2i: mean p change = %10.2f"
" dev = %10.5e, %i gained, %i lost, %i total\n",
- i+1, max_shift, dev, n_gained, n_lost, n_total);
+ i+1, mean_p_change, dev,
+ n_gained, n_lost, n_total);
}
if ( 3*n_lost > n_total ) {
@@ -710,7 +713,7 @@ struct prdata pr_refine(Crystal *cr, const RefList *full,
i++;
- } while ( (max_shift > 50.0) && (i < MAX_CYCLES) );
+ } while ( (mean_p_change > 0.01) && (i < MAX_CYCLES) );
free_backup_crystal(backup);