diff options
author | Thomas White <taw@bitwiz.org.uk> | 2010-10-06 00:04:01 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:01 +0100 |
commit | 3f42fce00b80a8073b3c1d2b7bb24446336dec70 (patch) | |
tree | ce0d97fa031d7fc450ed6306bb8d7d12b7c348bf /src | |
parent | a308a13ad39ab0976c3dfdc89e15964b0b9847d1 (diff) |
compare_hkl: More R vs q
Diffstat (limited to 'src')
-rw-r--r-- | src/compare_hkl.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/compare_hkl.c b/src/compare_hkl.c index f0e8993e..7b5d85fa 100644 --- a/src/compare_hkl.c +++ b/src/compare_hkl.c @@ -51,9 +51,11 @@ static void plot_shells(const double *ref1, const double *ref2, ReflItemList *items, double scale, UnitCell *cell) { double num[NBINS]; + int cts[NBINS]; double den; double rmin, rmax, rstep; int i; + int ctot; FILE *fh; if ( cell == NULL ) { @@ -69,6 +71,7 @@ static void plot_shells(const double *ref1, const double *ref2, for ( i=0; i<NBINS; i++ ) { num[i] = 0.0; + cts[i] = 0; } rmin = +INFINITY; @@ -90,6 +93,7 @@ static void plot_shells(const double *ref1, const double *ref2, rstep = (rmax-rmin) / NBINS; den = 0.0; + ctot = 0; for ( i=0; i<num_items(items); i++ ) { struct refl_item *it; @@ -104,6 +108,7 @@ static void plot_shells(const double *ref1, const double *ref2, d = 0.5/resolution(cell, h, k, l); bin = (d-rmin)/rstep; + if ( bin == NBINS ) bin = NBINS-1; i1 = lookup_intensity(ref1, h, k, l); if ( i1 < 0.0 ) continue; @@ -114,6 +119,8 @@ static void plot_shells(const double *ref1, const double *ref2, num[bin] += fabs(f1 - f2); den += (f1 + f2) / 2.0; + cts[bin]++; + ctot++; } @@ -121,8 +128,8 @@ static void plot_shells(const double *ref1, const double *ref2, double r, cen; cen = rmin + rstep*i + rstep/2.0; - r = num[i]/den; - fprintf(fh, "%f %f\n", cen/1.0e-10, r*100.0); + r = (num[i]/den)*(ctot/cts[i]); + fprintf(fh, "%f %f %i\n", cen*1.0e-9, r*100.0, cts[i]); } |