You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Validate drug-block channel labelling upfront instead of deep in the concentration loop - #42
Requesting a block on a channel not labelled in the model (e.g. --pic50-nal on a model without membrane_persistent_sodium_current_conductance) only threw once the simulation reached a non-zero concentration, since the check lived in ApplyDrugBlock and only fired when conductance_factor < 1. At conc=0, conductance_factor is exactly 1, so the run appeared to succeed for the control concentration and only failed later — making it look like the error was tied to a specific concentration's log file, when in fact chaste_errors_<rank>.txt is named by process rank, not concentration.
Fix
Moved the labelling validation into ReadInIC50HillAndSaturation, firing as soon as a block is requested via --ic50-X/--pic50-X for a channel the model doesn't expose (respecting the existing ParameterWrapper Ito fallback rename).
The exception now throws at setup time, before the concentration loop starts, with the same message as before.
now fails immediately with ... does not have the current "membrane_persistent_sodium_current_conductance" labelled, but you have requested a block on this channel. instead of running through conc=0 first.
Tests
Added a regression test in test/TestApPredict.hpp reproducing the issue's CLI arguments and asserting the exception is raised.
CopilotAI
changed the title
[WIP] Fix conductance label issue in channel simulation
Validate drug-block channel labelling upfront instead of deep in the concentration loop
Sep 11, 2026
@copilot that might solve one problem, but do you know why the error was being written to the previous concentration error log file instead of the one of interest?
@copilot that might solve one problem, but do you know why the error was being written to the previous concentration error log file instead of the one of interest?
Yes — it's not tied to concentration at all. chaste_errors_<N>.txt is named purely by MPI rank (PetscTools::GetMyRank()), not by concentration: see ExecutableSupport::PrintError in Chaste core (global/src/ExecutableSupport.cpp), which does OpenOutputFile("chaste_errors_", PetscTools::GetMyRank(), ".txt", std::ios::out | std::ios::app). Since ApPredict runs the whole concentration loop inside a single try/catch in main() (apps/src/ApPredict.cpp), and SetOutputDirectory/rank are fixed for the whole process, there is only ever one chaste_errors_0.txt for a serial run — every exception raised anywhere during that run (whichever concentration triggers it) gets appended to that same file. So "conc 0.001" was never going to get its own error file; the "0" in the filename is the process rank, not the concentration index. That's a naming/design characteristic of Chaste's top-level error reporting rather than a bug we can fix within ApPredict's concentration loop.
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
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.
Requesting a block on a channel not labelled in the model (e.g.
--pic50-nalon a model withoutmembrane_persistent_sodium_current_conductance) only threw once the simulation reached a non-zero concentration, since the check lived inApplyDrugBlockand only fired whenconductance_factor < 1. Atconc=0,conductance_factoris exactly1, so the run appeared to succeed for the control concentration and only failed later — making it look like the error was tied to a specific concentration's log file, when in factchaste_errors_<rank>.txtis named by process rank, not concentration.Fix
ReadInIC50HillAndSaturation, firing as soon as a block is requested via--ic50-X/--pic50-Xfor a channel the model doesn't expose (respecting the existingParameterWrapperIto fallback rename).Example
now fails immediately with
... does not have the current "membrane_persistent_sodium_current_conductance" labelled, but you have requested a block on this channel.instead of running through conc=0 first.Tests
test/TestApPredict.hppreproducing the issue's CLI arguments and asserting the exception is raised.