aboutsummaryrefslogtreecommitdiff
path: root/src/diffraction.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-10-26 14:57:51 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:03 +0100
commit18e61c8671d72f56f6203fd49740e501cb53b784 (patch)
treef00dd03a9127ee98b32938318a720ae472156267 /src/diffraction.c
parent2bcb74ccca7bb149b49ab004363ca5aae5a0e4cb (diff)
Return zero if reflection is out of range
Diffstat (limited to 'src/diffraction.c')
-rw-r--r--src/diffraction.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/diffraction.c b/src/diffraction.c
index 29e30431..93ac7f8e 100644
--- a/src/diffraction.c
+++ b/src/diffraction.c
@@ -229,7 +229,10 @@ static double molecule_factor(const double *intensities,const double *phases,
h = (signed int)rint(hd);
k = (signed int)rint(kd);
l = (signed int)rint(ld);
- r = lookup_intensity(intensities, h, k, l);
+ if ( abs(h) > INDMAX ) r = 0.0;
+ else if ( abs(k) > INDMAX ) r = 0.0;
+ else if ( abs(l) > INDMAX ) r = 0.0;
+ else r = lookup_intensity(intensities, h, k, l);
break;
case GRADIENT_INTERPOLATE :
r = interpolate_intensity(intensities, hd, kd, ld);