Skip to content

Commit

Permalink
Merge pull request #1033 from sys-bio/develop
Browse files Browse the repository at this point in the history
Release 2.2.2 update.
  • Loading branch information
luciansmith authored Jun 30, 2022
2 parents 949c676 + cfbf62a commit 59c6f39
Show file tree
Hide file tree
Showing 3 changed files with 5,407 additions and 3 deletions.
11 changes: 8 additions & 3 deletions source/rrRoadRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4341,15 +4341,20 @@ namespace rr {

if (ufcc.RSize() > 0) {
for (int i = 0; i < ufcc.RSize(); i++) {
double irate = 0;
impl->model->getReactionRates(1, &i, &irate);
if (irate == 0) {
rrLog(rr::Logger::LOG_WARNING) << "Unable to properly scale values for reaction '";
rrLog(rr::Logger::LOG_WARNING) << impl->model->getReactionId(i);
rrLog(rr::Logger::LOG_WARNING) << "': its value is zero, so we cannot divide by it. Setting the scaled coefficients to zero instead.";
}
for (int j = 0; j < ufcc.CSize(); j++) {
double irate = 0;
impl->model->getReactionRates(1, &i, &irate);
if (irate != 0) {
double jrate = 0;
impl->model->getReactionRates(1, &j, &jrate);
ufcc[i][j] = ufcc[i][j] * jrate / irate;
} else {
throw (Exception("Dividing with zero"));
ufcc[i][j] = 0;
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions test/model_analysis/model_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ class ModelAnalysisTests : public RoadRunnerTest {
};


TEST_F(ModelAnalysisTests, issue1031) {
//Config::setValue(Config::LLVM_BACKEND, Config::LLVM_BACKEND_VALUES::LLJIT);
rr::RoadRunner rr((modelAnalysisModelsDir / "zero_rate_at_steady_state.xml").string());

rr.steadyState();
ls::DoubleMatrix sfcc = rr.getScaledFluxControlCoefficientMatrix();

int AKnum = 14;
ASSERT_STREQ("AK", rr.getReactionIds()[AKnum].c_str());

for (unsigned int rxn = 0; rxn < sfcc.CSize(); rxn++)
{
EXPECT_EQ(sfcc.Element(AKnum, rxn), 0.0);
}

}


TEST_F(ModelAnalysisTests, issue1020_full) {
//Config::setValue(Config::LLVM_BACKEND, Config::LLVM_BACKEND_VALUES::LLJIT);
rr::RoadRunner rr((modelAnalysisModelsDir / "Jarrah2014.xml").string());
Expand Down
Loading

0 comments on commit 59c6f39

Please sign in to comment.