diff options
-rw-r--r-- | data/diffraction.cl | 11 | ||||
-rw-r--r-- | src/diffraction-gpu.c | 3 |
2 files changed, 8 insertions, 6 deletions
diff --git a/data/diffraction.cl b/data/diffraction.cl index bac0c5c7..5ca7d571 100644 --- a/data/diffraction.cl +++ b/data/diffraction.cl @@ -109,15 +109,16 @@ float2 get_sfac(global float2 *sfacs, float16 cell, float4 q) k = round(kf); l = round(lf); + /* Return a silly value if indices are out of range */ if ( (abs(h) > INDMAX) || (abs(k) > INDMAX) || (abs(l) > INDMAX) ) { - return 100.0; + return 100000.0; } - if ( h < 0 ) h += IDIM; - if ( k < 0 ) k += IDIM; - if ( l < 0 ) l += IDIM; + h = (h>=0) ? h : h+IDIM; + k = (k>=0) ? k : k+IDIM; + l = (l>=0) ? l : l+IDIM; - if ( (h>=IDIM) || (k>=IDIM) || (l>=IDIM) ) return 100.0; + if ( (h>=IDIM) || (k>=IDIM) || (l>=IDIM) ) return 100000.0; idx = h + (IDIM*k) + (IDIM*IDIM*l); diff --git a/src/diffraction-gpu.c b/src/diffraction-gpu.c index 8a7bad32..7896c2d5 100644 --- a/src/diffraction-gpu.c +++ b/src/diffraction-gpu.c @@ -129,7 +129,8 @@ static cl_program load_program(const char *filename, cl_context ctx, return 0; } - r = clBuildProgram(prog, 0, NULL, "-Werror -I"DATADIR"/crystfel/", + r = clBuildProgram(prog, 0, NULL, + "-Werror -I"DATADIR"/crystfel/ -cl-no-signed-zeros", NULL, NULL); if ( r != CL_SUCCESS ) { ERROR("Couldn't build program '%s'\n", filename); |