bioscrape icon indicating copy to clipboard operation
bioscrape copied to clipboard

Species counts are stored as doubles, not ints, allowing some nasty bugs.

Open sclamons opened this issue 4 years ago • 0 comments

In multiple SSA algorithms, we have species counts stored as doubles. This allows an unwary user (such as myself) to start a simulation with non-integer species counts. If you do that, it's not too difficult to get a negative species count --> negative reaction propensity --> negative time of next reaction --> infinite loop that can't be interrupted in an ipython kernel.

I assume this is done to avoid conversions between ints and doubles, for speed reasons? We might want to put a check in place at the beginning of these simulate functions to make sure all species counts are reasonably close to an integer (maybe just round them all to ints and cast them back to doubles?).

sclamons avatar Aug 13 '21 21:08 sclamons