Manage compiler flags and some include options per file or target, not globally
[alexxy/gromacs.git] / src / gromacs / listed_forces / position_restraints.cpp
index 460b055d9eeb04ab85e847e72bd949212d18a748..b3309e623625b0a54a17aee44ee282efd0acbb72 100644 (file)
@@ -100,7 +100,7 @@ void posres_dx(const rvec x, const rvec pos0A, const rvec pos0B,
                     posA *= pbc->box[m][m];
                     posB *= pbc->box[m][m];
                     assert(npbcdim <= DIM);
-                    for (d = m+1; d < npbcdim; d++)
+                    for (d = m+1; d < npbcdim && d < DIM; d++)
                     {
                         posA += pos0A[d]*pbc->box[d][m];
                         posB += pos0B[d]*pbc->box[d][m];