From 17b31799db76ef04200d7bc003ea3463ac66b765 Mon Sep 17 00:00:00 2001 From: "r.jaepel" Date: Tue, 9 Jul 2024 21:53:07 +0200 Subject: [PATCH] WIP add flag to binding models to switch between pH and proton concentration Add the ###_USE_PROTON_CONCENTRATION flag, which if True sets component 1 to proton concentration and if False sets component 1 to pH (= -log10(proton concentration)). For the colloidal binding, which can be used with or without pH effects entirely: Rename the COL_USE_PH flag to COL_INCLUDE_PH, which if True treats component 1 as either pH or proton concentration and if False treats component 1 as a regular component. --- src/libcadet/model/binding/ColloidalBinding.cpp | 9 ++++++--- .../model/binding/GeneralizedIonExchangeBinding.cpp | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/libcadet/model/binding/ColloidalBinding.cpp b/src/libcadet/model/binding/ColloidalBinding.cpp index 03c519675..58fe2229d 100644 --- a/src/libcadet/model/binding/ColloidalBinding.cpp +++ b/src/libcadet/model/binding/ColloidalBinding.cpp @@ -51,7 +51,8 @@ "constantParameters": [ { "type": "ScalarParameter", "varName": "linThreshold", "confName": "COL_LINEAR_THRESHOLD"}, - { "type": "ScalarBoolParameter", "varName": "usePh", "confName": "COL_USE_PH"} + { "type": "ScalarBoolParameter", "varName": "includePh", "confName": "COL_INCLUDE_PH"}, + { "type": "ScalarBoolParameter", "varName": "useProtonConcentration", "confName": "COL_USE_PROTON_CONCENTRATION"} ] } */ @@ -63,6 +64,8 @@ qMax = Capacity */ +// TODO: Actually use useProtonConcentration parameter + namespace cadet { @@ -180,10 +183,10 @@ class ColloidalBindingBase : public ParamHandlerBindingModelBase if (_nBoundStates[0] != 0) throw InvalidParameterException("Salt component (index 0) must be non-binding (NBOUND = 0)"); - if (_paramHandler.usePh().get() && (_nComp <= 2)) + if (_paramHandler.includePh().get() && (_nComp <= 2)) throw InvalidParameterException("No protein component present (existing two components are salt and PH)"); - if (_paramHandler.usePh().get()) + if (_paramHandler.includePh().get()) { _startIdx = 2; if (_nBoundStates[1] != 0) diff --git a/src/libcadet/model/binding/GeneralizedIonExchangeBinding.cpp b/src/libcadet/model/binding/GeneralizedIonExchangeBinding.cpp index e189a8faf..9c8102bcc 100644 --- a/src/libcadet/model/binding/GeneralizedIonExchangeBinding.cpp +++ b/src/libcadet/model/binding/GeneralizedIonExchangeBinding.cpp @@ -50,7 +50,8 @@ "constantParameters": [ { "type": "ReferenceConcentrationParameter", "varName": ["refC0", "refQ"], "objName": "refConcentration", "confPrefix": "GIEX_"}, - { "type": "ReferenceConcentrationParameter", "varName": ["refPhC0", "refPhQ"], "objName": "refConcentrationPh", "confPrefix": "GIEX_PH", "skipConfig": true} + { "type": "ReferenceConcentrationParameter", "varName": ["refPhC0", "refPhQ"], "objName": "refConcentrationPh", "confPrefix": "GIEX_PH", "skipConfig": true}, + { "type": "ScalarBoolParameter", "varName": "useProtonConcentration", "confName": "GIEX_USE_PROTON_CONCENTRATION"} ] } */ @@ -66,6 +67,8 @@ refPhC0,refPhQ = Reference concentrations for pH dependent powers */ +// TODO: Actually use useProtonConcentration parameter + namespace cadet {