From cbb8f2c206929f948d69737ffa08bb2fb45c2cac Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <github@naumov.de>
Date: Fri, 9 Jul 2021 12:02:50 +0200
Subject: [PATCH] [MatL] Use std::max replacing if condition.

---
 MaterialLib/Adsorption/Adsorption.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/MaterialLib/Adsorption/Adsorption.cpp b/MaterialLib/Adsorption/Adsorption.cpp
index eae88f688d8..a306bda8cc3 100644
--- a/MaterialLib/Adsorption/Adsorption.cpp
+++ b/MaterialLib/Adsorption/Adsorption.cpp
@@ -111,11 +111,8 @@ double AdsorptionReaction::getReactionRate(const double p_Ads,
                                            const double loading) const
 {
     const double A = getPotential(p_Ads, T_Ads, M_Ads);
-    double C_eq = getAdsorbateDensity(T_Ads) * characteristicCurve(A);
-    if (C_eq < 0.0)
-    {
-        C_eq = 0.0;
-    }
+    const double C_eq =
+        std::max(0., getAdsorbateDensity(T_Ads) * characteristicCurve(A));
 
     return k_rate * (C_eq - loading);  // scaled with mass fraction
                                        // this the rate in terms of loading!
-- 
GitLab