Skip to content

Commit 75b0a37

Browse files
committed
Add check for negative counts
1 parent c87c580 commit 75b0a37

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

arrow/obsidian.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,14 @@ evolve_result evolve(Info *info, double duration, int64_t *state, double *rates)
238238
index = substrates_indexes[choice] + involve;
239239
adjustment = stoichiometry[choice * substrates_count + substrates[index]];
240240
outcome[substrates[index]] += adjustment;
241+
242+
if (outcome[substrates[index]] < 0) {
243+
status = 2; // negative counts
244+
}
245+
}
246+
247+
if (status > 0) {
248+
break;
241249
}
242250

243251
// Find which propensities depend on this reaction and therefore need to be

0 commit comments

Comments
 (0)