aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-10-05 20:02:35 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:01 +0100
commita308a13ad39ab0976c3dfdc89e15964b0b9847d1 (patch)
tree3bc893bdc11e8375cb8dd82521b5e076f14aa1aa
parentb56be18e02570926e1cb56170556f4b0a3e2aec0 (diff)
compare_hkl: More R vs q
-rw-r--r--src/compare_hkl.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index 00d15e9c..f0e8993e 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -29,7 +29,7 @@
/* Number of bins for plot of resolution shells */
-#define NBINS (10)
+#define NBINS (50)
static void show_help(const char *s)
@@ -51,10 +51,9 @@ static void plot_shells(const double *ref1, const double *ref2,
ReflItemList *items, double scale, UnitCell *cell)
{
double num[NBINS];
- double den[NBINS];
+ double den;
double rmin, rmax, rstep;
int i;
- double dentot;
FILE *fh;
if ( cell == NULL ) {
@@ -70,7 +69,6 @@ static void plot_shells(const double *ref1, const double *ref2,
for ( i=0; i<NBINS; i++ ) {
num[i] = 0.0;
- den[i] = 0.0;
}
rmin = +INFINITY;
@@ -91,27 +89,7 @@ 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;
-
- }
-
+ den = 0.0;
for ( i=0; i<num_items(items); i++ ) {
struct refl_item *it;
@@ -135,7 +113,7 @@ static void plot_shells(const double *ref1, const double *ref2,
f2 = sqrt(i2);
num[bin] += fabs(f1 - f2);
- den[bin] = dentot;
+ den += (f1 + f2) / 2.0;
}
@@ -143,7 +121,7 @@ static void plot_shells(const double *ref1, const double *ref2,
double r, cen;
cen = rmin + rstep*i + rstep/2.0;
- r = num[i]/den[i];
+ r = num[i]/den;
fprintf(fh, "%f %f\n", cen/1.0e-10, r*100.0);
}