From 7d8662ffe897dc2438141ecc8848863bad9b9d92 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 26 Feb 2010 16:47:27 +0100 Subject: Move water calculation to diffraction.c, and work out the consequences --- data/diffraction.cl | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'data/diffraction.cl') diff --git a/data/diffraction.cl b/data/diffraction.cl index d3fef375..a401cdfa 100644 --- a/data/diffraction.cl +++ b/data/diffraction.cl @@ -130,11 +130,11 @@ float2 get_sfac(global float2 *sfacs, float16 cell, float4 q) } -kernel void diffraction(global float2 *diff, global float *tt, float klow, +kernel void diffraction(global float *diff, global float *tt, float klow, int w, float cx, float cy, float res, float clen, float16 cell, global float2 *sfacs, float4 z, int4 ncells, - int xmin, int ymin, int sampling, local float2 *tmp, + int xmin, int ymin, int sampling, local float *tmp, float kstep) { float ttv; @@ -149,6 +149,8 @@ kernel void diffraction(global float2 *diff, global float *tt, float klow, float k = klow + kstep * get_local_id(2); const int ax = x / sampling; const int ay = y / sampling; + float intensity; + float2 val; /* Calculate value */ q = get_q(x, y, cx, cy, res, clen, k, &ttv, z, sampling); @@ -156,7 +158,9 @@ kernel void diffraction(global float2 *diff, global float *tt, float klow, f_molecule = get_sfac(sfacs, cell, q); /* Write the value to local memory */ - tmp[lx+sampling*ly+sampling*sampling*lb] = f_molecule * f_lattice; + val = f_molecule * f_lattice; + intensity = pow(val.x, 2.0f) + pow(val.y, 2.0f); + tmp[lx+sampling*ly+sampling*sampling*lb] = intensity; /* Memory fence */ barrier(CLK_LOCAL_MEM_FENCE); @@ -165,12 +169,14 @@ kernel void diffraction(global float2 *diff, global float *tt, float klow, if ( lx + ly + lb == 0 ) { int i; - float2 sum = (float2)(0.0, 0.0); + float sum = 0.0; + float val; for ( i=0; i