Skip to content

Conversation

@emoskovkina
Copy link

@emoskovkina emoskovkina commented Dec 25, 2025

When I open SBML file example_crash.xml (generated by example_crash.py) with COPASI and try to run time course, COPASI crashes (and it also crashes on similar files). To fix this, I propose this pull request.

In fact, example_crash.xml contains two functions (myfun: x -> x + x (important part here is that x appears more than once) and relu: x -> piecewise(x, x>0, 0) (important that this function creates discontinuity)) and an assignment rule output = myfun(relu(time-0.5)). In the original code, in createDiscontinuityEvents function calls are unrolled because CopyBranch with replaceDiscontinuousNodes=false does so, so we get something like output = piecewise((time-0.5), (time-0.5)>0, 0) + piecewise((time-0.5), (time-0.5)>0, 0) and create two discontinuities. But when we fill discontinuities in compileObjects it stores arguments of functions, including the case when they are also functions, and in this case it proceeds relu only once, and fills mpCalculate of corresponding discontinuity only once. Because of this, at the end we have the second discontinuity with mpCalculate equal to NULL, and when, during time course, we try to call it (in calculateValue), program crashes.

I'm not sure that my code is good and COPASI'sh, I'm very open to any suggestions.

Also, my version works with my SBMLs, but I don't understand how to run COPASI tests, maybe you can help with this?

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