Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
Reaction.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright © 2014-2024 Allan Leal
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // Reaktoro includes
21 #include <Reaktoro/Common/Types.hpp>
22 #include <Reaktoro/Core/ReactionEquation.hpp>
23 #include <Reaktoro/Core/ReactionThermoProps.hpp>
24 #include <Reaktoro/Core/ReactionRateModel.hpp>
25 
26 namespace Reaktoro {
27 
28 // Forward declarations
29 class ChemicalProps;
30 
31 // TODO: Introduce method Reactions::withSpeciesIndices to avoid recomputation
32 // of indices of the species in the reaction when computing properties such as
33 // equilibrium index, delta chemical potentials, etc.
34 
41 class Reaction
42 {
43 public:
46 
48  auto clone() const -> Reaction;
49 
51  auto withName(String name) const -> Reaction;
52 
55 
57  auto withRateModel(ReactionRateModel const& model) const -> Reaction;
58 
60  auto name() const -> String;
61 
63  auto equation() const -> ReactionEquation const&;
64 
66  auto rateModel() const -> ReactionRateModel const&;
67 
71  auto props(real T, real P) const -> ReactionThermoProps;
72 
78  auto props(real T, Chars unitT, real P, Chars unitP) const -> ReactionThermoProps;
79 
81  auto rate(ChemicalProps const& props) const -> real;
82 
83 private:
84  struct Impl;
85 
86  SharedPtr<Impl> pimpl;
87 };
88 
90 auto operator<(Reaction const& lhs, Reaction const& rhs) -> bool;
91 
93 auto operator==(Reaction const& lhs, Reaction const& rhs) -> bool;
94 
95 } // namespace Reaktoro
The class that computes chemical properties of a chemical system.
Definition: ChemicalProps.hpp:34
A type used to represent the equation of a reaction.
Definition: ReactionEquation.hpp:37
A class to represent a reaction and its attributes.
Definition: Reaction.hpp:42
Reaction()
Construct a default Reaction instance.
auto withEquation(ReactionEquation const &equation) const -> Reaction
Return a duplicate of this Reaction object with new reaction equation.
auto withName(String name) const -> Reaction
Return a duplicate of this Reaction object with new reaction name.
auto equation() const -> ReactionEquation const &
Return the equation of the reaction.
auto withRateModel(ReactionRateModel const &model) const -> Reaction
Return a duplicate of this Reaction object with new reaction rate model.
auto clone() const -> Reaction
Return a deep copy of this Reaction object.
auto props(real T, real P) const -> ReactionThermoProps
Calculate the complete set of thermodynamic properties of the reaction.
auto rate(ChemicalProps const &props) const -> real
Calculate the rate of the reaction for given chemical properties of the system (in mol/s).
auto name() const -> String
Return the name of the reaction.
auto rateModel() const -> ReactionRateModel const &
Return the rate model of the reaction.
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
std::string String
Convenient alias for std::string.
Definition: Types.hpp:52
autodiff::real real
The number type used throughout the library.
Definition: Real.hpp:26
const char * Chars
Convenient alias for const char*.
Definition: Types.hpp:49
std::shared_ptr< T > SharedPtr
Convenient alias for std::shared_ptr<T>.
Definition: Types.hpp:106
The complete set of standard thermodynamic properties of a chemical reaction.
Definition: ReactionThermoProps.hpp:30