 
 void cudaInitVBO(Grid *g, struct cudaGraphicsResource **cuda_resource, int percentOfCube)
 {
-    dim3 blocks, threads;
-    switch (g->dimension)
-    {
-        case DIM_1: blocks = blocks_1d; threads = threads_1d; break;
-        case DIM_2: blocks = blocks_2d; threads = threads_2d; break;
-        case DIM_3: blocks = blocks_3d; threads = threads_3d; break;
-    }
-
     VBOVertex *dev_ptr;
     size_t num_bytes;
     cudaGraphicsMapResources(1, cuda_resource, 0);

        case DIM_2: radiusZ = 0; break;
    }

    for (uint i = idx + idx*interactionRadius + iterx; i < xSize; i += gridOffsetx)
    {
        for (uint j = idy + idy*interactionRadius + itery; j < ySize; j += gridOffsety)
        {
            for (uint k = idz + idz*interactionRadius + iterz; k < zSize; k += gridOffsetz)
            {
                index = gridIndex(i, j, k);

                spinValue = data[index] - 1;

                // Пропустить, если немагнитная частица

    int index, radiusX, radiusY, radiusZ;
    uchar spinValue;
    uint xx, yy, zz;
    double gridSpinEnergy, dist, expValue, probability;

    radiusX = radiusY = radiusZ = interactionRadius;
    switch (dimension)
