Skip to content

Commit

Permalink
Protect against inf in SurfPhase::getChemPotentials
Browse files Browse the repository at this point in the history
Fixes #1314
  • Loading branch information
speth committed Mar 4, 2023
1 parent c3eb05c commit 03b7e6b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion src/thermo/SurfPhase.cpp
Expand Up @@ -108,7 +108,7 @@ void SurfPhase::getChemPotentials(doublereal* mu) const
copy(m_mu0.begin(), m_mu0.end(), mu);
getActivityConcentrations(m_work.data());
for (size_t k = 0; k < m_kk; k++) {
mu[k] += RT() * (log(m_work[k]) - logStandardConc(k));
mu[k] += RT() * (log(std::max(m_work[k], SmallNumber)) - logStandardConc(k));
}
}

Expand Down
2 changes: 0 additions & 2 deletions test/data/consistency-cases.yaml
Expand Up @@ -267,8 +267,6 @@ ideal-surface:
"Implementation of s_k is incorrect. See GitHub Issue #1313"
s_eq_sum_sk_Xk:
"Implementation of s_k is incorrect. See GitHub Issue #1313"
g_eq_sum_gk_Xk:
"chemPotentials does not protect against inf. See GitHub Issue #1314"
states:
- {T: 800, P: 1 atm, coverages: {Pt(s): 0.5, H(s): 0.4, O(s): 0.1}}
- {T: 800, P: 5 atm, coverages: {H(s): 1.0}}
Expand Down

0 comments on commit 03b7e6b

Please sign in to comment.