aboutsummaryrefslogtreecommitdiff
path: root/src/post-refinement.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-05-02 17:41:47 +0200
committerThomas White <taw@physics.org>2018-05-07 10:08:02 +0200
commit5790b06b2e0080c48e1e9a33eb0b43914f2b5824 (patch)
treef8c81f623aca9ca797ed85ec7fd7c648859e7287 /src/post-refinement.c
parent294965d42b309e98c8952d3a5dea753af21713a6 (diff)
Move residual() and log_residual() to merge.c
Diffstat (limited to 'src/post-refinement.c')
-rw-r--r--src/post-refinement.c53
1 files changed, 1 insertions, 52 deletions
diff --git a/src/post-refinement.c b/src/post-refinement.c
index 293fe332..4e83eacc 100644
--- a/src/post-refinement.c
+++ b/src/post-refinement.c
@@ -45,6 +45,7 @@
#include "cell-utils.h"
#include "reflist-utils.h"
#include "scaling.h"
+#include "merge.h"
struct prdata
@@ -83,58 +84,6 @@ const char *str_prflag(enum prflag flag)
}
-double residual(Crystal *cr, const RefList *full, int free,
- int *pn_used, const char *filename)
-{
- Reflection *refl;
- RefListIterator *iter;
- int n_used = 0;
- double num = 0.0;
- double den = 0.0;
- double G = crystal_get_osf(cr);
- double B = crystal_get_Bfac(cr);
- UnitCell *cell = crystal_get_cell(cr);
-
- for ( refl = first_refl(crystal_get_reflections(cr), &iter);
- refl != NULL;
- refl = next_refl(refl, iter) )
- {
- double p, w, corr, res;
- signed int h, k, l;
- Reflection *match;
- double I_full;
- double int1, int2;
-
- if ( free && !get_flag(refl) ) continue;
-
- get_indices(refl, &h, &k, &l);
- res = resolution(cell, h, k, l);
- match = find_refl(full, h, k, l);
- if ( match == NULL ) continue;
- I_full = get_intensity(match);
-
- if ( get_redundancy(match) < 2 ) continue;
-
- p = get_partiality(refl);
- //if ( p < 0.2 ) continue;
-
- corr = G * exp(B*res*res) * get_lorentz(refl);
- int1 = get_intensity(refl) * corr;
- int2 = p*I_full;
- w = p;
-
- num += fabs(int1 - int2) * w;
- den += fabs(int1 + int2) * w/2.0;
-
- n_used++;
-
- }
-
- if ( pn_used != NULL ) *pn_used = n_used;
- return num/(den*sqrt(2));
-}
-
-
static UnitCell *rotate_cell_xy(const UnitCell *cell, double ang1, double ang2)
{
UnitCell *o;