From 3a459cb0e22ddd9450a75ab5daf546752d8552c6 Mon Sep 17 00:00:00 2001 From: Ingmar Schoegl Date: Fri, 16 Apr 2021 15:51:44 -0500 Subject: [PATCH] [Kinetics] Catch undetected third bodies in calculateRateCoeffUnits --- src/kinetics/Reaction.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/kinetics/Reaction.cpp b/src/kinetics/Reaction.cpp index c95c4a1d20..5eccf66e6a 100644 --- a/src/kinetics/Reaction.cpp +++ b/src/kinetics/Reaction.cpp @@ -296,8 +296,17 @@ std::string ThreeBodyReaction::productString() const { void ThreeBodyReaction::calculateRateCoeffUnits(const Kinetics& kin) { ElementaryReaction::calculateRateCoeffUnits(kin); - const ThermoPhase& rxn_phase = kin.thermo(kin.reactionPhaseIndex()); - rate_units *= rxn_phase.standardConcentrationUnits().pow(-1); + bool specified = false; + for (const auto& reac : reactants) { + if (reac.first != "M" && products.count(reac.first)) { + // detected specified third-body collision partner + specified = true; + } + } + if (!specified) { + const ThermoPhase& rxn_phase = kin.thermo(kin.reactionPhaseIndex()); + rate_units *= rxn_phase.standardConcentrationUnits().pow(-1); + } } void ThreeBodyReaction::getParameters(AnyMap& reactionNode) const