         }
         __syncthreads();
     }
-    
+
     if (tx == 0) {
         dSum1[blockIdx.x] = sum1[0];
         dSum2[blockIdx.x] = sum2[0];


        CFirstDeriv[PADDED_STATE_COUNT* MULTIPLY_BLOCK_SIZE * by + MULTIPLY_BLOCK_SIZE * bx +
          PADDED_STATE_COUNT * ty + tx] = CFirstDerivSub;
          
        CSecondDeriv[PADDED_STATE_COUNT* MULTIPLY_BLOCK_SIZE * by + MULTIPLY_BLOCK_SIZE * bx +
          PADDED_STATE_COUNT * ty + tx] = CSecondDerivSub;
    }

        sum2[tx] = 0.0;
        sum3[tx] = 0.0;
    }

    __syncthreads();

    for (unsigned int s = SUM_SITES_BLOCK_SIZE / 2; s > 0; s >>= 1) {
        if (tx < s) {
            sum1[tx] += sum1[tx + s];
