diff --git a/src/CellList.h b/src/CellList.h index 88c9748b3..09da998e9 100644 --- a/src/CellList.h +++ b/src/CellList.h @@ -85,6 +85,12 @@ inline int CellList::PositionToCell(const XYZ& posRef, int box) const int x = (int)(pos.x / cellSize[box].x); int y = (int)(pos.y / cellSize[box].y); int z = (int)(pos.z / cellSize[box].z); + //Check the cell number to avoid segfult for coordinates close to axis + //x, y, and z should never be equal or greater than number of cells in x, y, + // and z axis, respectively. + x -= (x == edgeCells[box][0] ? 1 : 0); + y -= (y == edgeCells[box][1] ? 1 : 0); + z -= (z == edgeCells[box][2] ? 1 : 0); return x * edgeCells[box][1] * edgeCells[box][2] + y * edgeCells[box][2] + z; } diff --git a/src/ConfigSetup.cpp b/src/ConfigSetup.cpp index 99200b9b9..89f11a1cb 100644 --- a/src/ConfigSetup.cpp +++ b/src/ConfigSetup.cpp @@ -348,7 +348,7 @@ void ConfigSetup::Init(const char *fileName) exit(EXIT_FAILURE); } if(line.size() >= 3) { - printf("%-41s", "Info: Atom Names in BackBone of Small Molecule Kind"); + printf("%-41s", "Info: Atom Names in BackBone of Small Molecule Kind "); for(uint i = 1; i < line.size() - 1; i += 2) { if(i != 1) { printf(" , "); @@ -371,7 +371,7 @@ void ConfigSetup::Init(const char *fileName) exit(EXIT_FAILURE); } if(line.size() >= 3) { - printf("%-41s", "Info: Atom Names in BackBone of Large Molecule Kind"); + printf("%-41s", "Info: Atom Names in BackBone of Large Molecule Kind "); for(uint i = 1; i < line.size() - 1; i += 2) { if(i != 1) { printf(" , ");