Skip to content

fix MassActionJump double scaling for non-unit substrate species in callbacks/remake#559

Merged
isaacsas merged 2 commits intoSciML:masterfrom
isaacsas:massaction_jump_fix
Feb 27, 2026
Merged

fix MassActionJump double scaling for non-unit substrate species in callbacks/remake#559
isaacsas merged 2 commits intoSciML:masterfrom
isaacsas:massaction_jump_fix

Conversation

@isaacsas
Copy link
Copy Markdown
Member

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.

isaacsas and others added 2 commits February 26, 2026 17:05
…-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]>
@isaacsas isaacsas merged commit 2d7216d into SciML:master Feb 27, 2026
11 checks passed
@isaacsas isaacsas deleted the massaction_jump_fix branch February 27, 2026 02:11
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.

1 participant