diff options
author | Thomas White <taw@physics.org> | 2010-10-05 18:54:12 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:01 +0100 |
commit | 0cb609aa2c75e5d0e99b355fe176ed682ee0b05d (patch) | |
tree | e24a447b4838534e6b321225fab633412fa505c7 /src/compare_hkl.c | |
parent | 60640f822ae0514bf2c950c6aca14f5d4b04df1f (diff) |
compare_hkl: Get denominator correct for resolution shell graph
.. I think?
Diffstat (limited to 'src/compare_hkl.c')
-rw-r--r-- | src/compare_hkl.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/compare_hkl.c b/src/compare_hkl.c index d918e5cb..eed177c4 100644 --- a/src/compare_hkl.c +++ b/src/compare_hkl.c @@ -54,6 +54,7 @@ static void plot_shells(const double *ref1, const double *ref2, double den[NBINS]; double rmin, rmax, rstep; int i; + double dentot; FILE *fh; if ( cell == NULL ) { @@ -90,6 +91,27 @@ static void plot_shells(const double *ref1, const double *ref2, } rstep = (rmax-rmin) / NBINS; + dentot = 0.0; + for ( i=0; i<num_items(items); i++ ) { + + struct refl_item *it; + signed int h, k, l; + double i1, i2, f1, f2; + + it = get_item(items, i); + h = it->h; k = it->k; l = it->l; + + i1 = lookup_intensity(ref1, h, k, l); + if ( i1 < 0.0 ) continue; + f1 = sqrt(i1); + i2 = lookup_intensity(ref2, h, k, l); + if ( i2 < 0.0 ) continue; + f2 = sqrt(i2); + + dentot += (f1 + f2) / 2.0; + + } + for ( i=0; i<num_items(items); i++ ) { struct refl_item *it; @@ -113,16 +135,16 @@ static void plot_shells(const double *ref1, const double *ref2, f2 = sqrt(i2); num[bin] += fabs(f1 - f2); - den[bin] += fabs(f1 + f2) / 2.0; + den[bin] = dentot; } for ( i=0; i<NBINS; i++ ) { - double r2, cen; + double r, cen; cen = rmin + rstep*i + rstep/2.0; - r2 = num[i]/den[i]; - fprintf(fh, "%f %f\n", cen/1.0e-10, r2*100.0); + r = num[i]/den[i]; + fprintf(fh, "%f %f\n", cen/1.0e-10, r*100.0); } |