diff --git a/Configuration.cpp b/Configuration.cpp index b4fbcc9061a7c1a921be9278a0678f5519f4d42f..5a818d26cd4ada1c4a4cb6e330c46a6775fe13bb 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -1059,7 +1059,7 @@ void Configuration::readBonds() { } // If we don't have enough room in our bond array, we need to expand it. - if (numBonds >= capacity) { + if (numBonds+1 >= capacity) { // "numBonds+1" because we are adding two bonds to array // Temporary pointer to the old array Bond* temp = bonds; @@ -1087,6 +1087,11 @@ void Configuration::readBonds() { continue; }*/ + if (ind1 < 0 || ind1 >= num || ind2 < 0 || ind2 >=num) { + printf("ERROR: Bond file line '%s' includes invalid index\n", line); + exit(1); + } + Bond* b = new Bond(op, ind1, ind2, file_name); bonds[numBonds++] = *b; b = new Bond(op, ind2, ind1, file_name); diff --git a/notes.org b/notes.org index c748a8de6b25b53a27957057508260da87e19409..a98f8d4263ef5c9b5b173f21da9ba5c8261a16f6 100644 --- a/notes.org +++ b/notes.org @@ -12,6 +12,7 @@ * TODO eventually +** enable flag to disable physics-checking assertions in kernels (also write these assertions) ** split computation into multiple regions *** simulate regions, also in overlap **** atoms at edge of overlap can have DoF frozen