Skip to content

Commit

Permalink
Additional check for Troe coefficients being zero
Browse files Browse the repository at this point in the history
This will prevent floating point exceptions (sometimes enabled by third-party
codes) in case c[1] or c[2] are zero but will not change the current behaviour
if c[1] and c[2] are not zero.
  • Loading branch information
g3bk47 authored and speth committed Mar 18, 2019
1 parent 4026c17 commit 471041a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/kinetics/Falloff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,18 @@ void Troe::init(const vector_fp& c)
c.size());
}
m_a = c[0];
m_rt3 = 1.0/c[1];
m_rt1 = 1.0/c[2];
if (std::abs(c[1]) < SmallNumber) {
m_rt3 = std::numeric_limits<double>::infinity();
} else {
m_rt3 = 1.0 / c[1];
}

if (std::abs(c[2]) < SmallNumber) {
m_rt1 = std::numeric_limits<double>::infinity();
} else {
m_rt1 = 1.0 / c[2];
}

if (c.size() == 4) {
m_t2 = c[3];
}
Expand Down

0 comments on commit 471041a

Please sign in to comment.