Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Species State Rounding Fix #711

Merged
merged 5 commits into from
Feb 10, 2022
Merged

Conversation

jtcooper10
Copy link
Collaborator

Fixes the issue where numerical errors are introduced with continuous values when being evaluated for stochastic reactions. It's fixed by making the simulation's current_state array be exclusively double, instead of using a double array for deterministic reactions and a separate int array for stochastic ones.

Changes

  • All instances of current_populations vector in C++ solver are removed
    • Any areas that were previously dependent on current_populations (int vector) now use current_state instead (double vector)
  • map_ode_propensity and map_ssa_propensity are added to the template file, which allows the hybrid solver to explicitly specify which propensity to use
    • In contrast, previously the decision of "which propensity to use" was based on a function overload of map_propensity, where the decision was made based on the type (double or int) of the state vector
  • Integrator RHS always uses the integrator state in propensity functions, regardless of reaction type
  • Added propensity methods to HybridReaction class, to reduce code duplication
  • Added Tau select overload that accepts double as state vector
  • Added unit test to check for rounding errors in continuous species

Fixes

  • Stochastic reactions no longer truncate continuous species values, which was preventing certain reactions from firing

- Does not change `TauLeapingCSolver`; uses different template instantiation
- Resolved by each reaction based on which "mode" that reaction is in
- Removed all instances/references to `populations` vector
@jtcooper10 jtcooper10 requested a review from seanebum February 4, 2022 23:50
@briandrawert briandrawert added this to the 1.6.8 milestone Feb 7, 2022
@briandrawert briandrawert merged commit 16eb655 into develop Feb 10, 2022
@briandrawert briandrawert deleted the fix/continuous-propensity-rounding branch February 10, 2022 21:29
@seanebum seanebum mentioned this pull request Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants