diff options
author | Thomas White <taw@physics.org> | 2018-05-02 17:41:47 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-05-07 10:08:02 +0200 |
commit | 5790b06b2e0080c48e1e9a33eb0b43914f2b5824 (patch) | |
tree | f8c81f623aca9ca797ed85ec7fd7c648859e7287 /src/scaling.c | |
parent | 294965d42b309e98c8952d3a5dea753af21713a6 (diff) |
Move residual() and log_residual() to merge.c
Diffstat (limited to 'src/scaling.c')
-rw-r--r-- | src/scaling.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/scaling.c b/src/scaling.c index 5f896e65..92f618ae 100644 --- a/src/scaling.c +++ b/src/scaling.c @@ -221,72 +221,6 @@ static double scale_iterate(Crystal *cr, const RefList *full, int *nr) } -double log_residual(Crystal *cr, const RefList *full, int free, - int *pn_used, const char *filename) -{ - double dev = 0.0; - double G, B; - Reflection *refl; - RefListIterator *iter; - int n_used = 0; - FILE *fh = NULL; - - G = crystal_get_osf(cr); - B = crystal_get_Bfac(cr); - if ( filename != NULL ) { - fh = fopen(filename, "a"); - if ( fh == NULL ) { - ERROR("Failed to open '%s'\n", filename); - } - } - - for ( refl = first_refl(crystal_get_reflections(cr), &iter); - refl != NULL; - refl = next_refl(refl, iter) ) - { - double p, L, s, w; - signed int h, k, l; - Reflection *match; - double esd, I_full, I_partial; - double fx, dc; - - if ( free && !get_flag(refl) ) continue; - - get_indices(refl, &h, &k, &l); - match = find_refl(full, h, k, l); - if ( match == NULL ) continue; - - p = get_partiality(refl); - L = get_lorentz(refl); - I_partial = get_intensity(refl); - I_full = get_intensity(match); - esd = get_esd_intensity(refl); - s = resolution(crystal_get_cell(cr), h, k, l); - - if ( I_partial <= 3.0*esd ) continue; /* Also because of log */ - if ( get_redundancy(match) < 2 ) continue; - if ( I_full <= 0 ) continue; /* Because log */ - if ( p <= 0.0 ) continue; /* Because of log */ - - fx = -log(G) + log(p) - log(L) - B*s*s + log(I_full); - dc = log(I_partial) - fx; - w = 1.0; - dev += w*dc*dc; - - if ( fh != NULL ) { - fprintf(fh, "%4i %4i %4i %e %e\n", - h, k, l, s, dev); - } - - } - - if ( fh != NULL ) fclose(fh); - - if ( pn_used != NULL ) *pn_used = n_used; - return dev; -} - - static void do_scale_refine(Crystal *cr, const RefList *full, int *nr) { int i, done; |