diff --git a/ChemistryLib/PhreeqcIOData/CreateKineticReactant.cpp b/ChemistryLib/PhreeqcIOData/CreateKineticReactant.cpp index 2a95c1f2a8e09ed913071bdd2ff594e99025b8b7..c740c6c3e8d68b1db1257ff3efd3c6a4b5778329 100644 --- a/ChemistryLib/PhreeqcIOData/CreateKineticReactant.cpp +++ b/ChemistryLib/PhreeqcIOData/CreateKineticReactant.cpp @@ -29,6 +29,11 @@ std::vector<KineticReactant> createKineticReactants( //! \ogs_file_param{prj__chemical_system__kinetic_reactants__kinetic_reactant__name} auto name = reactant_config.getConfigParameter<std::string>("name"); + auto chemical_formula = + //! \ogs_file_param{prj__chemical_system__kinetic_reactants__kinetic_reactant__chemical_formula} + reactant_config.getConfigParameter<std::string>("chemical_formula", + ""); + double const initial_amount = //! \ogs_file_param{prj__chemical_system__kinetic_reactants__kinetic_reactant__initial_amount} reactant_config.getConfigParameter<double>("initial_amount"); @@ -38,8 +43,10 @@ std::vector<KineticReactant> createKineticReactants( reactant_config.getConfigParameterOptional<std::vector<double>>( "parameters"); - kinetic_reactants.emplace_back( - std::move(name), initial_amount, std::move(parameters)); + kinetic_reactants.emplace_back(std::move(name), + std::move(chemical_formula), + initial_amount, + std::move(parameters)); } return kinetic_reactants; diff --git a/ChemistryLib/PhreeqcIOData/KineticReactant.cpp b/ChemistryLib/PhreeqcIOData/KineticReactant.cpp index 7d014bb98cdc99bd921eecd7ec16bf680d0c0c7c..58ca69348eb478d71d4d4e80ea188396d6085b74 100644 --- a/ChemistryLib/PhreeqcIOData/KineticReactant.cpp +++ b/ChemistryLib/PhreeqcIOData/KineticReactant.cpp @@ -20,6 +20,11 @@ std::ofstream& operator<<(std::ofstream& out, { out << kinetic_reactant.name << "\n"; + if (!kinetic_reactant.chemical_formula.empty()) + { + out << "-formula " << kinetic_reactant.chemical_formula << "\n"; + } + out << "-m " << kinetic_reactant.amount << "\n"; if (!kinetic_reactant.parameters.empty()) diff --git a/ChemistryLib/PhreeqcIOData/KineticReactant.h b/ChemistryLib/PhreeqcIOData/KineticReactant.h index 5fd9418d8e7120cc958f4ef647cebe42eb8a52af..4cfd0325cd391b1eb184203f82e8ee7ee5cbc566 100644 --- a/ChemistryLib/PhreeqcIOData/KineticReactant.h +++ b/ChemistryLib/PhreeqcIOData/KineticReactant.h @@ -21,10 +21,12 @@ namespace ChemistryLib struct KineticReactant { KineticReactant(std::string name_, + std::string&& chemical_formula_, double amount_, boost::optional<std::vector<double>> parameters_) : name(std::move(name_)), + chemical_formula(std::move(chemical_formula_)), amount(amount_), parameters(parameters_ ? std::move(*parameters_) : std::vector<double>{}) @@ -36,6 +38,7 @@ struct KineticReactant std::vector<KineticReactant> const& kinetic_reactants); std::string const name; + std::string const chemical_formula; double amount; std::vector<double> const parameters; static const ItemType item_type = ItemType::KineticReactant;