fix MassActionJump double scaling for non-unit substrate species in callbacks/remake#559
Merged
isaacsas merged 2 commits intoSciML:masterfrom Feb 27, 2026
Merged
Conversation
…-scaling When MTKBase/Catalyst constructs MassActionJumps, the symbolic rate expressions already include stoichiometric scaling (e.g. k/3! for 3X → Y), so they pass scale_rates=false. However, update_parameters! defaulted to scale_rates=true, causing every subsequent parameter update path (reset_aggregated_jumps!, remake, finalize_parameters_hook!) to double-scale the rates. The fix stores the intended scaling behavior on the struct as rescale_rates_on_update, which update_parameters! now reads as its default. This field is propagated through all merge/combine paths and validated for consistency when merging multiple MassActionJumps. Also fixes SpatialMassActionJump conversion constructor to default scale_rates=false since it receives already-scaled rates. Co-Authored-By: Claude Opus 4.5 <[email protected]>
The mapper now conditionally applies scalerates! based on scale_rates, matching MTKBase JumpSysMajParamMapper behavior. Previously it ignored scale_rates entirely, so the test would pass even with the old buggy default of scale_rates=true. Co-Authored-By: Claude Opus 4.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When MTKBase/Catalyst constructs MassActionJumps for a reaction with a repeated substrate, like
2A + B--> 0, the symbolic rate expressions already include stoichiometric scaling (e.g. k/3! for 3X → Y), so they pass scale_rates=false. However, update_parameters! defaulted to scale_rates=true which MTKBase respects, causing every subsequent parameter update path (reset_aggregated_jumps!, remake, finalize_parameters_hook!) to double-scale the rates.The fix stores the intended scaling behavior on the struct as rescale_rates_on_update, which update_parameters! now reads as its default. This field is propagated through all merge/combine paths and validated for consistency when merging multiple MassActionJumps.
Also fixes SpatialMassActionJump conversion constructor to default scale_rates=false since it receives already-scaled rates.