             multipole_data, body_pos,
             shmem, lmem, ngb_i, apprCount, direCount, boxSizeInfo, curGroupSize, boxCenterInfo,
             group_eps, body_vel);
-
-#ifdef _ORIG_SHMEM_
-        lmem = &MEM_BUF[blockIdx.x* LMEM_STACK_SIZE*blockDim.x]; //Back to normal location
-#else
         lmem = &MEM_BUF[blockIdx.x*(LMEM_STACK_SIZE*blockDim.x + LMEM_EXTRA_SIZE)];
-#endif
 
         if(threadIdx.x == 0)
         {

  return y;
} 



  template<int SHIFT>

          //the amount of allocated shared memory

          // step 0                                                      //nullify part of the body_list that will be filled with bodies
          for (int i = n_direct; i < n_direct + nb; i += DIM)            //from the leaves that are being processed
            body_list[i + tid] = 0;
          __syncthreads();

          //step 1:
          if (flag && (directM[tid] <= nb) && (offset > 0))        //make sure that the thread indeed carries a leaf
            body_list[n_direct + offset- 1] = -1-jbody;            //whose bodies will be extracted
          __syncthreads();

          // step 2:
          const int nl = inclusive_segscan_array<DIM2>(&body_list[n_direct], nb, tid);
          nb = directM[prefix[nl_pre + nl - 1]];                       // number of bodies stored in these leaves
          __syncthreads();


          /*****************************************************************************
           *  example of what is accomplished in steps 0-2                             *
           *       ---------------------------                                         *
           * step 0: body_list = 000000000000000000000                                 *
           * step 1: body_list = n000m000p000000q00r00 n,m,.. = -1-jbody_n,m...        *
           * step 2: body_list = n n+1 n+2 n+3 m m+1 m+2 m+3 p p+1 p+2 p+3 p+4 p+5 ... *
           *****************************************************************************/

          n_bodies     -= nb;                                   //subtract from n_bodies number of bodies that have been extracted
          nl_pre       += nl;                                   //increase the number of leaves that where processed
          directM[tid] -= nb;                                   //subtract the number of extracted bodies in this pass
          offset        = max(offset - nb, 0);
          n_direct     += nb;                                  //increase the number of bodies to be procssed

          while(n_direct >= DIM) 
