   // first thread inside the block will write back to global memory
   __syncthreads();
   if(threadIdx.x == 0) {
-    for(int w=1; w<8; w++) {
+    for(int w=1; w<THREADS_PER_BLOCK/32; w++) {
       forceX += shared[w*3+0];
       forceY += shared[w*3+1];
       forceZ += shared[w*3+2];

  int box
)
{
  __shared__ double shared[24];
  int laneID = threadIdx.x % 32;
  int warpID = threadIdx.x / 32;
  int particleID = blockIdx.x;

#include "CUDAMemoryManager.cuh"
#include "cub/cub.cuh"
#include <vector>

#define THREADS_PER_BLOCK 256

using namespace cub;

