 #define GRID_DEPTH 128
 
 const vec3 GRID_SIZE = vec3 (GRID_WIDTH, GRID_HEIGHT, GRID_DEPTH);
+
+#define MAX_GRID_ID (GRID_WIDTH * GRID_HEIGHT * GRID_DEPTH - 1)
 
 const float rho_0 = 1;
 

	uint neighbours[8*27];
	uint num_neighbours = 0;
	
	uint i;
	
	ivec3 gridoffset;
	for (gridoffset.x = -1; gridoffset.x <= 1; gridoffset.x++)
	for (gridoffset.y = -1; gridoffset.y <= 1; gridoffset.y++)
	for (gridoffset.z = -1; gridoffset.z <= 1; gridoffset.z++)
	{
		ivec3 ngrid = grid + gridoffset;
		int ngridid = ngrid.z * GRID_WIDTH * GRID_HEIGHT + ngrid.y * GRID_WIDTH + ngrid.x;
		for (uint j = 0; j < gridcounters[ngridid]; j++)
		{
			uint id = gridcells[ngridid].particleids[j];
			if (id == particleid)
				i = num_neighbours;
			neighbours[num_neighbours] = id;
			num_neighbours++;
		}
	}
	
	for (uint solver = 0; solver < 1; solver++) {

	barrier ();

	for (uint j = 0; j < num_neighbours; j++)
	{
		vec3 v_j = particles[neighbours[j]].velocity;
		particle.velocity += 0.01 * (v_j - v_i) * Wpoly6 (particle.position - particles[neighbours[j]].position);
	}*/

//	barrier ();
