Project

General

Profile

0002-Fixed-incorrect-boundary-conditions-in-gmx-spatial.patch

Fixes (1), (2) - Shun Sakuraba, 11/25/2019 04:01 PM

View differences:

src/gromacs/gmxana/gmx_spatial.cpp
253 253

  
254 254
        for (i = 0; i < nidx; i++)
255 255
        {
256
            if (fr.x[index[i]][XX] < MINBIN[XX] || fr.x[index[i]][XX] > MAXBIN[XX] ||
257
                fr.x[index[i]][YY] < MINBIN[YY] || fr.x[index[i]][YY] > MAXBIN[YY] ||
258
                fr.x[index[i]][ZZ] < MINBIN[ZZ] || fr.x[index[i]][ZZ] > MAXBIN[ZZ])
256
            x = static_cast<int>(std::floor((fr.x[index[i]][XX]-MINBIN[XX])/rBINWIDTH));
257
            y = static_cast<int>(std::floor((fr.x[index[i]][YY]-MINBIN[YY])/rBINWIDTH));
258
            z = static_cast<int>(std::floor((fr.x[index[i]][ZZ]-MINBIN[ZZ])/rBINWIDTH));
259
            if (x < 0 || x >= nbin[XX] ||
260
                y < 0 || y >= nbin[YY] ||
261
                z < 0 || z >= nbin[ZZ])
259 262
            {
260 263
                printf("There was an item outside of the allocated memory. Increase the value given with the -nab option.\n");
261 264
                printf("Memory was allocated for [%f,%f,%f]\tto\t[%f,%f,%f]\n", MINBIN[XX], MINBIN[YY], MINBIN[ZZ], MAXBIN[XX], MAXBIN[YY], MAXBIN[ZZ]);
262 265
                printf("Memory was required for [%f,%f,%f]\n", fr.x[index[i]][XX], fr.x[index[i]][YY], fr.x[index[i]][ZZ]);
263 266
                exit(1);
264 267
            }
265
            x = static_cast<int>(std::floor((fr.x[index[i]][XX]-MINBIN[XX])/rBINWIDTH));
266
            y = static_cast<int>(std::floor((fr.x[index[i]][YY]-MINBIN[YY])/rBINWIDTH));
267
            z = static_cast<int>(std::floor((fr.x[index[i]][ZZ]-MINBIN[ZZ])/rBINWIDTH));
268

  
268 269
            ++bin[x][y][z];
269 270
            if (x < minx)
270 271
            {
271
-