                                       int imageSize)
 {
   __shared__ double shared_coords[PARTICLE_PER_BLOCK*3];
-  int threadID = blockIdx.x * blockDim.x + threadIdx.x;
+  int imageID = blockIdx.x * blockDim.x + threadIdx.x;
   int offset_coordinates_index = blockIdx.y * PARTICLE_PER_BLOCK;
   double sumR = 0.0, sumI = 0.0;
 

    shared_coords[threadIdx.x * 3 + 2] = gpu_z[offset_coordinates_index + threadIdx.x];
  }

  if(threadID >= imageSize)
    return;

  // TODO SET SUM ARRAYS TO ZERO

    sumI += gpu_particleCharge[particleID + offset_coordinates_index] * dotcos;
  }

  atomicAdd(&gpu_sumRnew[imageID], sumR);
  atomicAdd(&gpu_sumInew[imageID], sumI);
}

__global__ void BoxReciprocalGPU(double *gpu_prefact,
