From 664db6be6a05b11e8a5df9f77c41ec54d3dd202a Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 25 Nov 2009 15:18:45 +0100 Subject: Reflection range (increase, trap when too high) --- src/utils.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/utils.h b/src/utils.h index 5221249f..e81ea840 100644 --- a/src/utils.h +++ b/src/utils.h @@ -35,7 +35,7 @@ #define THOMSON_LENGTH (2.81794e-15) /* Maxmimum index to go up to */ -#define INDMAX 20 +#define INDMAX 40 #define IDIM (INDMAX*2 +1) @@ -97,6 +97,13 @@ static inline double complex get_integral(double complex *ref, signed int h, { int idx; + if ( (abs(h) > INDMAX) || (abs(k) > INDMAX) || (abs(l) > INDMAX) ) { + printf("\nReflection %i %i %i is out of range!\n", h, k, l); + printf("You need to re-configure INDMAX, delete the reflection" + " cache file and re-run.\n"); + exit(1); + } + if ( h < 0 ) h += IDIM; if ( k < 0 ) k += IDIM; if ( l < 0 ) l += IDIM; -- cgit v1.2.3