diff options
author | Thomas White <taw@bitwiz.org.uk> | 2010-03-27 13:12:51 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2010-03-27 13:12:51 +0100 |
commit | bdd2a7b4a8a5456a023d54be6fd5d6a011314c7e (patch) | |
tree | 3d13a13a57e724ed94505b3b919d40e18c095cc6 /src/diffraction.c | |
parent | a6e064b18ed513d341d8793acbc485d7bc291827 (diff) |
Allow molecule_factor() to tell when it doesn't know the intensity
Diffstat (limited to 'src/diffraction.c')
-rw-r--r-- | src/diffraction.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/diffraction.c b/src/diffraction.c index 5ecf04f5..675aa148 100644 --- a/src/diffraction.c +++ b/src/diffraction.c @@ -70,10 +70,11 @@ static double lattice_factor(struct rvec q, double ax, double ay, double az, /* Look up the structure factor for the nearest Bragg condition */ -static double molecule_factor(double *intensities, struct rvec q, - double ax, double ay, double az, - double bx, double by, double bz, - double cx, double cy, double cz) +static double molecule_factor(double *intensities, unsigned int *counts, + struct rvec q, + double ax, double ay, double az, + double bx, double by, double bz, + double cx, double cy, double cz) { double hd, kd, ld; signed int h, k, l; @@ -86,8 +87,13 @@ static double molecule_factor(double *intensities, struct rvec q, k = (signed int)rint(kd); l = (signed int)rint(ld); - r = lookup_intensity(intensities, h, k, l); + if ( lookup_count(counts, h, k, l) == 0 ) { + ERROR("Needed intensity for %i %i %i, but don't have it.\n", + h, k, l); + return 1.0e20; + } + r = lookup_intensity(intensities, h, k, l); return r; } @@ -171,7 +177,8 @@ struct rvec get_q(struct image *image, unsigned int xs, unsigned int ys, void get_diffraction(struct image *image, int na, int nb, int nc, - double *intensities, UnitCell *cell, int do_water) + double *intensities, unsigned int *counts, UnitCell *cell, + int do_water) { unsigned int xs, ys; double ax, ay, az; @@ -225,8 +232,10 @@ void get_diffraction(struct image *image, int na, int nb, int nc, if ( intensities == NULL ) { I_molecule = 1.0e10; } else { - I_molecule = molecule_factor(intensities, q, - ax,ay,az,bx,by,bz,cx,cy,cz); + I_molecule = molecule_factor(intensities, + counts, q, + ax,ay,az, + bx,by,bz,cx,cy,cz); } I_lattice = pow(f_lattice, 2.0); |