    checkForCudaError("Before moveParticles");
    moveParticles<<<numBlocks, blockSize, 0, stream>>>(
       partLoc.getPtr(), partVel.getPtr(),
-      ex.getPtr(), ey.getPtr(),
       numParticles, mass, NX1, NY1);
    checkForCudaError("moveParticles");
 

         a2=D_DX * delb - a1;
         a3=D_DY * dela - a1;
         a4=D_DX * D_DY-(a1+a2+a3);
         local_expf=(a1*ex[NX1 * (nii+1) + nj1] + 
            a2*ex[NX1 * (nii+1) + nj] +
            a3*ex[NX1 * nii + nj1] + 
            a4*ex[NX1 * nii + nj])/D_TOTA;
         local_eypf=(a1*ey[NX1 * (nii+1) + nj1] +
            a2*ey[NX1 * (nii+1) + nj] +
            a3*ey[NX1 * nii + nj1]+
            a4*ey[NX1 * nii + nj])/D_TOTA;
         c1= D_DELT * mass;
         c2=0.5f;
         c3=c1*0.5f;

#include "particle_allocator.h"
#include "pic_utils.h"

// Texture reference for 2D float texture
texture<float, 2, cudaReadModeElementType> texEx;
texture<float, 2, cudaReadModeElementType> texEy;


__global__
void checkBoundaryConditions(float2 location[], int numParticles, int height, int width, 
