Reaktoro  v2.0.0
A unified framework for modeling chemically reactive systems
Reaktoro Namespace Reference

The namespace containing all components of the Reaktoro library. More...

Classes

struct  ArraySerialization
 The class implementing methods to serialize/deserialize data into/from arrays. More...
 
class  ArrayStream
 The class used to serialize/deserialize data using array. More...
 
struct  Exception
 Provides a convenient way to initialized an exception with helpful error messages. More...
 
struct  MemoizationTraits
 Used to enable function arguments of a type T to be cached in a memoized version of the function. More...
 
struct  MemoizationTraits< Eigen::Array< Scalar, Rows, Cols, Options, MaxRows, MaxCols > >
 Specialize MemoizationTraits for Eigen array types. More...
 
struct  MemoizationTraits< Eigen::Ref< EigenType > >
 Specialize MemoizationTraits for Eigen ref types. More...
 
class  Memoization
 The class used to control memoization in the application. More...
 
class  StringList
 A class for representing a list of strings with special constructors. More...
 
class  yaml
 A class used to serialize/deserialize other types based on yaml format. More...
 
struct  ActivityArgs
 The arguments in an function for calculation of activity properties of a phase. More...
 
struct  MemoizationTraits< ActivityArgs >
 Specialize MemoizationTraits for ActivityArgs. More...
 
struct  ActivityPropsBase
 The base type for the primary activity and corrective thermodynamic properties of a phase. More...
 
class  ChemicalFormula
 A type used to represent the chemical formula of a chemical species. More...
 
class  ChemicalProps
 The class that computes chemical properties of a chemical system. More...
 
struct  ChemicalPropsPhaseBaseData
 The base type for primary chemical property data of a phase from which others are computed. More...
 
class  ChemicalPropsPhaseBase
 The base type for chemical properties of a phase and its species. More...
 
class  ChemicalState
 The chemical state of a chemical system. More...
 
class  ChemicalSystem
 The class used to represent a chemical system and its attributes and properties. More...
 
class  Database
 The class used to store and retrieve data of chemical species. More...
 
class  Element
 A type used to define a element and its attributes. More...
 
class  ElementalComposition
 A type used to describe the elemental composition of chemical species. More...
 
class  ElementList
 A type used as a collection of elements. More...
 
class  FormationReaction
 A class to represent a formation reaction of a chemical species. More...
 
class  Model
 
class  Model< Result(Args...)>
 The class used to represent a model function and its parameters. More...
 
class  Param
 A type used to represent the value of a parameter and its lower and upper bounds. More...
 
struct  MemoizationTraits< Param >
 Specialize MemoizationTraits for Param. More...
 
class  Params
 The class used to store and retrieve thermodynamic parameters. More...
 
class  Phase
 A type used to define a phase and its attributes. More...
 
class  PhaseList
 A type used as a collection of phases. More...
 
struct  Speciate
 The auxiliary type used to specify phase species to be determined from element symbols. More...
 
struct  Exclude
 The auxiliary type used to specify species that should be filtered out when contructing a phase. More...
 
class  GenericPhase
 The base type for all other classes defining more specific phases. More...
 
class  GenericPhasesGenerator
 The base type for a generator of generic phases with a single species. More...
 
class  Phases
 The class used to define the phases that will constitute the chemical system of interest. More...
 
class  AqueousPhase
 The class used to configure an aqueous solution phase. More...
 
class  GaseousPhase
 The class used to configure a gaseous solution phase. More...
 
class  LiquidPhase
 The class used to configure a liquid solution phase. More...
 
class  SolidPhase
 The class used to configure a solid solution phase. More...
 
class  MineralPhase
 The class used to configure a pure mineral phase. More...
 
class  MineralPhases
 The class used to configure automatic selection of pure mineral phases. More...
 
class  CondensedPhase
 The class used to configure a pure condensed phase. More...
 
class  CondensedPhases
 The class used to configure automatic selection of pure condensed phases. More...
 
class  IonExchangePhase
 The class used to configure an ion exchange phase. More...
 
class  Prop
 Used to retrieve a specified property from the chemical properties of a system. More...
 
class  Reaction
 A class to represent a reaction and its attributes. More...
 
class  ReactionEquation
 A type used to represent the equation of a reaction. More...
 
struct  ReactionProps
 The complete set of thermodynamic properties of a chemical reaction. More...
 
struct  ReactionThermoProps
 The primary standard thermodynamic properties of a chemical reaction. More...
 
struct  ReactionThermoArgs
 The arguments in a ReactionThermoModel function object. More...
 
class  Species
 A type used to represent a chemical species and its attributes. More...
 
class  SpeciesList
 A type used as a collection of species. More...
 
struct  SpeciesThermoProps
 The complete set of standard thermodynamic properties of a chemical species. More...
 
struct  StandardThermoProps
 The primary standard thermodynamic properties of a chemical species. More...
 
class  DatabaseParserYAML
 The auxiliary class used to handle the parsing of YAML files to construct a Database object. More...
 
class  ThermoProps
 The standard thermodynamic properties of the species in a chemical system. More...
 
struct  ThermoPropsPhaseBaseData
 The base type for primary standard thermodynamic property data of a phase from which others are computed. More...
 
class  ThermoPropsPhaseBase
 The base type for standard thermodynamic properties of a phase and its species. More...
 
class  EquilibriumConditions
 The class used to define conditions to be satisfied at chemical equilibrium. More...
 
struct  EquilibriumDims
 The dimensions of the variables in a chemical equilibrium problem. More...
 
class  EquilibriumHessian
 The class used to compute the Hessian matrix of the Gibbs energy function. More...
 
class  EquilibriumJacobian
 Used to compute the Jacobian of chemical potentials during the equilibrium calculations. More...
 
struct  SmartEquilibriumOptions
 The options for the smart equilibrium calculations. More...
 
struct  EquilibriumOptions
 The options for the equilibrium calculations. More...
 
class  EquilibriumPredictor
 A class that still needs to be commented. More...
 
class  EquilibriumProblem
 The class used to define chemical equilibrium problems. More...
 
class  EquilibriumProps
 The class that computes chemical properties of a system during equilibrium calculations. More...
 
class  EquilibriumRestrictions
 The class used to define reactivity restrictions in a chemical equilibrium calculation. More...
 
struct  SmartEquilibriumResult
 A type used to describe the result of a smart equilibrium calculation. More...
 
struct  EquilibriumResult
 A type used to describe the result of an equilibrium calculation. More...
 
class  EquilibriumSensitivity
 The sensitivity derivatives of a chemical equilibrium state. More...
 
class  EquilibriumSetup
 Used to construct the optimization problem for a chemical equilibrium calculation. More...
 
class  EquilibriumSolver
 Used for calculating chemical equilibrium states. More...
 
struct  ControlVariableQ
 Used to define a q control variable in a chemical equilibrium problem. More...
 
struct  ControlVariableP
 Used to define a p control variable in a chemical equilibrium problem. More...
 
struct  ConstraintEquation
 Used to define equation constraints in a chemical equilibrium problem. More...
 
class  EquilibriumSpecs
 The class used to define conditions to be satisfied at chemical equilibrium. More...
 
class  Interpreter
 Used to interpret json files containing defined calculations. More...
 
class  NasaDatabase
 Used to support thermodynamic databases in NASA CEA format. More...
 
class  Phreeqc
 
class  PhreeqcDatabase
 The class used to store and retrieve data of chemical species from PHREEQC databases. More...
 
class  PorousRockState
 The chemical state of a porous rock system filled with fluids. More...
 
class  SupcrtDatabase
 The class used to store and retrieve data of chemical species from SUPCRT databases. More...
 
class  ThermoFunDatabase
 The class used to store and retrieve data of chemical species from ThermoFun databases. More...
 
class  ThermoFunEngine
 The class used for standard thermodynamic property calculations based on ThermoFun. More...
 
class  BilinearInterpolator
 A class used to calculate bilinear interpolation of data in two dimensions. More...
 
class  LagrangeInterpolator
 A class used to calculate interpolation of data in one dimension in any order. More...
 
struct  LU
 The class that computes the full pivoting Auxiliary struct for storing the LU decomposition of a matrix A. More...
 
struct  ReactionThermoModelParamsConstLgK
 The parameters in a thermodynamic model for a formation reaction based on constant \(\lg K(T)\). More...
 
struct  ReactionThermoModelParamsGemsLgK
 The parameters in the thermodynamic model for a formation reaction based on GEM-Selektor's expression for \(\lg K(T)\). More...
 
struct  ReactionThermoModelParamsPhreeqcLgK
 The parameters in the thermodynamic model for a formation reaction based on PHREEQC's expression for \(\lg K(T)\). More...
 
struct  ReactionThermoModelParamsVantHoff
 The parameters in a van't Hoff thermodynamic model for a formation reaction. More...
 
struct  StandardThermoModelParamsConstant
 The parameters in the constant model for calculating standard thermodynamic properties of species. More...
 
struct  StandardThermoModelParamsHKF
 The parameters in the HKF model for calculating standard thermodynamic properties of aqueous solutes. More...
 
struct  StandardThermoModelParamsHollandPowell
 The parameters in the Holland-Powell model for calculating standard thermodynamic properties of fluid and mineral species. More...
 
struct  StandardThermoModelParamsInterpolation
 The parameters in the Maier-Kelley model for calculating standard thermodynamic properties of fluid and solid species. More...
 
struct  StandardThermoModelParamsMaierKelley
 The parameters in the Maier-Kelley model for calculating standard thermodynamic properties of fluid and solid species. More...
 
struct  StandardThermoModelParamsMineralHKF
 The parameters in the Maier-Kelley-HKF model for calculating standard thermodynamic properties of mineral species. More...
 
struct  StandardThermoModelParamsNasa
 The parameters in the NASA polynomial model for calculating standard thermodynamic properties of gases and condensed species. More...
 
struct  StandardThermoModelParamsWaterHKF
 The parameters in the HKF model for calculating standard thermodynamic properties of the aqueous solvent (water). More...
 
struct  StandardVolumeModelParamsConstant
 The parameters in the constant model for calculating standard volume of a product species in a formation reaction. More...
 
struct  SpeciesElectroProps
 The electrostatic properties of an aqueous solute species. More...
 
struct  gHKF
 The g function state of in HKF model for computation of electrostatic properties of aqueous solutes. More...
 
struct  SubstanceCriticalPropsData
 A type used to represent the critical properties of a substance. More...
 
class  SubstanceCriticalProps
 A type used to represent a substance and its critical properties. More...
 
class  CriticalProps
 A type used store a collection of substances and their critical properties. More...
 
struct  DissociationReaction
 A type used to represent a dissociation reaction of a neutral substance into ions. More...
 
class  DissociationReactions
 A type used store a collection of dissociation reactions. More...
 
class  Elements
 A type used store a collection of elements. More...
 
struct  ActivityModelDebyeHuckelParams
 The parameters in the Debye–Hückel activity model for aqueous solutions. More...
 
struct  ActivityModelDrummondParams
 The parameters in the Drummond (1981) activity model. More...
 
struct  AqueousMixtureState
 A type used to describe the state of an aqueous mixture. More...
 
class  AqueousMixture
 A type used to describe an aqueous mixture. More...
 
class  AqueousProps
 The chemical properties of an aqueous phase. More...
 
struct  ActivityModelCubicEOSParams
 The parameters for the activity model based on cubic equations of state. More...
 
struct  CubicEOSProps
 The properties calculated by evaluating a cubic equation of state. More...
 
struct  CubicEOSInteractionParams
 The interaction parameters for the cubic equation of state. More...
 
struct  CubicEOSInteractionParamsArgs
 The arguments needed in the function that evaluates interaction parameters for the cubic equation of state. More...
 
class  CubicEOS
 Calculates thermodynamic properties of fluid phases based on a cubic equation of state model. More...
 
class  IonExchangeProps
 The chemical properties of an aqueous phase. More...
 
struct  IonExchangeSurfaceState
 A type used to describe the state of an ion exchange surface. More...
 
class  IonExchangeSurface
 A type used to describe an ion exchange surface. More...
 
struct  WaterElectroProps
 
struct  WaterHelmholtzProps
 
struct  WaterThermoProps
 

Typedefs

using Index = std::size_t
 Define a type that represents an index. More...
 
using Indices = std::vector< Index >
 Define a type that represents a collection of indices. More...
 
using json = nlohmann::json
 
template<typename T >
using VectorX = Eigen::Matrix< T, -1, 1, 0, -1, 1 >
 Convenient alias to Eigen type.
 
template<typename T >
using MatrixX = Eigen::Matrix< T, -1, -1, 0, -1, -1 >
 Convenient alias to Eigen type.
 
template<typename T >
using ArrayX = Eigen::Array< T, -1, 1, 0, -1, 1 >
 Convenient alias to Eigen type.
 
template<typename T >
using ArrayXX = Eigen::Array< T, -1, -1, 0, -1, -1 >
 Convenient alias to Eigen type.
 
template<typename T >
using RowVectorX = Eigen::Matrix< T, 1, -1, 0, 1, -1 >
 
using VectorXr = autodiff::VectorXreal
 Convenient alias to Eigen type.
 
using VectorXrRef = Eigen::Ref< VectorXr >
 Convenient alias to Eigen type.
 
using VectorXrConstRef = Eigen::Ref< const VectorXr >
 Convenient alias to Eigen type.
 
using VectorXrMap = Eigen::Map< VectorXr >
 Convenient alias to Eigen type.
 
using VectorXrConstMap = Eigen::Map< const VectorXr >
 Convenient alias to Eigen type.
 
using VectorXrStridedRef = Eigen::Ref< VectorXr, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using VectorXrStridedConstRef = Eigen::Ref< const VectorXr, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using VectorXl = VectorX< Eigen::Index >
 Convenient alias to Eigen type.
 
using VectorXlRef = Eigen::Ref< VectorXl >
 Convenient alias to Eigen type.
 
using VectorXlConstRef = Eigen::Ref< const VectorXl >
 Convenient alias to Eigen type.
 
using VectorXlMap = Eigen::Map< VectorXl >
 Convenient alias to Eigen type.
 
using VectorXlConstMap = Eigen::Map< const VectorXl >
 Convenient alias to Eigen type.
 
using VectorXlStridedRef = Eigen::Ref< VectorXl, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using VectorXlStridedConstRef = Eigen::Ref< const VectorXl, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using VectorXd = Eigen::VectorXd
 Convenient alias to Eigen type.
 
using VectorXdRef = Eigen::Ref< VectorXd >
 Convenient alias to Eigen type.
 
using VectorXdConstRef = Eigen::Ref< const VectorXd >
 Convenient alias to Eigen type.
 
using VectorXdMap = Eigen::Map< VectorXd >
 Convenient alias to Eigen type.
 
using VectorXdConstMap = Eigen::Map< const VectorXd >
 Convenient alias to Eigen type.
 
using VectorXdStridedRef = Eigen::Ref< VectorXd, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using VectorXdStridedConstRef = Eigen::Ref< const VectorXd, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using ArrayXr = autodiff::ArrayXreal
 Convenient alias to Eigen type.
 
using ArrayXrRef = Eigen::Ref< ArrayXr >
 Convenient alias to Eigen type.
 
using ArrayXrConstRef = Eigen::Ref< const ArrayXr >
 Convenient alias to Eigen type.
 
using ArrayXrMap = Eigen::Map< ArrayXr >
 Convenient alias to Eigen type.
 
using ArrayXrConstMap = Eigen::Map< const ArrayXr >
 Convenient alias to Eigen type.
 
using ArrayXrStridedRef = Eigen::Ref< ArrayXr, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using ArrayXrStridedConstRef = Eigen::Ref< const ArrayXr, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using ArrayXl = ArrayX< Eigen::Index >
 Convenient alias to Eigen type.
 
using ArrayXlRef = Eigen::Ref< ArrayXl >
 Convenient alias to Eigen type.
 
using ArrayXlConstRef = Eigen::Ref< const ArrayXl >
 Convenient alias to Eigen type.
 
using ArrayXlMap = Eigen::Map< ArrayXl >
 Convenient alias to Eigen type.
 
using ArrayXlConstMap = Eigen::Map< const ArrayXl >
 Convenient alias to Eigen type.
 
using ArrayXlStridedRef = Eigen::Ref< ArrayXl, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using ArrayXlStridedConstRef = Eigen::Ref< const ArrayXl, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using ArrayXd = Eigen::ArrayXd
 Convenient alias to Eigen type.
 
using ArrayXdRef = Eigen::Ref< ArrayXd >
 Convenient alias to Eigen type.
 
using ArrayXdConstRef = Eigen::Ref< const ArrayXd >
 Convenient alias to Eigen type.
 
using ArrayXdMap = Eigen::Map< ArrayXd >
 Convenient alias to Eigen type.
 
using ArrayXdConstMap = Eigen::Map< const ArrayXd >
 Convenient alias to Eigen type.
 
using ArrayXdStridedRef = Eigen::Ref< ArrayXd, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using ArrayXdStridedConstRef = Eigen::Ref< const ArrayXd, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using ArrayXXr = autodiff::ArrayXXreal
 Convenient alias to Eigen type.
 
using ArrayXXrRef = Eigen::Ref< ArrayXXr >
 Convenient alias to Eigen type.
 
using ArrayXXrConstRef = Eigen::Ref< const ArrayXXr >
 Convenient alias to Eigen type.
 
using ArrayXXrMap = Eigen::Map< ArrayXXr >
 Convenient alias to Eigen type.
 
using ArrayXXrConstMap = Eigen::Map< const ArrayXXr >
 Convenient alias to Eigen type.
 
using ArrayXXrStridedRef = Eigen::Ref< ArrayXXr, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using ArrayXXrStridedConstRef = Eigen::Ref< const ArrayXXr, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using ArrayXXd = Eigen::ArrayXXd
 Convenient alias to Eigen type.
 
using ArrayXXdRef = Eigen::Ref< ArrayXXd >
 Convenient alias to Eigen type.
 
using ArrayXXdConstRef = Eigen::Ref< const ArrayXXd >
 Convenient alias to Eigen type.
 
using ArrayXXdMap = Eigen::Map< ArrayXXd >
 Convenient alias to Eigen type.
 
using ArrayXXdConstMap = Eigen::Map< const ArrayXXd >
 Convenient alias to Eigen type.
 
using ArrayXXdStridedRef = Eigen::Ref< ArrayXXd, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using ArrayXXdStridedConstRef = Eigen::Ref< const ArrayXXd, 0, Eigen::InnerStride<> >
 Convenient alias to Eigen type.
 
using MatrixXr = autodiff::MatrixXreal
 Convenient alias to Eigen type.
 
using MatrixXrRef = Eigen::Ref< MatrixXr >
 Convenient alias to Eigen type.
 
using MatrixXrConstRef = Eigen::Ref< const MatrixXr >
 Convenient alias to Eigen type.
 
using MatrixXrMap = Eigen::Map< MatrixXr >
 Convenient alias to Eigen type.
 
using MatrixXrConstMap = Eigen::Map< const MatrixXr >
 Convenient alias to Eigen type.
 
using MatrixXd = Eigen::MatrixXd
 Convenient alias to Eigen type.
 
using MatrixXdRef = Eigen::Ref< MatrixXd >
 Convenient alias to Eigen type.
 
using MatrixXdConstRef = Eigen::Ref< const MatrixXd >
 Convenient alias to Eigen type.
 
using MatrixXdMap = Eigen::Map< MatrixXd >
 Convenient alias to Eigen type.
 
using MatrixXdConstMap = Eigen::Map< const MatrixXd >
 Convenient alias to Eigen type.
 
using RowVectorXr = autodiff::RowVectorXreal
 Convenient alias to Eigen type.
 
using RowVectorXrRef = Eigen::Ref< RowVectorXr >
 Convenient alias to Eigen type.
 
using RowVectorXrConstRef = Eigen::Ref< const RowVectorXr >
 Convenient alias to Eigen type.
 
using RowVectorXrMap = Eigen::Map< RowVectorXr >
 Convenient alias to Eigen type.
 
using RowVectorXrConstMap = Eigen::Map< const RowVectorXr >
 Convenient alias to Eigen type.
 
using RowVectorXl = RowVectorX< Eigen::Index >
 Convenient alias to Eigen type.
 
using RowVectorXlRef = Eigen::Ref< RowVectorXl >
 Convenient alias to Eigen type.
 
using RowVectorXlConstRef = Eigen::Ref< const RowVectorXl >
 Convenient alias to Eigen type.
 
using RowVectorXlMap = Eigen::Map< RowVectorXl >
 Convenient alias to Eigen type.
 
using RowVectorXlConstMap = Eigen::Map< const RowVectorXl >
 Convenient alias to Eigen type.
 
using RowVectorXd = Eigen::RowVectorXd
 Convenient alias to Eigen type.
 
using RowVectorXdRef = Eigen::Ref< RowVectorXd >
 Convenient alias to Eigen type.
 
using RowVectorXdConstRef = Eigen::Ref< const RowVectorXd >
 Convenient alias to Eigen type.
 
using RowVectorXdMap = Eigen::Map< RowVectorXd >
 Convenient alias to Eigen type.
 
using RowVectorXdConstMap = Eigen::Map< const RowVectorXd >
 Convenient alias to Eigen type.
 
using PermutationMatrix = Eigen::PermutationMatrix< Eigen::Dynamic, Eigen::Dynamic >
 Define an alias to a permutation matrix type of the Eigen library.
 
using real = autodiff::real
 The number type used throughout the library.
 
template<typename T >
using Table1D = std::vector< T >
 
template<typename T >
using Table2D = std::vector< std::vector< T > >
 
template<typename T >
using Table3D = std::vector< std::vector< std::vector< T > >>
 
using Time = std::chrono::time_point< std::chrono::high_resolution_clock >
 
using Duration = std::chrono::duration< double >
 
template<bool value>
using EnableIf = std::enable_if_t< value >
 
template<typename T >
using Decay = std::decay_t< T >
 
template<typename T >
using Ref = typename detail::Ref< T >::type
 
template<typename T >
using TypeOpRef = typename detail::TypeOpRef< std::decay_t< T > >::type
 
template<typename T >
using TypeOpConstRef = typename detail::TypeOpConstRef< std::decay_t< T > >::type
 
template<typename T >
using TypeOpIdentity = typename detail::TypeOpIdentity< std::decay_t< T > >::type
 
using Chars = const char *
 Convenient alias for const char*.
 
using String = std::string
 Convenient alias for std::string.
 
using Strings = std::vector< std::string >
 Convenient alias for std::vector<String>.
 
using StringOrIndex = std::variant< Index, int, std::string >
 The type used to accept either a name or an index.
 
template<typename T , std::size_t N>
using Array = std::array< T, N >
 Convenient alias for std::array<T, N>.
 
template<typename T >
using Vec = std::vector< T >
 Convenient alias for std::vector<T>.
 
template<typename Key , typename T >
using Map = std::unordered_map< Key, T >
 Convenient alias for std::unordered_map<Key, T>.
 
template<typename T >
using Set = std::unordered_set< T >
 
template<typename T , typename U >
using Pair = std::pair< T, U >
 Convenient alias for std::pair<T, U>.
 
template<typename T , typename U >
using Pairs = Vec< Pair< T, U > >
 Convenient alias for std::vector<std::pair<T, U>>.
 
template<typename... Args>
using Tuple = std::tuple< Args... >
 Convenient alias for std::tuple<Args...>.
 
template<typename T >
using Ptr = std::unique_ptr< T >
 Convenient alias for std::unique_ptr<T>.
 
template<typename T >
using SharedPtr = std::shared_ptr< T >
 Convenient alias for std::shared_ptr<T>.
 
template<typename F >
using Fn = std::function< F >
 Convenient alias for std::function<R(Args...)>.
 
template<typename T >
using Optional = std::optional< T >
 Convenient alias for std::optional.
 
using Any = std::any
 Convenient alias for std::any.
 
using ActivityModel = Model< ActivityProps(ActivityArgs)>
 The function type for the calculation of activity and corrective thermodynamic properties of a phase.
 
using ActivityModelGenerator = Fn< ActivityModel(const SpeciesList &species)>
 The type for functions that construct an ActivityModel for a phase. More...
 
using ActivityProps = ActivityPropsBase< TypeOpIdentity >
 The activity and corrective thermodynamic properties of a phase.
 
using ActivityPropsRef = ActivityPropsBase< TypeOpRef >
 The non-const view to the activity and corrective thermodynamic properties of a phase.
 
using ActivityPropsConstRef = ActivityPropsBase< TypeOpConstRef >
 The const view to the activity and corrective thermodynamic properties of a phase.
 
using ChemicalPropsPhaseData = ChemicalPropsPhaseBaseData< TypeOpIdentity >
 The primary chemical property data of a phase from which others are computed.
 
using ChemicalPropsPhaseDataRef = ChemicalPropsPhaseBaseData< TypeOpRef >
 The primary chemical property data of a phase from which others are computed.
 
using ChemicalPropsPhaseDataConstRef = ChemicalPropsPhaseBaseData< TypeOpConstRef >
 The primary chemical property data of a phase from which others are computed.
 
using ChemicalPropsPhaseFn = Fn< void(ChemicalPropsPhaseDataRef, const real &, const real &, ArrayXrConstRef)>
 The type of functions that computes the primary chemical property data of a phase.
 
using ChemicalPropsPhase = ChemicalPropsPhaseBase< TypeOpIdentity >
 The chemical properties of a phase and its species.
 
using ChemicalPropsPhaseRef = ChemicalPropsPhaseBase< TypeOpRef >
 The non-const view to the chemical properties of a phase and its species.
 
using ChemicalPropsPhaseConstRef = ChemicalPropsPhaseBase< TypeOpConstRef >
 The const view to the chemical properties of a phase and its species.
 
template<typename ResultRef , typename... Args>
using ModelEvaluator = Fn< void(ResultRef res, Args... args)>
 The functional signature of functions that evaluates properties.
 
template<typename Result , typename... Args>
using ModelCalculator = Fn< Result(Args... args)>
 The functional signature of functions that calculates properties.
 
using ModelSerializer = Fn< yaml()>
 The functional signature of functions that serialize a Model object.
 
using PropFn = Fn< real(const ChemicalProps &props)>
 The function type for evaluation of a property of a chemical system. More...
 
using ReactionRateFn = Fn< real(const ChemicalProps &props)>
 The function type for calculation of reaction rates (in mol/s). More...
 
using ReactionThermoModel = Model< ReactionThermoProps(ReactionThermoArgs)>
 The function type for calculation of standard thermodynamic properties of a reaction.
 
using StandardThermoModel = Model< StandardThermoProps(real T, real P)>
 The function type for calculation of standard thermodynamic properties of a species. More...
 
using ThermoPropsPhaseData = ThermoPropsPhaseBaseData< TypeOpIdentity >
 The primary standard thermodynamic property data of a phase from which others are computed.
 
using ThermoPropsPhaseDataRef = ThermoPropsPhaseBaseData< TypeOpRef >
 The primary standard thermodynamic property data of a phase from which others are computed.
 
using ThermoPropsPhaseDataConstRef = ThermoPropsPhaseBaseData< TypeOpConstRef >
 The primary standard thermodynamic property data of a phase from which others are computed.
 
using ThermoPropsPhaseFn = Fn< void(ThermoPropsPhaseDataRef, const real &, const real &, ArrayXrConstRef)>
 The type of functions that computes the primary standard thermodynamic property data of a phase.
 
using ThermoPropsPhase = ThermoPropsPhaseBase< TypeOpIdentity >
 The standard thermodynamic properties of a phase and its species.
 
using ThermoPropsPhaseRef = ThermoPropsPhaseBase< TypeOpRef >
 The non-const view to the standard thermodynamic properties of a phase and its species.
 
using ThermoPropsPhaseConstRef = ThermoPropsPhaseBase< TypeOpConstRef >
 The const view to the standard thermodynamic properties of a phase and its species.
 
using ScalarFunction = std::function< double(VectorXdConstRef)>
 Define a scalar function type.
 
using VectorFunction = std::function< VectorXd(VectorXdConstRef)>
 Define a vector function type.
 
template<typename T >
using CubicRoots = std::array< std::complex< T >, 3 >
 Define a type that describes the roots of a cubic equation.
 
using StandardVolumeModel = Model< real(real T, real P)>
 The function type for calculation of standard volume of a product species in a formation reaction. More...
 
using CubicEOSInteractionParamsFn = std::function< CubicEOSInteractionParams(const CubicEOSInteractionParamsArgs &)>
 The function that evaluates interaction parameters for the cubic equation of state model.
 

Enumerations

enum class  AggregateState {
  Gas , Liquid , Solid , Plasma ,
  CondensedPhase , Fluid , LiquidCrystal , CrystallineSolid ,
  AmorphousSolid , Vitreous , Adsorbed , Monomeric ,
  Polymeric , SolidSolution , IonExchange , Aqueous ,
  Undefined
}
 The aggregate states of substances according to IUPAC. More...
 
enum class  StateOfMatter {
  Unspecified , Solid , Liquid , Gas ,
  Supercritical , Plasma , Fluid , Condensed
}
 The list of states of matter for phases. More...
 
enum class  GibbsHessian { Exact , PartiallyExact , Approx , ApproxDiagonal }
 The options for the description of the Hessian of the Gibbs energy function. More...
 
enum class  CubicEOSModel { VanDerWaals , RedlichKwong , SoaveRedlichKwong , PengRobinson }
 The options for the cubic equation of state models.
 

Functions

template<typename Container , typename T >
auto index (const Container &c, const T &x) -> std::size_t
 Return the index of item x in container c or the number of items if not found.
 
template<typename Container , typename Predicate >
auto indexfn (const Container &c, const Predicate &pred) -> std::size_t
 Return the index of item x in container c for which pred(x) evaluates to true or the number of items if not found.
 
template<typename Container , typename Predicate >
auto filter (const Container &c, const Predicate &pred)
 Return a container with items x for which pred(x) evaluates to true.
 
template<typename Container , typename Predicate >
auto remove (const Container &c, const Predicate &pred)
 Return a container without items x for which pred(x) evaluates to true.
 
template<typename Container >
auto unique (const Container &c)
 Return a container without duplicates.
 
template<typename Container , typename Result , typename Function >
auto transform (const Container &c, Result &res, const Function &f)
 Apply a function f on every item in container c and store in res.
 
template<typename Container , typename Indices >
auto extract (const Container &a, const Indices &indices)
 Return the items in a container at given indices.
 
template<typename Container , typename Function >
auto vectorize (const Container &c, const Function &f)
 Return a vector by applying function f on every item in container c.
 
template<typename Container , typename T >
auto contains (const Container &c, const T &x)
 Return true if container a contains item x.
 
template<typename Container , typename Predicate >
auto containsfn (const Container &c, const Predicate &pred)
 Return true if container a contains item x for which pred(x) evaluates to true.
 
template<typename ContainerA , typename ContainerB >
auto contained (const ContainerA &a, const ContainerB &b)
 Return true if items in container a are also in container b.
 
template<typename Container >
auto concatenate (const Container &a, const Container &b)
 Return a container with items from both a and b.
 
template<typename Container >
auto merge (const Container &a, const Container &b)
 Return a container with items from both a and b without duplicates.
 
template<typename Container >
auto intersect (const Container &a, const Container &b)
 Return the intersection of two containers.
 
template<typename Container >
auto difference (const Container &a, const Container &b)
 Return the difference of two containers.
 
template<typename ContainerA , typename ContainerB >
auto disjoint (const ContainerA &a, const ContainerB &b)
 Return true if containers a and b have distinct items.
 
template<typename ContainerA , typename ContainerB >
auto identical (const ContainerA &a, const ContainerB &b)
 Return true if containers a and b have identical items.
 
template<typename T >
auto range (T first, T last, T step)
 Return a vector with given range of values and step between them.
 
template<typename T >
auto range (T first, T last)
 Return a vector with given range of values with unit step.
 
template<typename T >
auto range (T last)
 Return a vector with given range of values with unit step and starting from 0.
 
template<typename X , typename X0 , typename... XS>
auto oneof (const X x, const X0 &x0, const XS &... xs)
 Return true if x is equal to at least one of the other arguments.
 
template<typename Function >
auto sum (std::size_t ibegin, std::size_t iend, const Function &f)
 Return the sum f(ibegin) + ... + f(iend-1) for a given function f.
 
template<typename Function >
auto sum (std::size_t iend, const Function &f)
 Return the sum f(0) + ... + f(iend-1) for a given function f.
 
template<typename Indices , typename Function , EnableIf<!isArithmetic< Indices >> ...>
auto sum (const Indices &inds, const Function &f)
 Return the sum f(inds[0]) + ... + f(inds[inds.size() - 1]) for a given function f.
 
template<typename Scalar >
auto convertCelsiusToKelvin (Scalar T) -> decltype(T+273.15)
 Converts temperature from celsius to kelvin.
 
template<typename Scalar >
auto convertKelvinToCelsius (Scalar T) -> decltype(T - 273.15)
 Converts temperature from kelvin to celsius.
 
template<typename Scalar >
auto convertPascalToKiloPascal (Scalar P) -> decltype(P *1.0e-3)
 Converts pressure from pascal to kilo pascal.
 
template<typename Scalar >
auto convertPascalToMegaPascal (Scalar P) -> decltype(P *1.0e-6)
 Converts pressure from pascal to mega pascal.
 
template<typename Scalar >
auto convertPascalToBar (Scalar P) -> decltype(P *1.0e-5)
 Converts pressure from pascal to bar.
 
template<typename Scalar >
auto convertKiloPascalToPascal (Scalar P) -> decltype(P *1.0e+3)
 Converts pressure from kilo pascal to pascal.
 
template<typename Scalar >
auto convertKiloPascalToMegaPascal (Scalar P) -> decltype(P *1.0e-3)
 Converts pressure from kilo pascal to mega pascal.
 
template<typename Scalar >
auto convertKiloPascalToBar (Scalar P) -> decltype(P *1.0e-2)
 Converts pressure from kilo pascal to bar.
 
template<typename Scalar >
auto convertMegaPascalToPascal (Scalar P) -> decltype(P *1.0e+6)
 Converts pressure from mega pascal to pascal.
 
template<typename Scalar >
auto convertMegaPascalToKiloPascal (Scalar P) -> decltype(P *1.0e+3)
 Converts pressure from mega pascal to kilo pascal.
 
template<typename Scalar >
auto convertMegaPascalToBar (Scalar P) -> decltype(P *1.0e+1)
 Converts pressure from mega pascal to bar.
 
template<typename Scalar >
auto convertBarToPascal (Scalar P) -> decltype(P *1.0e+5)
 Converts pressure from bar to pascal.
 
template<typename Scalar >
auto convertBarToKiloPascal (Scalar P) -> decltype(P *1.0e+2)
 Converts pressure from bar to kilo pascal.
 
template<typename Scalar >
auto convertBarToMegaPascal (Scalar P) -> decltype(P *1.0e-1)
 Converts pressure from bar to mega pascal.
 
template<typename Scalar >
auto convertBarToAtm (Scalar P) -> decltype(P *0.986923267)
 Convert pressure from bar to atm.
 
template<typename Scalar >
auto convertCubicCentimeterToCubicMeter (Scalar V) -> decltype(V *1.0e-6)
 Converts volume from cm3 to m3.
 
template<typename Scalar >
auto convertCubicMeterToCubicCentimeter (Scalar V) -> decltype(V *1.0e+6)
 Converts volume from m3 to cm3.
 
template<typename Scalar >
auto convertCubicMeterToLiter (Scalar V) -> decltype(V *1.0e+3)
 Converts volume from m3 to liter.
 
template<typename Scalar >
auto convertLiterToCubicMeter (Scalar V) -> decltype(V *1.0e-3)
 Converts volume from liter to m3.
 
template<typename... Args>
auto warning (bool condition, Args... items) -> void
 Issue a warning message if condition is true.
 
template<typename... Args>
auto error (bool condition, Args... items) -> void
 Raise a runtime error if condition is true.
 
auto interpolate (const Vec< double > &temperatures, const Vec< double > &pressures, const Vec< double > &scalars) -> Fn< real(real, real)>
 
auto interpolate (const Vec< double > &temperatures, const Vec< double > &pressures, const Fn< double(double, double)> &func) -> Fn< real(real, real)>
 
auto interpolate (const Vec< double > &temperatures, const Vec< double > &pressures, const Vec< Fn< double(double, double)>> &fs) -> Fn< ArrayXr(real, real)>
 
auto zeros (Index rows) -> decltype(VectorXd::Zero(rows))
 Return an expression of a zero vector. More...
 
auto ones (Index rows) -> decltype(VectorXd::Ones(rows))
 Return an expression of a vector with entries equal to one. More...
 
auto random (Index rows) -> decltype(VectorXd::Random(rows))
 Return an expression of a vector with random entries. More...
 
auto linspace (Index rows, double start, double stop) -> decltype(VectorXd::LinSpaced(rows, start, stop))
 Return a linearly spaced vector. More...
 
auto unit (Index rows, Index i) -> decltype(VectorXd::Unit(rows, i))
 Return an expression of a unit vector. More...
 
auto zeros (Index rows, Index cols) -> decltype(MatrixXd::Zero(rows, cols))
 Return an expression of a zero matrix. More...
 
auto ones (Index rows, Index cols) -> decltype(MatrixXd::Ones(rows, cols))
 Return an expression of a matrix with entries equal to one. More...
 
auto random (Index rows, Index cols) -> decltype(MatrixXd::Random(rows, cols))
 Return an expression of a matrix with random entries. More...
 
auto identity (Index rows, Index cols) -> decltype(MatrixXd::Identity(rows, cols))
 Return an expression of an identity matrix. More...
 
template<typename Derived >
auto rows (Eigen::MatrixBase< Derived > &mat, Index start, Index num) -> decltype(mat.middleRows(start, num))
 Return a view of a sequence of rows of a matrix. More...
 
template<typename Derived >
auto rows (const Eigen::MatrixBase< Derived > &mat, Index start, Index num) -> decltype(mat.middleRows(start, num))
 Return a view of a sequence of rows of a matrix. More...
 
template<typename Derived , typename Indices >
auto rows (Eigen::MatrixBase< Derived > &mat, const Indices &irows) -> decltype(mat(irows, Eigen::all))
 Return a view of some rows of a matrix. More...
 
template<typename Derived , typename Indices >
auto rows (const Eigen::MatrixBase< Derived > &mat, const Indices &irows) -> decltype(mat(irows, Eigen::all))
 Return a const view of some rows of a matrix. More...
 
template<typename Derived >
auto cols (Eigen::MatrixBase< Derived > &mat, Index start, Index num) -> decltype(mat.middleCols(start, num))
 Return a view of a sequence of columns of a matrix. More...
 
template<typename Derived >
auto cols (const Eigen::MatrixBase< Derived > &mat, Index start, Index num) -> decltype(mat.middleCols(start, num))
 Return a view of a sequence of columns of a matrix. More...
 
template<typename Derived , typename Indices >
auto cols (Eigen::MatrixBase< Derived > &mat, const Indices &icols) -> decltype(mat(Eigen::all, icols))
 Return a view of some columns of a matrix. More...
 
template<typename Derived , typename Indices >
auto cols (const Eigen::MatrixBase< Derived > &mat, const Indices &icols) -> decltype(mat(Eigen::all, icols))
 Return a const view of some columns of a matrix. More...
 
template<typename Derived >
auto segment (Eigen::MatrixBase< Derived > &vec, Index irow, Index nrows) -> decltype(vec.segment(irow, nrows))
 Return a view of some rows and columns of a matrix. More...
 
template<typename Derived >
auto segment (const Eigen::MatrixBase< Derived > &vec, Index irow, Index nrows) -> decltype(vec.segment(irow, nrows))
 Return a view of some rows and columns of a matrix. More...
 
template<typename Derived >
auto block (Eigen::MatrixBase< Derived > &mat, Index irow, Index icol, Index nrows, Index ncols) -> decltype(mat.block(irow, icol, nrows, ncols))
 Return a view of some rows and columns of a matrix. More...
 
template<typename Derived >
auto block (const Eigen::MatrixBase< Derived > &mat, Index irow, Index icol, Index nrows, Index ncols) -> decltype(mat.block(irow, icol, nrows, ncols))
 Return a view of some rows and columns of a matrix. More...
 
template<typename Derived , typename Indices >
auto submatrix (Eigen::MatrixBase< Derived > &mat, const Indices &irows, const Indices &icols) -> decltype(mat(irows, icols))
 Return a view of some rows and columns of a matrix. More...
 
template<typename Derived , typename Indices >
auto submatrix (const Eigen::MatrixBase< Derived > &mat, const Indices &irows, const Indices &icols) -> decltype(mat(irows, icols))
 Return a const view of some rows and columns of a matrix. More...
 
template<typename Derived >
auto tr (Eigen::MatrixBase< Derived > &mat) -> decltype(mat.transpose())
 Return the transpose of the matrix.
 
template<typename Derived >
auto tr (const Eigen::MatrixBase< Derived > &mat) -> decltype(mat.transpose())
 Return the transpose of the matrix.
 
template<typename Derived >
auto inv (const Eigen::MatrixBase< Derived > &mat) -> decltype(mat.cwiseInverse())
 Return the component-wise inverse of the matrix.
 
template<typename Derived >
auto diag (const Eigen::MatrixBase< Derived > &vec) -> decltype(vec.asDiagonal())
 Return a diagonal matrix representation of a vector.
 
template<typename Derived >
auto diagonal (Eigen::MatrixBase< Derived > &mat) -> decltype(mat.diagonal())
 Return a vector representation of the diagonal of a matrix.
 
template<typename Derived >
auto diagonal (const Eigen::MatrixBase< Derived > &mat) -> decltype(mat.diagonal())
 Return a vector representation of the diagonal of a matrix.
 
template<int p, typename Derived >
auto norm (const Eigen::MatrixBase< Derived > &mat) -> double
 Return the Lp norm of a matrix.
 
template<typename Derived >
auto norm (const Eigen::MatrixBase< Derived > &mat) -> double
 Return the L2 norm of a matrix.
 
template<typename Derived >
auto norminf (const Eigen::MatrixBase< Derived > &mat) -> double
 Return the L-inf norm of a matrix.
 
template<typename Derived >
auto sum (const Eigen::DenseBase< Derived > &mat) -> typename Derived::Scalar
 Return the sum of the components of a matrix.
 
template<typename DerivedLHS , typename DerivedRHS >
auto dot (const Eigen::MatrixBase< DerivedLHS > &lhs, const Eigen::MatrixBase< DerivedRHS > &rhs) -> decltype(lhs.dot(rhs))
 Return the dot product of two matrices.
 
template<typename Derived >
auto min (const Eigen::MatrixBase< Derived > &mat) -> decltype(mat.minCoeff())
 Return the minimum component of a matrix.
 
template<typename DerivedLHS , typename DerivedRHS >
auto min (const Eigen::MatrixBase< DerivedLHS > &lhs, const Eigen::MatrixBase< DerivedRHS > &rhs) -> decltype(lhs.cwiseMin(rhs))
 Return the component-wise minimum of two matrices.
 
template<typename Derived >
auto max (const Eigen::MatrixBase< Derived > &mat) -> decltype(mat.maxCoeff())
 Return the maximum component of a matrix.
 
template<typename DerivedLHS , typename DerivedRHS >
auto max (const Eigen::MatrixBase< DerivedLHS > &lhs, const Eigen::MatrixBase< DerivedRHS > &rhs) -> decltype(lhs.cwiseMax(rhs))
 Return the component-wise maximum of two matrices.
 
template<typename DerivedLHS , typename DerivedRHS >
auto operator% (const Eigen::MatrixBase< DerivedLHS > &lhs, const Eigen::MatrixBase< DerivedRHS > &rhs) -> decltype(lhs.cwiseProduct(rhs))
 Return the component-wise multiplication of two matrices.
 
template<typename DerivedLHS , typename DerivedRHS >
auto operator/ (const Eigen::MatrixBase< DerivedLHS > &lhs, const Eigen::MatrixBase< DerivedRHS > &rhs) -> decltype(lhs.cwiseQuotient(rhs))
 Return the component-wise division of two matrices.
 
template<typename Derived >
auto operator/ (const typename Derived::Scalar &scalar, const Eigen::MatrixBase< Derived > &mat) -> decltype(scalar *mat.cwiseInverse())
 Return the component-wise division of two matrices.
 
template<typename Derived >
auto operator+ (const typename Derived::Scalar &scalar, const Eigen::MatrixBase< Derived > &mat) -> decltype((scalar+mat.array()).matrix())
 Return the component-wise division of two matrices.
 
template<typename Derived >
auto operator+ (const Eigen::MatrixBase< Derived > &mat, const typename Derived::Scalar &scalar) -> decltype((scalar+mat.array()).matrix())
 Return the component-wise division of two matrices.
 
template<typename Derived >
auto operator- (const typename Derived::Scalar &scalar, const Eigen::MatrixBase< Derived > &mat) -> decltype((scalar - mat.array()).matrix())
 Return the component-wise division of two matrices.
 
template<typename Derived >
auto operator- (const Eigen::MatrixBase< Derived > &mat, const typename Derived::Scalar &scalar) -> decltype((mat.array() - scalar).matrix())
 Return the component-wise division of two matrices.
 
template<typename Derived >
auto abs (const Eigen::MatrixBase< Derived > &mat) -> decltype(mat.cwiseAbs())
 Return the component-wise absolute entries of a matrix.
 
template<typename Derived >
auto sqrt (const Eigen::MatrixBase< Derived > &mat) -> decltype(mat.cwiseSqrt())
 Return the component-wise square root of a matrix.
 
template<typename Derived >
auto pow (const Eigen::MatrixBase< Derived > &mat, double power) -> decltype(mat.array().pow(power))
 Return the component-wise exponential of a matrix.
 
template<typename Derived >
auto exp (const Eigen::MatrixBase< Derived > &mat) -> decltype(mat.array().exp().matrix())
 Return the component-wise natural exponential of a matrix.
 
template<typename Derived >
auto log (const Eigen::MatrixBase< Derived > &mat) -> decltype(mat.array().log().matrix())
 Return the component-wise natural log of a matrix.
 
template<typename Derived >
auto log10 (const Eigen::MatrixBase< Derived > &mat) -> decltype(mat.array().log10().matrix())
 Return the component-wise log10 of a matrix.
 
auto constants (Index rows, double val) -> decltype(VectorXd::Constant(rows, val))
 
auto unitcol (Index rows, Index i) -> decltype(unit(rows, i))
 
auto unitrow (Index cols, Index i) -> decltype(RowVectorXd::Unit(cols, i))
 
template<typename Ret , typename... Args>
auto memoize (Fn< Ret(Args...)> f) -> Fn< Ret(Args...)>
 Return a memoized version of given function f.
 
template<typename Fun , EnableIf<!isFunction< Fun >> ...>
auto memoize (Fun f)
 Return a memoized version of given function f.
 
template<typename Ret , typename... Args>
auto memoizeLast (Fn< Ret(Args...)> f) -> Fn< Ret(Args...)>
 Return a memoized version of given function f that caches only the arguments used in the last call.
 
template<typename Fun , EnableIf<!isFunction< Fun >> ...>
auto memoizeLast (Fun f)
 Return a memoized version of given function f that caches only the arguments used in the last call.
 
template<typename Ret , typename RetRef , typename... Args>
auto memoizeLastUsingRef (Fn< void(RetRef, Args...)> f) -> Fn< void(RetRef, Args...)>
 Return a memoized version of given function f that caches only the arguments used in the last call.
 
template<typename Ret , typename Fun , EnableIf<!isFunction< Fun >> ...>
auto memoizeLastUsingRef (Fun f)
 Return a memoized version of given function f that caches only the arguments used in the last call. More...
 
template<typename Ret , typename... Args>
auto memoizeLastUsingRef (Fn< void(Ret &, Args...)> f) -> Fn< void(Ret &, Args...)>
 Return a memoized version of given function f that caches only the arguments used in the last call. More...
 
template<typename Fun , EnableIf<!isFunction< Fun >> ...>
auto memoizeLastUsingRef (Fun f)
 Return a memoized version of given function f that caches only the arguments used in the last call. More...
 
template<size_t ibegin, size_t iend, typename Function >
constexpr auto For (Function &&f)
 Generate evaluation statements f(ibegin); f(ibegin + 1); ...; f(iend-1); at compile time.
 
template<size_t iend, typename Function >
constexpr auto For (Function &&f)
 Generate evaluation statements f(0); f(1); ...; f(iend-1); at compile time.
 
template<typename ArrayConstRef , typename ArrayRef >
auto molalities (ArrayConstRef &&n, Index iH2O, ArrayRef &&m)
 Compute the molalities of the species with given species amounts. More...
 
template<typename ArrayConstRef >
auto molalities (ArrayConstRef &&n, Index iH2O)
 Compute the molalities of the species with given species amounts. More...
 
template<typename ArrayConstRef , typename MatrixRef >
auto molalitiesJacobian (ArrayConstRef &&n, Index iH2O, MatrixRef &&J)
 Compute the Jacobian matrix of the species molalities ( \(J=\frac{\partial m}{\partial n}\)). More...
 
template<typename ArrayConstRef >
auto molalitiesJacobian (ArrayConstRef &&n, Index iH2O)
 Compute the Jacobian matrix of the species molalities ( \(J=\frac{\partial m}{\partial n}\)). More...
 
template<typename ArrayConstRef , typename MatrixRef >
auto lnMolalitiesJacobian (ArrayConstRef &&n, Index iH2O, MatrixRef &&J) -> void
 Compute the Jacobian matrix of the species molalities in natural log ( \(J=\frac{\partial\ln m}{\partial n}\)). More...
 
template<typename ArrayConstRef >
auto lnMolalitiesJacobian (ArrayConstRef &&n, Index iH2O)
 Compute the Jacobian matrix of the species molalities in natural log ( \(J=\frac{\partial\ln m}{\partial n}\)). More...
 
template<typename ArrayConstRef , typename VectorRef >
auto lnMolalitiesJacobianDiagonal (ArrayConstRef &&n, Index iH2O, VectorRef &&D) -> void
 Compute the diagonal only of the Jacobian matrix of the species molalities in natural log ( \(J=\frac{\partial\ln m}{\partial n}\)). More...
 
template<typename ArrayConstRef >
auto lnMolalitiesJacobianDiagonal (ArrayConstRef &&n, Index iH2O)
 Compute the diagonal only of the Jacobian matrix of the species molalities in natural log ( \(J=\frac{\partial\ln m}{\partial n}\)). More...
 
template<typename ArrayConstRef , typename ArrayRef >
auto moleFractions (ArrayConstRef &&n, ArrayRef &&x)
 Compute the mole fractions of the species with given species amounts. More...
 
template<typename ArrayConstRef >
auto moleFractions (ArrayConstRef &&n)
 Compute the mole fractions of the species with given species amounts. More...
 
template<typename ArrayConstRef , typename MatrixRef >
auto moleFractionsJacobian (ArrayConstRef &&n, MatrixRef &&J)
 Compute the Jacobian matrix of the species mole fractions ( \(J=\frac{\partial x}{\partial n}\)). More...
 
template<typename ArrayConstRef >
auto moleFractionsJacobian (ArrayConstRef &&n)
 Compute the Jacobian matrix of the species mole fractions ( \(J=\frac{\partial x}{\partial n}\)). More...
 
template<typename ArrayConstRef , typename MatrixRef >
auto lnMoleFractionsJacobian (ArrayConstRef &&n, MatrixRef &&J) -> void
 Compute the Jacobian matrix of the species mole fractions in natural log ( \(J=\frac{\partial\ln x}{\partial n}\)). More...
 
template<typename ArrayConstRef >
auto lnMoleFractionsJacobian (ArrayConstRef &&n)
 Compute the Jacobian matrix of the species mole fractions in natural log ( \(J=\frac{\partial\ln x}{\partial n}\)). More...
 
template<typename ArrayConstRef , typename MatrixRef >
auto lnMoleFractionsJacobianDiagonal (ArrayConstRef &&n, MatrixRef &&D) -> void
 Compute the diagonal only of the Jacobian matrix of the species mole fractions in natural log ( \(J=\frac{\partial\ln x}{\partial n}\)). More...
 
template<typename ArrayConstRef >
auto lnMoleFractionsJacobianDiagonal (ArrayConstRef &&n)
 Compute the diagonal only of the Jacobian matrix of the species mole fractions in natural log ( \(J=\frac{\partial\ln x}{\partial n}\)). More...
 
auto alternativeWaterNames () -> std::vector< std::string >
 Return a collection of alternative names to the given species name. More...
 
auto alternativeChargedSpeciesNames (std::string name) -> std::vector< std::string > &
 Return a collection of alternative names to the given charged species name. More...
 
auto alternativeNeutralSpeciesNames (std::string name) -> std::vector< std::string > &
 Return a collection of alternative names to the given neutral species name. More...
 
auto conventionalWaterName () -> std::string
 Return the conventional water name, which is H2O(l).
 
auto conventionalChargedSpeciesName (std::string name) -> std::string
 Return the conventional charged species name adopted in Reaktoro. More...
 
auto conventionalNeutralSpeciesName (std::string name) -> std::string
 Return the conventional neutral species name adopted in Reaktoro. More...
 
auto isAlternativeWaterName (std::string trial) -> bool
 Return true if a trial name is an alternative to a water species name. More...
 
auto isAlternativeChargedSpeciesName (std::string trial, std::string name) -> bool
 Return true if a trial name is an alternative to a given charged species name. More...
 
auto isAlternativeNeutralSpeciesName (std::string trial, std::string name) -> bool
 Return true if a trial name is an alternative to a given neutral species name. More...
 
auto splitChargedSpeciesName (std::string name) -> std::pair< std::string, double >
 Return a pair with the base name of a charged species and its electrical charge. More...
 
auto baseNameChargedSpecies (std::string name) -> std::string
 Return the name of a charged species without charge suffix. More...
 
auto baseNameNeutralSpecies (std::string name) -> std::string
 Return the name of a neutral species without suffix (aq). More...
 
auto chargeInSpeciesName (std::string name) -> double
 Return the electrical charge in a species name. More...
 
auto splitSpeciesNameSuffix (std::string name) -> std::pair< std::string, std::string >
 Split name and suffix from a substance name or chemical formula. More...
 
auto parseReaction (const String &equation) -> Pairs< String, double >
 Parse a reaction equation.
 
auto parseNumberStringPairs (const String &str) -> Pairs< String, double >
 Parse a formatted string containing pairs of numbers and strings. More...
 
auto parseChemicalFormula (const String &formula) -> Pairs< String, double >
 Return the element symbols and their coefficients in a chemical formula. More...
 
auto parseElectricCharge (const String &formula) -> double
 Return the electric charge in a chemical formula. More...
 
auto parseReactionEquation (const String &equation) -> Pairs< String, double >
 Parse a formatted string representing a reaction equation. More...
 
template<typename... Args>
auto stringfy (const String &sep, Args... items) -> String
 Concatenate the arguments into a string using a given separator string.
 
template<typename... Args>
auto str (Args... items) -> String
 Concatenate the arguments into a string without any separator string.
 
auto replace (String original, String substr, String newsubstr) -> String
 Return a new string where substr occurrences are replaced by newsubstr.
 
auto lowercase (String str) -> String
 Return a string with lower case characters.
 
auto uppercase (String str) -> String
 Return a string with upper case characters.
 
auto trimleft (String str) -> String
 Trim the string from start (taken from http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring)
 
auto trimright (String str) -> String
 Trim the string from end (taken from http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring)
 
auto trim (String str) -> String
 Trim the string from both ends (taken from http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring)
 
auto split (const String &str, const String &delims, std::function< String(String)> transform) -> Strings
 Split the string on every occurrence of the specified delimiters and apply a transform function.
 
auto split (const String &str, const String &delims=" ") -> Strings
 Split the string on every occurrence of the specified delimiters.
 
auto join (const Strings &strs, String sep=" ") -> String
 Join several strings into one.
 
auto tofloat (const String &str) -> double
 Convert the string into a floating point number.
 
auto makeunique (Strings words, String suffix) -> Strings
 Return a list of words with duplicate names converted to unique ones.
 
template<typename T >
auto table1D (unsigned dim1) -> Table1D< T >
 
template<typename T >
auto table2D (unsigned dim1, unsigned dim2) -> Table2D< T >
 
template<typename T >
auto table3D (unsigned dim1, unsigned dim2, unsigned dim3) -> Table3D< T >
 
auto time () -> Time
 Return the time point now. More...
 
auto elapsed (const Time &end, const Time &begin) -> double
 Return the elapsed time between two time points (in units of s) More...
 
auto elapsed (const Time &begin) -> double
 Return the elapsed time between a time point and now (in units of s) More...
 
template<typename Fun >
constexpr auto asFunction (const Fun &f)
 Convert lambda/function pointers/member functions to std::function. More...
 
 REAKTORO_DEFINE_REFERENCE_TYPE_OF (ActivityProps, ActivityPropsRef)
 
auto chain (const Vec< ActivityModelGenerator > &models) -> ActivityModelGenerator
 Return an activity model resulting from chaining other activity models.
 
auto chain (const ActivityModelGenerator &model) -> ActivityModelGenerator
 Return an activity model resulting from chaining other activity models.
 
template<typename... Models>
auto chain (const ActivityModelGenerator &model, const Models &... models) -> ActivityModelGenerator
 Return an activity model resulting from chaining other activity models.
 
auto operator<< (std::ostream &out, AggregateState option) -> std::ostream &
 Output an AggregateState value.
 
auto parseAggregateState (const std::string &symbol) -> AggregateState
 Return the AggregateState value from given aggregate state symbol. More...
 
auto identifyAggregateState (const std::string &name) -> AggregateState
 Identify the aggregate state in the name of a substance or chemical species. More...
 
auto supportedAggregateStateValues () -> std::string
 Return a string containing the supported string values for AggregateState.
 
auto operator< (const ChemicalFormula &lhs, const ChemicalFormula &rhs) -> bool
 Compare two ChemicalFormula objects for less than.
 
auto operator== (const ChemicalFormula &lhs, const ChemicalFormula &rhs) -> bool
 Compare two ChemicalFormula objects for equality.
 
auto operator<< (std::ostream &out, const ChemicalProps &props) -> std::ostream &
 Output a ChemicalProps object to an output stream.
 
auto operator<< (std::ostream &out, const ChemicalState &state) -> std::ostream &
 Output a ChemicalState object to an output stream.
 
auto operator<< (std::ostream &out, const ChemicalSystem &system) -> std::ostream &
 Output a ChemicalSystem instance.
 
auto operator< (const Element &lhs, const Element &rhs) -> bool
 Compare two Element objects for less than.
 
auto operator== (const Element &lhs, const Element &rhs) -> bool
 Compare two Element objects for equality.
 
auto operator!= (const ElementalComposition &l, const ElementalComposition &r) -> bool
 Return true if two ElementalComposition objects are different.
 
auto operator== (const ElementalComposition &l, const ElementalComposition &r) -> bool
 Return true if two ElementalComposition objects are equal.
 
auto operator+ (const ElementList &a, const ElementList &b) -> ElementList
 Return the concatenation of two ElementList objects.
 
template<typename Result , typename... Args>
auto chain (const Vec< Model< Result(Args...)>> &models) -> Model< Result(Args...)>
 Return a reaction thermodynamic model resulting from chaining other models.
 
template<typename Signature >
auto chain (const Model< Signature > &model) -> Model< Signature >
 Return a reaction thermodynamic model resulting from chaining other models.
 
template<typename Result , typename... Args, typename... Models>
auto chain (const Model< Result(Args...)> &model, const Models &... models) -> Model< Result(Args...)>
 Return a reaction thermodynamic model resulting from chaining other models.
 
auto operator+ (const Param &p)
 
auto operator- (const Param &p)
 
auto operator+ (const Param &p, const Param &q)
 
auto operator- (const Param &p, const Param &q)
 
auto operator* (const Param &p, const Param &q)
 
auto operator/ (const Param &p, const Param &q)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator+ (const Param &p, const T &x)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator- (const Param &p, const T &x)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator* (const Param &p, const T &x)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator/ (const Param &p, const T &x)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator+ (const T &x, const Param &p)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator- (const T &x, const Param &p)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator* (const T &x, const Param &p)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator/ (const T &x, const Param &p)
 
auto operator== (const Param &p, const Param &q)
 
auto operator!= (const Param &p, const Param &q)
 
auto operator< (const Param &p, const Param &q)
 
auto operator> (const Param &p, const Param &q)
 
auto operator<= (const Param &p, const Param &q)
 
auto operator>= (const Param &p, const Param &q)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator== (const Param &p, const T &x)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator!= (const Param &p, const T &x)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator< (const Param &p, const T &x)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator> (const Param &p, const T &x)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator<= (const Param &p, const T &x)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator>= (const Param &p, const T &x)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator== (const T &x, const Param &p)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator!= (const T &x, const Param &p)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator< (const T &x, const Param &p)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator> (const T &x, const Param &p)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator<= (const T &x, const Param &p)
 
template<typename T , EnableIf< isNumeric< T >> ...>
auto operator>= (const T &x, const Param &p)
 
template<size_t order, typename U >
auto seed (Param &param, U &&seedval)
 
auto operator< (const Phase &lhs, const Phase &rhs) -> bool
 Compare two Phase instances for less than.
 
auto operator== (const Phase &lhs, const Phase &rhs) -> bool
 Compare two Phase instances for equality.
 
auto operator+ (const PhaseList &a, const PhaseList &b) -> PhaseList
 Return the concatenation of two PhaseList objects.
 
auto speciate (const StringList &symbols)
 The auxiliary function used to specify phase species to be determined from element symbols.
 
auto exclude (const StringList &tags)
 The auxiliary function used to specify species that should be filtered out when contructing a phase.
 
auto operator< (const Reaction &lhs, const Reaction &rhs) -> bool
 Compare two Reaction instances for less than.
 
auto operator== (const Reaction &lhs, const Reaction &rhs) -> bool
 Compare two Reaction instances for equality.
 
auto operator< (const ReactionEquation &lhs, const ReactionEquation &rhs) -> bool
 Return true if a Species object is less than another for sorting reasons.
 
auto operator== (const ReactionEquation &lhs, const ReactionEquation &rhs) -> bool
 Return true if two ReactionEquation objects are equal.
 
auto operator<< (std::ostream &out, const ReactionEquation &equation) -> std::ostream &
 Output a ReactionEquation object.
 
auto operator<< (std::ostream &out, const ReactionProps &props) -> std::ostream &
 Output a ReactionProps object to an output stream.
 
auto operator< (const Species &lhs, const Species &rhs) -> bool
 Return true if a Species object is less than another for sorting reasons.
 
auto operator== (const Species &lhs, const Species &rhs) -> bool
 Return true if two Species objects have the same name.
 
auto operator+ (const SpeciesList &a, const SpeciesList &b) -> SpeciesList
 Return the concatenation of two SpeciesList objects.
 
auto operator<< (std::ostream &out, const SpeciesThermoProps &props) -> std::ostream &
 Output a SpeciesThermoProps object to an output stream.
 
auto operator<< (std::ostream &out, StateOfMatter option) -> std::ostream &
 Output a StateOfMatter value.
 
auto equilibrate (ChemicalState &state) -> EquilibriumResult
 Equilibrate a chemical state instance.
 
auto equilibrate (ChemicalState &state, const EquilibriumOptions &options) -> EquilibriumResult
 Equilibrate a chemical state instance.
 
auto operator<< (std::ostream &out, const PorousRockState &state) -> std::ostream &
 Output a PorousRockState instance.
 
auto operator<< (std::ostream &out, const BilinearInterpolator &interpolator) -> std::ostream &
 Output a BilinearInterpolator instance.
 
auto derivativeForward (const ScalarFunction &f, VectorXdConstRef x) -> VectorXd
 Calculate the partial derivatives of a scalar function using a 1st-order forward finite difference scheme. More...
 
auto derivativeBackward (const ScalarFunction &f, VectorXdConstRef x) -> VectorXd
 Calculate the partial derivatives of a scalar function using a 1st-order backward finite difference scheme. More...
 
auto derivativeCentral (const ScalarFunction &f, VectorXdConstRef x) -> VectorXd
 Calculate the partial derivatives of a scalar function using a 2nd-order central finite difference scheme. More...
 
auto derivativeForward (const VectorFunction &f, VectorXdConstRef x) -> MatrixXd
 Calculate the partial derivatives of a vector function using a 1st-order forward finite difference scheme. More...
 
auto derivativeBackward (const VectorFunction &f, VectorXdConstRef x) -> MatrixXd
 Calculate the partial derivatives of a vector function using a 1st-order backward finite difference scheme. More...
 
auto derivativeCentral (const VectorFunction &f, VectorXdConstRef x) -> MatrixXd
 Calculate the partial derivatives of a vector function using a 2nd-order central finite difference scheme. More...
 
auto linearlyIndependentCols (MatrixXdConstRef A) -> Indices
 Determine the set of linearly independent columns in a matrix using a column pivoting QR algorithm. More...
 
auto linearlyIndependentRows (MatrixXdConstRef A) -> Indices
 Determine the set of linearly independent rows in a matrix. More...
 
auto linearlyIndependentCols (MatrixXdConstRef A, MatrixXdRef B) -> Indices
 Determine the set of linearly independent columns in a matrix. More...
 
auto linearlyIndependentRows (MatrixXdConstRef A, MatrixXdRef B) -> Indices
 Determine the set of linearly independent rows in a matrix. More...
 
auto inverseShermanMorrison (MatrixXdConstRef invA, VectorXdConstRef D) -> MatrixXd
 Calculate the inverse of A + D where inv(A) is already known and D is a diagonal matrix. More...
 
auto rationalize (double x, unsigned maxden) -> std::tuple< long, long >
 Calculates the rational number that approximates a given real number. More...
 
auto cleanRationalNumbers (double *vals, long size, long maxden=6) -> void
 Clean an array that is known to have rational numbers from round-off errors. More...
 
auto cleanRationalNumbers (MatrixXdRef A, long maxden=6) -> void
 Clean a matrix that is known to have rational numbers from round-off errors. More...
 
auto dot3p (VectorXdConstRef x, VectorXdConstRef y, double s) -> double
 Return the dot product s + dot(x, y) of two vectors with triple-precision.
 
auto residual3p (MatrixXdConstRef A, VectorXdConstRef x, VectorXdConstRef b) -> VectorXd
 Return the residual of the equation A*x - b with triple-precision.
 
template<typename T >
auto cardano (const T &b, const T &c, const T &d) -> CubicRoots< T >
 Calculate the roots of a cubic equation using Cardano's method. More...
 
template<typename T >
auto newton (const std::function< std::tuple< T, T >(const T &)> &f, const T &x0, const T &epsilon, std::size_t maxiter) -> std::tuple< T, std::size_t, bool >
 Calculate the root of a non-linear function using Newton's method. More...
 
template<typename T >
auto realRoots (const CubicRoots< T > &roots) -> std::vector< T >
 Return all real roots of a group of roots. More...
 
auto ReactionThermoModelConstLgK (const ReactionThermoModelParamsConstLgK &params) -> ReactionThermoModel
 Return a function that calculates thermodynamic properties of a reaction using a constant model for \(\lg K(T)\). More...
 
auto ReactionThermoModelGemsLgK (const ReactionThermoModelParamsGemsLgK &params) -> ReactionThermoModel
 Return a function that calculates thermodynamic properties of a reaction using GEM-Selektor's expression for \(\lg K(T)\). More...
 
auto ReactionThermoModelPhreeqcLgK (const ReactionThermoModelParamsPhreeqcLgK &params) -> ReactionThermoModel
 Return a function that calculates thermodynamic properties of a reaction using PHREEQC's analytical expression. More...
 
auto ReactionThermoModelPressureCorrection (Param Pr) -> ReactionThermoModel
 Return a function that calculates pressure correction for standard Gibbs energy and enthalpy a reaction. More...
 
auto ReactionThermoModelVantHoff (const ReactionThermoModelParamsVantHoff &params) -> ReactionThermoModel
 Return a function that calculates thermodynamic properties of a reaction using van't Hoff's model. More...
 
auto ReactionThermoModelYAML (const yaml &node) -> ReactionThermoModel
 Return a reaction thermodynamic model with given yaml node.
 
auto StandardThermoModelConstant (const StandardThermoModelParamsConstant &params) -> StandardThermoModel
 Return a function that calculates thermodynamic properties of a species using a constant model for its standard properties.
 
auto StandardThermoModelHKF (const StandardThermoModelParamsHKF &params) -> StandardThermoModel
 Return a function that calculates thermodynamic properties of an aqueous solute using the HKF model.
 
auto StandardThermoModelHollandPowell (const StandardThermoModelParamsHollandPowell &params) -> StandardThermoModel
 Return a function that calculates thermodynamic properties of a fluid or mineral species using the Holland-Powell model.
 
auto StandardThermoModelInterpolation (const StandardThermoModelParamsInterpolation &params) -> StandardThermoModel
 Return a function that calculates thermodynamic properties of a species using the Maier-Kelley model.
 
auto StandardThermoModelMaierKelley (const StandardThermoModelParamsMaierKelley &params) -> StandardThermoModel
 Return a function that calculates thermodynamic properties of a species using the Maier-Kelley model.
 
auto StandardThermoModelMineralHKF (const StandardThermoModelParamsMineralHKF &params) -> StandardThermoModel
 Return a function that calculates thermodynamic properties of a species using the Maier-Kelley-HKF model.
 
auto StandardThermoModelNasa (const StandardThermoModelParamsNasa &params) -> StandardThermoModel
 Return a function that calculates thermodynamic properties of a species using the Maier-Kelley model.
 
auto StandardThermoModelWaterHKF (const StandardThermoModelParamsWaterHKF &params) -> StandardThermoModel
 Return a function that calculates thermodynamic properties of the aqueous solvent (water) using the HKF model.
 
auto StandardThermoModelYAML (const yaml &node) -> StandardThermoModel
 Return a standard thermodynamic model with given yaml node.
 
auto StandardVolumeModelConstant (const StandardVolumeModelParamsConstant &params) -> StandardVolumeModel
 Return a function that calculates the standard volume of a product species using a constant model.
 
auto speciesElectroPropsHKF (const gHKF &gstate, const StandardThermoModelParamsHKF &params) -> SpeciesElectroProps
 Compute the electrostatic properties of an aqueous solute with given HKF g function state.
 
 REAKTORO_YAML_ENCODE_DECLARE (real)
 
 REAKTORO_YAML_DECODE_DECLARE (real)
 
 REAKTORO_YAML_ENCODE_DECLARE (AggregateState)
 
 REAKTORO_YAML_DECODE_DECLARE (AggregateState)
 
 REAKTORO_YAML_ENCODE_DECLARE (ChemicalFormula)
 
 REAKTORO_YAML_DECODE_DECLARE (ChemicalFormula)
 
 REAKTORO_YAML_ENCODE_DECLARE (ChemicalSystem)
 
 REAKTORO_YAML_DECODE_DECLARE (ChemicalSystem)
 
 REAKTORO_YAML_ENCODE_DECLARE (Database)
 
 REAKTORO_YAML_DECODE_DECLARE (Database)
 
 REAKTORO_YAML_ENCODE_DECLARE (Element)
 
 REAKTORO_YAML_DECODE_DECLARE (Element)
 
 REAKTORO_YAML_ENCODE_DECLARE (ElementList)
 
 REAKTORO_YAML_DECODE_DECLARE (ElementList)
 
 REAKTORO_YAML_ENCODE_DECLARE (ElementalComposition)
 
 REAKTORO_YAML_DECODE_DECLARE (ElementalComposition)
 
 REAKTORO_YAML_ENCODE_DECLARE (FormationReaction)
 
 REAKTORO_YAML_DECODE_DECLARE (FormationReaction)
 
 REAKTORO_YAML_ENCODE_DECLARE (Param)
 
 REAKTORO_YAML_DECODE_DECLARE (Param)
 
 REAKTORO_YAML_ENCODE_DECLARE (Phase)
 
 REAKTORO_YAML_DECODE_DECLARE (Phase)
 
 REAKTORO_YAML_ENCODE_DECLARE (ReactionThermoModel)
 
 REAKTORO_YAML_DECODE_DECLARE (ReactionThermoModel)
 
 REAKTORO_YAML_ENCODE_DECLARE (Species)
 
 REAKTORO_YAML_DECODE_DECLARE (Species)
 
 REAKTORO_YAML_ENCODE_DECLARE (SpeciesList)
 
 REAKTORO_YAML_DECODE_DECLARE (SpeciesList)
 
 REAKTORO_YAML_ENCODE_DECLARE (StandardThermoModel)
 
 REAKTORO_YAML_DECODE_DECLARE (StandardThermoModel)
 
 REAKTORO_YAML_ENCODE_DECLARE (ReactionThermoModelParamsConstLgK)
 
 REAKTORO_YAML_DECODE_DECLARE (ReactionThermoModelParamsConstLgK)
 
 REAKTORO_YAML_ENCODE_DECLARE (ReactionThermoModelParamsGemsLgK)
 
 REAKTORO_YAML_DECODE_DECLARE (ReactionThermoModelParamsGemsLgK)
 
 REAKTORO_YAML_ENCODE_DECLARE (ReactionThermoModelParamsPhreeqcLgK)
 
 REAKTORO_YAML_DECODE_DECLARE (ReactionThermoModelParamsPhreeqcLgK)
 
 REAKTORO_YAML_ENCODE_DECLARE (ReactionThermoModelParamsVantHoff)
 
 REAKTORO_YAML_DECODE_DECLARE (ReactionThermoModelParamsVantHoff)
 
 REAKTORO_YAML_ENCODE_DECLARE (StandardThermoModelParamsConstant)
 
 REAKTORO_YAML_DECODE_DECLARE (StandardThermoModelParamsConstant)
 
 REAKTORO_YAML_ENCODE_DECLARE (StandardThermoModelParamsHKF)
 
 REAKTORO_YAML_DECODE_DECLARE (StandardThermoModelParamsHKF)
 
 REAKTORO_YAML_ENCODE_DECLARE (StandardThermoModelParamsHollandPowell)
 
 REAKTORO_YAML_DECODE_DECLARE (StandardThermoModelParamsHollandPowell)
 
 REAKTORO_YAML_ENCODE_DECLARE (StandardThermoModelParamsInterpolation)
 
 REAKTORO_YAML_DECODE_DECLARE (StandardThermoModelParamsInterpolation)
 
 REAKTORO_YAML_ENCODE_DECLARE (StandardThermoModelParamsMaierKelley)
 
 REAKTORO_YAML_DECODE_DECLARE (StandardThermoModelParamsMaierKelley)
 
 REAKTORO_YAML_ENCODE_DECLARE (StandardThermoModelParamsMineralHKF)
 
 REAKTORO_YAML_DECODE_DECLARE (StandardThermoModelParamsMineralHKF)
 
 REAKTORO_YAML_ENCODE_DECLARE (StandardThermoModelParamsNasa)
 
 REAKTORO_YAML_DECODE_DECLARE (StandardThermoModelParamsNasa)
 
 REAKTORO_YAML_ENCODE_DECLARE (StandardThermoModelParamsWaterHKF)
 
 REAKTORO_YAML_DECODE_DECLARE (StandardThermoModelParamsWaterHKF)
 
 REAKTORO_YAML_ENCODE_DECLARE (StandardVolumeModelParamsConstant)
 
 REAKTORO_YAML_DECODE_DECLARE (StandardVolumeModelParamsConstant)
 
auto ActivityModelDebyeHuckel () -> ActivityModelGenerator
 Return the activity model for aqueous phases based on the Debye–Hückel model. More...
 
auto ActivityModelDebyeHuckel (ActivityModelDebyeHuckelParams params) -> ActivityModelGenerator
 Return the activity model for aqueous phases based on the Debye–Hückel model with given custom parameters. More...
 
auto ActivityModelDebyeHuckelLimitingLaw () -> ActivityModelGenerator
 Return the activity model for aqueous phases based on the Debye–Hückel limiting law model. More...
 
auto ActivityModelDebyeHuckelKielland () -> ActivityModelGenerator
 Return the activity model for aqueous phases based on the Debye–Hückel model with Kielland (1937) parameters. More...
 
auto ActivityModelDebyeHuckelPHREEQC () -> ActivityModelGenerator
 Return the activity model for aqueous phases based on the Debye–Hückel model using PHREEQC parameters. More...
 
auto ActivityModelDebyeHuckelWATEQ4F () -> ActivityModelGenerator
 Return the activity model for aqueous phases based on the Debye–Hückel model using WATEQ4F parameters. More...
 
auto ActivityModelDrummond (String gas) -> ActivityModelGenerator
 Return the activity model for a dissolved gas species in an aqueous phase based on Drummond (1981). More...
 
auto ActivityModelDrummond (String gas, ActivityModelDrummondParams params) -> ActivityModelGenerator
 Return the activity model for a dissolved gas species in an aqueous phase based on Drummond (1981). More...
 
auto ActivityModelDuanSun (String gas) -> ActivityModelGenerator
 Return the activity model for a dissolved gas species in an aqueous phase based on Duan and Sun (2003). More...
 
auto ActivityModelHKF () -> ActivityModelGenerator
 Return the activity model for aqueous phases based on the HKF model. More...
 
auto ActivityModelPitzerHMW () -> ActivityModelGenerator
 Return the activity model for aqueous phases based on Harvie-Møller-Weare Pitzer's formulation. More...
 
auto ActivityModelRumpf (String gas) -> ActivityModelGenerator
 Return the activity model for a dissolved gas species in an aqueous phase based on Rumpf (1994). More...
 
auto ActivityModelSetschenow (String neutral, real b) -> ActivityModelGenerator
 Return the Setschenow activity model for a neutral aqueous species. More...
 
auto operator<< (std::ostream &out, const AqueousProps &state) -> std::ostream &
 Output an AqueousProps object to an output stream.
 
auto ActivityModelVanDerWaals (ActivityModelCubicEOSParams params={}) -> ActivityModelGenerator
 Return the activity model for fluid phases based on the Van der Waals cubic equation of state.
 
auto ActivityModelRedlichKwong (ActivityModelCubicEOSParams params={}) -> ActivityModelGenerator
 Return the activity model for fluid phases based on the Redlich-Kwong cubic equation of state.
 
auto ActivityModelSoaveRedlichKwong (ActivityModelCubicEOSParams params={}) -> ActivityModelGenerator
 Return the activity model for fluid phases based on the Soave-Redlich-Kwong cubic equation of state.
 
auto ActivityModelPengRobinson (ActivityModelCubicEOSParams params={}) -> ActivityModelGenerator
 Return the activity model for fluid phases based on the Peng-Robinson cubic equation of state.
 
auto ActivityModelSpycherPruessEnnis () -> ActivityModelGenerator
 Return the activity model for gaseous phases formulated in Spycher et al. More...
 
auto ActivityModelSpycherReed () -> ActivityModelGenerator
 Return the activity model for gaseous phases formulated in Spycher and Reed (1988). More...
 
auto ActivityModelIdealAqueous () -> ActivityModelGenerator
 Return the activity model for an ideal aqueous solution.
 
auto ActivityModelIdealGas () -> ActivityModelGenerator
 Return the activity model for an ideal gaseous solution.
 
auto ActivityModelIdealIonExchange () -> ActivityModelGenerator
 Return the activity model for the ideal ion exchange.
 
auto ActivityModelIdealSolution (StateOfMatter stateofmatter) -> ActivityModelGenerator
 Return the activity model for an ideal solution. More...
 
auto ActivityModelRedlichKister (real a0, real a1, real a2) -> ActivityModelGenerator
 Return the activity model for a binary solid solution phase based on Redlich-Kister model. More...
 
auto ActivityModelIonExchange () -> ActivityModelGenerator
 Return the activity model for the ion exchange. More...
 
auto ActivityModelIonExchangeGainesThomas () -> ActivityModelGenerator
 Return the Gaines-Thomas activity model for ion exchange. More...
 
auto operator<< (std::ostream &out, const IonExchangeProps &state) -> std::ostream &
 Output an IonExchangeProps object to an output stream.
 
auto waterElectroPropsJohnsonNorton (real T, real P, const WaterThermoProps &wtp) -> WaterElectroProps
 Calculate the electrostatic state of water using the model of Johnson and Norton (1991). More...
 
auto waterHelmholtzPropsHGK (real T, real D) -> WaterHelmholtzProps
 Calculate the Helmholtz free energy state of water using the Haar–Gallagher–Kell (1984) equation of state. More...
 
auto waterHelmholtzPropsWagnerPruss (real T, real D) -> WaterHelmholtzProps
 Calculate the Helmholtz free energy state of water using the Wagner and Pruss (1995) equation of state. More...
 
auto waterThermoPropsHGK (real T, real P, StateOfMatter stateofmatter) -> WaterThermoProps
 Calculate the thermodynamic state of water using the Haar-Gallagher-Kell (1984) equation of state. More...
 
auto waterThermoPropsHGKMemoized (real T, real P, StateOfMatter stateofmatter) -> WaterThermoProps
 Calculate the thermodynamic state of water using the Haar-Gallagher-Kell (1984) equation of state. More...
 
auto waterThermoPropsWagnerPruss (real T, real P, StateOfMatter stateofmatter) -> WaterThermoProps
 Calculate the thermodynamic state of water using the Wagner and Pruss (1995) equation of state. More...
 
auto waterThermoPropsWagnerPrussMemoized (real T, real P, StateOfMatter stateofmatter) -> WaterThermoProps
 Calculate the thermodynamic state of water using the Wagner and Pruss (1995) equation of state. More...
 
auto waterThermoProps (real T, real P, const WaterHelmholtzProps &whp) -> WaterThermoProps
 Calculate the thermodynamic state of water. More...
 
auto waterDensityHGK (real T, real P, StateOfMatter stateofmatter) -> real
 Calculate the density of water using the Haar–Gallagher–Kell (1984) equation of state. More...
 
auto waterDensityWagnerPruss (real T, real P, StateOfMatter stateofmatter) -> real
 Calculate the density of water using the Wagner and Pruss (1995) equation of state. More...
 
auto waterLiquidDensityHGK (real T, real P) -> real
 Calculate the density of liquid water using the Haar–Gallagher–Kell (1984) equation of state. More...
 
auto waterLiquidDensityWagnerPruss (real T, real P) -> real
 Calculate the density of liquid water using the Wagner and Pruss (1995) equation of state. More...
 
auto waterVaporDensityHGK (real T, real P) -> real
 Calculate the density of vapor water using the Haar–Gallagher–Kell (1984) equation of state. More...
 
auto waterVaporDensityWagnerPruss (real T, real P) -> real
 Calculate the density of vapor water using the Wagner and Pruss (1995) equation of state. More...
 
auto waterPressureHGK (real T, real D) -> real
 Calculate the pressure of water using the Haar–Gallagher–Kell (1984) equation of state. More...
 
auto waterPressureWagnerPruss (real T, real D) -> real
 Calculate the pressure of water using the Wagner and Pruss (1995) equation of state. More...
 
auto waterSaturatedPressureWagnerPruss (real T) -> real
 Calculate the saturated pressure of water using the Wagner and Pruss (1995) equation of state. More...
 
auto waterSaturatedLiquidDensityWagnerPruss (real T) -> real
 Calculate the saturated liquid-density of water using the Wagner and Pruss (1995) equation of state. More...
 
auto waterSaturatedVapourDensityWagnerPruss (real T) -> real
 Calculate the saturated vapour-density of water using the Wagner and Pruss (1995) equation of state. More...
 

Variables

constexpr auto universalGasConstant = 8.3144621
 The universal gas constant (in J/(mol*K))
 
constexpr auto faradayConstant = 96485.3329
 The Faraday constant (in C/mol)
 
constexpr auto molarMassElectron = 5.4857990888E-07
 The molar mass of an electron (in kg/mol)
 
constexpr auto jouleToCalorie = 0.239005736
 The constant factor that converts joule to calorie.
 
constexpr auto calorieToJoule = 4.184
 The constant factor that converts calorie to joule.
 
constexpr auto barToPascal = 1.0e+05
 The conversion factor from bar to pascal.
 
constexpr auto atmToPascal = 101325
 The conversion factor from atm to pascal.
 
constexpr auto cubicCentimeterToCubicMeter = 1.0e-06
 The conversion factor from cubic centimeters to cubic meters.
 
constexpr auto cubicMeterToCubicCentimeter = 1.0e+06
 The conversion factor from cubic meters to cubic centimeters.
 
constexpr auto ln10 = 2.30258509299404590109361379290930926799774169921875
 The value of ln(10)
 
constexpr auto inf = std::numeric_limits<double>::infinity()
 The value of infinity.
 
constexpr auto NaN = std::numeric_limits<double>::quiet_NaN()
 The value of NaN.
 
constexpr auto epsilon = std::numeric_limits<double>::epsilon()
 The value of machine precision epsilon.
 
template<typename T >
constexpr auto isArithmetic = std::is_arithmetic_v<Decay<T>>
 
template<typename T , typename U >
constexpr auto isSame = std::is_same_v<Decay<T>, Decay<U>>
 
template<typename T , typename U >
constexpr auto isBaseOf = std::is_base_of_v<Decay<T>, Decay<U>>
 
template<typename T >
constexpr auto isFunction = detail::isFunction<Decay<T>>::value
 
template<typename T , typename U , typename... Us>
constexpr auto isOneOf = detail::isOneOf<T, U, Us...>()
 
template<typename T >
constexpr auto isNumeric = isArithmetic<T> || isSame<T, real>
 
const double waterMolarMass = 0.018015268
 The molar mass of water in units of kg/mol.
 
const double waterCriticalTemperature = 647.096
 The critical temperature of water in units of K.
 
const double waterCriticalPressure = 22.064e+06
 The critical pressure of water in units of Pa.
 
const double waterCriticalDensity = 322.0
 The critical density of water in units of kg/m3.
 
const double waterTriplePointTemperature = 273.16
 The triple point temperature of water in units of K.
 
const double waterTriplePointPressure = 611.655
 The triple point pressure of water in units of Pa.
 
const double waterTriplePointDensityLiquid = 999.793
 The triple point liquid-density of water in units of kg/m3.
 
const double waterTriplePointDensityVapour = 0.00485458
 The triple point vapour-density of water in units of kg/m3.
 

Detailed Description

The namespace containing all components of the Reaktoro library.

Typedef Documentation

◆ Index

typedef std::size_t Index

Define a type that represents an index.

The type used to represent indices and unsigned integers in the library.

◆ Indices

typedef std::vector< Index > Indices

Define a type that represents a collection of indices.

The type that represents a collection of indices.

◆ ActivityModelGenerator

The type for functions that construct an ActivityModel for a phase.

Parameters
speciesThe species in the phase.

◆ PropFn

using PropFn = Fn<real(const ChemicalProps& props)>

The function type for evaluation of a property of a chemical system.

Parameters
propsThe already evaluated chemical properties of the system.
Returns
The property of interest retrieved from the given chemical properties of the system.

◆ StandardThermoModel

The function type for calculation of standard thermodynamic properties of a species.

Parameters
TThe temperature for the calculation (in K)
PThe pressure for the calculation (in Pa)
Returns
The standard thermodynamic properties of the species

◆ StandardVolumeModel

The function type for calculation of standard volume of a product species in a formation reaction.

Parameters
TThe temperature for the calculation (in K)
PThe pressure for the calculation (in Pa)
Returns
The standard molar volume of the product species

Enumeration Type Documentation

◆ AggregateState

enum AggregateState
strong

The aggregate states of substances according to IUPAC.

Cox, J. D. (1982). Notation for states and processes, significance of the word standard in chemical thermodynamics, and remarks on commonly tabulated forms of thermodynamic functions, Pure and Applied Chemistry, 54(6), 1239-1250. doi: https://doi.org/10.1351/pac198254061239

Enumerator
Gas 

for a gas or a vapour (symbol g)

Liquid 

for a liquid (symbol l)

Solid 

for a solid (symbol s)

Plasma 

for a plasma (symbol pl)

CondensedPhase 

for either the solid or the liquid state (symbol cd)

Fluid 

for either the gaseous or the liquid state) (symbol fl)

LiquidCrystal 

for a liquid crystal (crystalline liquid) (symbol lc)

CrystallineSolid 

for a crystalline solid (symbol cr)

AmorphousSolid 

for an amorphous solid (symbol am)

Vitreous 

for a vitreous substance (a glass) (symbol vit)

Adsorbed 

for a species adsorbed on a substrate (an adsorbate) (symbol ads)

Monomeric 

for a monomeric form (symbol mon)

Polymeric 

for a polymeric form (symbol pol)

SolidSolution 

for a solid solution (symbol ss)

IonExchange 

for an ion exchange species (symbol ex)

Aqueous 

for a species in a solution in which water is the solvent (symbol aq)

Undefined 

when aggregate state is not explicitly provided (default)

◆ StateOfMatter

enum StateOfMatter
strong

The list of states of matter for phases.

Enumerator
Unspecified 

when the state of matter of a phase is unspecified

Solid 

when the state of matter of a phase is solid

Liquid 

when the state of matter of a phase is liquid

Gas 

when the state of matter of a phase is gas

Supercritical 

when the state of matter of a phase is supercritical

Plasma 

when the state of matter of a phase is plama

Fluid 

when the state of matter of a phase can be either liquid, gas, or plasma // TODO: StateOfMatter::Fluid needs to go once StateOfMatter is a result of a activity model evaluation, and not a constant phase attribute.

Condensed 

when the state of matter of a phase can be either liquid or solid // TODO: StateOfMatter::Condensed needs to go once StateOfMatter is a result of a activity model evaluation, and not a constant phase attribute.

◆ GibbsHessian

enum GibbsHessian
strong

The options for the description of the Hessian of the Gibbs energy function.

Enumerator
Exact 

The Hessian of the Gibbs energy function is fully exact.

PartiallyExact 

The Hessian of the Gibbs energy function is partially exact, partially approximated.

Approx 

The Hessian of the Gibbs energy function is approximated using ideal thermodynamic models.

ApproxDiagonal 

The Hessian of the Gibbs energy function is a diagonal matrix approximation using ideal thermodynamic models.

Function Documentation

◆ zeros() [1/2]

auto zeros ( Index  rows) -> decltype(VectorXd::Zero(rows))
inline

Return an expression of a zero vector.

Parameters
rowsThe number of rows
Returns
The expression of a zero vector

◆ ones() [1/2]

auto ones ( Index  rows) -> decltype(VectorXd::Ones(rows))
inline

Return an expression of a vector with entries equal to one.

Parameters
rowsThe number of rows
Returns
The expression of a vector with entries equal to one

◆ random() [1/2]

auto random ( Index  rows) -> decltype(VectorXd::Random(rows))
inline

Return an expression of a vector with random entries.

Parameters
rowsThe number of rows
Returns
The expression of a vector with random entries equal to one

◆ linspace()

auto linspace ( Index  rows,
double  start,
double  stop 
) -> decltype(VectorXd::LinSpaced(rows, start, stop))
inline

Return a linearly spaced vector.

Parameters
rowsThe number of rows
startThe start of the sequence
stopThe stop of the sequence
Returns
The expression of a vector with linearly spaced entries

◆ unit()

auto unit ( Index  rows,
Index  i 
) -> decltype(VectorXd::Unit(rows, i))
inline

Return an expression of a unit vector.

Parameters
rowsThe number of rows
iThe index at which the component is one
Returns
The expression of a unit vector

◆ zeros() [2/2]

auto zeros ( Index  rows,
Index  cols 
) -> decltype(MatrixXd::Zero(rows, cols))
inline

Return an expression of a zero matrix.

Parameters
rowsThe number of rows
colsThe number of columns
Returns
The expression of a zero matrix

◆ ones() [2/2]

auto ones ( Index  rows,
Index  cols 
) -> decltype(MatrixXd::Ones(rows, cols))
inline

Return an expression of a matrix with entries equal to one.

Parameters
rowsThe number of rows
colsThe number of columns
Returns
The expression of a matrix with entries equal to one

◆ random() [2/2]

auto random ( Index  rows,
Index  cols 
) -> decltype(MatrixXd::Random(rows, cols))
inline

Return an expression of a matrix with random entries.

Parameters
rowsThe number of rows
colsThe number of columns
Returns
The expression of a matrix with random entries

◆ identity()

auto identity ( Index  rows,
Index  cols 
) -> decltype(MatrixXd::Identity(rows, cols))
inline

Return an expression of an identity matrix.

Parameters
rowsThe number of rows
colsThe number of columns
Returns
The expression of an identity matrix

◆ rows() [1/4]

auto rows ( Eigen::MatrixBase< Derived > &  mat,
Index  start,
Index  num 
) -> decltype(mat.middleRows(start, num))

Return a view of a sequence of rows of a matrix.

Parameters
matThe matrix from which a row view is created
startThe row index of the start of the sequence
numThe number of rows in the sequence

◆ rows() [2/4]

auto rows ( const Eigen::MatrixBase< Derived > &  mat,
Index  start,
Index  num 
) -> decltype(mat.middleRows(start, num))

Return a view of a sequence of rows of a matrix.

Parameters
matThe matrix from which a row view is created
startThe row index of the start of the sequence
numThe number of rows in the sequence

◆ rows() [3/4]

auto rows ( Eigen::MatrixBase< Derived > &  mat,
const Indices irows 
) -> decltype(mat(irows, Eigen::all))

Return a view of some rows of a matrix.

Parameters
matThe matrix for which the view is created
irowsThe indices of the rows of the matrix

◆ rows() [4/4]

auto rows ( const Eigen::MatrixBase< Derived > &  mat,
const Indices irows 
) -> decltype(mat(irows, Eigen::all))

Return a const view of some rows of a matrix.

Parameters
matThe matrix for which the view is created
irowsThe indices of the rows of the matrix

◆ cols() [1/4]

auto cols ( Eigen::MatrixBase< Derived > &  mat,
Index  start,
Index  num 
) -> decltype(mat.middleCols(start, num))

Return a view of a sequence of columns of a matrix.

Parameters
matThe matrix from which a column view is created
startThe column index of the start of the sequence
numThe number of columns in the sequence

◆ cols() [2/4]

auto cols ( const Eigen::MatrixBase< Derived > &  mat,
Index  start,
Index  num 
) -> decltype(mat.middleCols(start, num))

Return a view of a sequence of columns of a matrix.

Parameters
matThe matrix from which a column view is created
startThe column index of the start of the sequence
numThe number of columns in the sequence

◆ cols() [3/4]

auto cols ( Eigen::MatrixBase< Derived > &  mat,
const Indices icols 
) -> decltype(mat(Eigen::all, icols))

Return a view of some columns of a matrix.

Parameters
matThe matrix for which the view is created
icolsThe indices of the columns of the matrix

◆ cols() [4/4]

auto cols ( const Eigen::MatrixBase< Derived > &  mat,
const Indices icols 
) -> decltype(mat(Eigen::all, icols))

Return a const view of some columns of a matrix.

Parameters
matThe matrix for which the view is created
icolsThe indices of the columns of the matrix

◆ segment() [1/2]

auto segment ( Eigen::MatrixBase< Derived > &  vec,
Index  irow,
Index  nrows 
) -> decltype(vec.segment(irow, nrows))

Return a view of some rows and columns of a matrix.

Parameters
vecThe vector for which the view is created
irowThe index of the starting row
nrowsThe number of rows in the view

◆ segment() [2/2]

auto segment ( const Eigen::MatrixBase< Derived > &  vec,
Index  irow,
Index  nrows 
) -> decltype(vec.segment(irow, nrows))

Return a view of some rows and columns of a matrix.

Parameters
vecThe vector for which the view is created
irowThe index of the starting row
nrowsThe number of rows in the view

◆ block() [1/2]

auto block ( Eigen::MatrixBase< Derived > &  mat,
Index  irow,
Index  icol,
Index  nrows,
Index  ncols 
) -> decltype(mat.block(irow, icol, nrows, ncols))

Return a view of some rows and columns of a matrix.

Parameters
matThe matrix for which the view is created
irowThe index of the starting row
icolThe index of the starting column
nrowsThe number of rows in the block view
ncolsThe number of columns in the block view

◆ block() [2/2]

auto block ( const Eigen::MatrixBase< Derived > &  mat,
Index  irow,
Index  icol,
Index  nrows,
Index  ncols 
) -> decltype(mat.block(irow, icol, nrows, ncols))

Return a view of some rows and columns of a matrix.

Parameters
matThe matrix for which the view is created
irowThe index of the starting row
icolThe index of the starting column
nrowsThe number of rows in the block view
ncolsThe number of columns in the block view

◆ submatrix() [1/2]

auto submatrix ( Eigen::MatrixBase< Derived > &  mat,
const Indices irows,
const Indices icols 
) -> decltype(mat(irows, icols))

Return a view of some rows and columns of a matrix.

Parameters
matThe matrix for which the view is created
irowsThe indices of the rows of the matrix
icolsThe indices of the columns of the matrix

◆ submatrix() [2/2]

auto submatrix ( const Eigen::MatrixBase< Derived > &  mat,
const Indices irows,
const Indices icols 
) -> decltype(mat(irows, icols))

Return a const view of some rows and columns of a matrix.

Parameters
matThe matrix for which the view is created
irowsThe indices of the rows of the matrix
icolsThe indices of the columns of the matrix

◆ memoizeLastUsingRef() [1/3]

auto Reaktoro::memoizeLastUsingRef ( Fun  f)

Return a memoized version of given function f that caches only the arguments used in the last call.

/// Return a memoized version of given function f that caches only the arguments used in the last call. This overload is used when f is a lambda function or free function. Use memoizeLastUsingRef<Ret>(f) to explicitly specify the Ret type.

◆ memoizeLastUsingRef() [2/3]

auto Reaktoro::memoizeLastUsingRef ( Fn< void(Ret &, Args...)>  f) -> Fn<void(Ret&, Args...)>

Return a memoized version of given function f that caches only the arguments used in the last call.

This overload assumes that RetRef = Ret&.

◆ memoizeLastUsingRef() [3/3]

auto Reaktoro::memoizeLastUsingRef ( Fun  f)

Return a memoized version of given function f that caches only the arguments used in the last call.

This overload is used when f is a lambda function or free function. Use memoizeLastUsingRef(f) to implicitly specify that RetRef is Ret&.

◆ molalities() [1/2]

auto Reaktoro::molalities ( ArrayConstRef &&  n,
Index  iH2O,
ArrayRef &&  m 
)

Compute the molalities of the species with given species amounts.

Parameters
nThe vector with the species amounts.
iH2OThe index of the water solvent species.
[out]mThe vector of species molalities.

◆ molalities() [2/2]

auto Reaktoro::molalities ( ArrayConstRef &&  n,
Index  iH2O 
)

Compute the molalities of the species with given species amounts.

Parameters
nThe vector with the species amounts.
iH2OThe index of the water solvent species.

◆ molalitiesJacobian() [1/2]

auto Reaktoro::molalitiesJacobian ( ArrayConstRef &&  n,
Index  iH2O,
MatrixRef &&  J 
)

Compute the Jacobian matrix of the species molalities ( \(J=\frac{\partial m}{\partial n}\)).

Parameters
nThe vector with the species amounts.
iH2OThe index of the water solvent species.
[out]JThe output Jacobian matrix.

◆ molalitiesJacobian() [2/2]

auto Reaktoro::molalitiesJacobian ( ArrayConstRef &&  n,
Index  iH2O 
)

Compute the Jacobian matrix of the species molalities ( \(J=\frac{\partial m}{\partial n}\)).

Parameters
nThe vector with the species amounts.
iH2OThe index of the water solvent species.

◆ lnMolalitiesJacobian() [1/2]

auto Reaktoro::lnMolalitiesJacobian ( ArrayConstRef &&  n,
Index  iH2O,
MatrixRef &&  J 
) -> void

Compute the Jacobian matrix of the species molalities in natural log ( \(J=\frac{\partial\ln m}{\partial n}\)).

Parameters
nThe vector with the species amounts.
iH2OThe index of the water solvent species.
[out]JThe output Jacobian matrix.

◆ lnMolalitiesJacobian() [2/2]

auto Reaktoro::lnMolalitiesJacobian ( ArrayConstRef &&  n,
Index  iH2O 
)

Compute the Jacobian matrix of the species molalities in natural log ( \(J=\frac{\partial\ln m}{\partial n}\)).

Parameters
nThe vector with the species amounts.
iH2OThe index of the water solvent species.

◆ lnMolalitiesJacobianDiagonal() [1/2]

auto Reaktoro::lnMolalitiesJacobianDiagonal ( ArrayConstRef &&  n,
Index  iH2O,
VectorRef &&  D 
) -> void

Compute the diagonal only of the Jacobian matrix of the species molalities in natural log ( \(J=\frac{\partial\ln m}{\partial n}\)).

Parameters
nThe vector with the species amounts.
iH2OThe index of the water solvent species.
[out]DThe output diagonal of the Jacobian matrix.

◆ lnMolalitiesJacobianDiagonal() [2/2]

auto Reaktoro::lnMolalitiesJacobianDiagonal ( ArrayConstRef &&  n,
Index  iH2O 
)

Compute the diagonal only of the Jacobian matrix of the species molalities in natural log ( \(J=\frac{\partial\ln m}{\partial n}\)).

Parameters
nThe vector with the species amounts.
iH2OThe index of the water solvent species.

◆ moleFractions() [1/2]

auto Reaktoro::moleFractions ( ArrayConstRef &&  n,
ArrayRef &&  x 
)

Compute the mole fractions of the species with given species amounts.

Parameters
nThe vector with the species amounts.
[out]xThe vector of species mole fractions.

◆ moleFractions() [2/2]

auto Reaktoro::moleFractions ( ArrayConstRef &&  n)

Compute the mole fractions of the species with given species amounts.

Parameters
nThe vector with the species amounts.

◆ moleFractionsJacobian() [1/2]

auto Reaktoro::moleFractionsJacobian ( ArrayConstRef &&  n,
MatrixRef &&  J 
)

Compute the Jacobian matrix of the species mole fractions ( \(J=\frac{\partial x}{\partial n}\)).

Parameters
nThe vector with the species amounts.
[out]JThe output Jacobian matrix.

◆ moleFractionsJacobian() [2/2]

auto Reaktoro::moleFractionsJacobian ( ArrayConstRef &&  n)

Compute the Jacobian matrix of the species mole fractions ( \(J=\frac{\partial x}{\partial n}\)).

Parameters
nThe vector with the species amounts.

◆ lnMoleFractionsJacobian() [1/2]

auto Reaktoro::lnMoleFractionsJacobian ( ArrayConstRef &&  n,
MatrixRef &&  J 
) -> void

Compute the Jacobian matrix of the species mole fractions in natural log ( \(J=\frac{\partial\ln x}{\partial n}\)).

Parameters
nThe vector with the species amounts.
[out]JThe output Jacobian matrix.

◆ lnMoleFractionsJacobian() [2/2]

auto Reaktoro::lnMoleFractionsJacobian ( ArrayConstRef &&  n)

Compute the Jacobian matrix of the species mole fractions in natural log ( \(J=\frac{\partial\ln x}{\partial n}\)).

Parameters
nThe vector with the species amounts.

◆ lnMoleFractionsJacobianDiagonal() [1/2]

auto Reaktoro::lnMoleFractionsJacobianDiagonal ( ArrayConstRef &&  n,
MatrixRef &&  D 
) -> void

Compute the diagonal only of the Jacobian matrix of the species mole fractions in natural log ( \(J=\frac{\partial\ln x}{\partial n}\)).

Parameters
nThe vector with the species amounts.
[out]DThe output diagonal of the Jacobian matrix.

◆ lnMoleFractionsJacobianDiagonal() [2/2]

auto Reaktoro::lnMoleFractionsJacobianDiagonal ( ArrayConstRef &&  n)

Compute the diagonal only of the Jacobian matrix of the species mole fractions in natural log ( \(J=\frac{\partial\ln x}{\partial n}\)).

Parameters
nThe vector with the species amounts.

◆ alternativeWaterNames()

auto Reaktoro::alternativeWaterNames ( ) -> std::vector< std::string >

Return a collection of alternative names to the given species name.

Parameters
nameThe name of the species.

◆ alternativeChargedSpeciesNames()

auto Reaktoro::alternativeChargedSpeciesNames ( std::string  name) -> std::vector< std::string > &

Return a collection of alternative names to the given charged species name.

The argument name must follow the naming convention H+, Ca++, Cl-, HCO3-, CO3--, and so forth. That is it, the charge is given as a suffix with as much - or + as the number of charges.

Parameters
nameThe name of the charged species.

◆ alternativeNeutralSpeciesNames()

auto Reaktoro::alternativeNeutralSpeciesNames ( std::string  name) -> std::vector< std::string > &

Return a collection of alternative names to the given neutral species name.

The argument name must follow the naming convention CO2(aq), CaCO3(aq), NaCl(aq), and so forth. That is, the neutral species name has the suffix (aq).

Parameters
nameThe name of the neutral species.

◆ conventionalChargedSpeciesName()

auto Reaktoro::conventionalChargedSpeciesName ( std::string  name) -> std::string

Return the conventional charged species name adopted in Reaktoro.

This method will return the conventional charged species name adopted in Reaktoro. For example, Ca+2 results in Ca++, CO3-2 results in CO3--, Mg[+2] results in Mg++, and so forth.

Parameters
nameThe name of a charged species.

◆ conventionalNeutralSpeciesName()

auto Reaktoro::conventionalNeutralSpeciesName ( std::string  name) -> std::string

Return the conventional neutral species name adopted in Reaktoro.

This method will return the conventional neutral species name adopted in Reaktoro. For example, CO2 results in CO2(aq), CaCO3@ results in CaCO3(aq), NaCl,aq results in NaCl(aq), and so forth.

Parameters
nameThe name of a charged species.

◆ isAlternativeWaterName()

auto Reaktoro::isAlternativeWaterName ( std::string  trial) -> bool

Return true if a trial name is an alternative to a water species name.

Parameters
trialThe trial name that is being checked as an alternative to H2O(l)

◆ isAlternativeChargedSpeciesName()

auto Reaktoro::isAlternativeChargedSpeciesName ( std::string  trial,
std::string  name 
) -> bool

Return true if a trial name is an alternative to a given charged species name.

Parameters
trialThe trial name that is being checked as an alternative to name
nameThe name of the charged species with convention H+, Ca++, CO3--, etc.

◆ isAlternativeNeutralSpeciesName()

auto Reaktoro::isAlternativeNeutralSpeciesName ( std::string  trial,
std::string  name 
) -> bool

Return true if a trial name is an alternative to a given neutral species name.

Parameters
trialThe trial name that is being checked as an alternative to name
nameThe name of the neutral species with convention CO2(aq), CaCO3(aq).

◆ splitChargedSpeciesName()

auto Reaktoro::splitChargedSpeciesName ( std::string  name) -> std::pair< std::string, double >

Return a pair with the base name of a charged species and its electrical charge.

The name of the charge species has to have the following naming conventions: Ca++, Ca+2, and Ca[2+], or Na+, Na[+], or CO3–, CO3-2, and CO3[2-].

Parameters
nameThe name of the charged species.

◆ baseNameChargedSpecies()

auto Reaktoro::baseNameChargedSpecies ( std::string  name) -> std::string

Return the name of a charged species without charge suffix.

The name of the charge species has to have the following naming conventions: Ca++, Ca+2, and Ca[2+], or Na+, Na[+], or CO3–, CO3-2, and CO3[2-].

Parameters
nameThe name of the charged species.

◆ baseNameNeutralSpecies()

auto Reaktoro::baseNameNeutralSpecies ( std::string  name) -> std::string

Return the name of a neutral species without suffix (aq).

Parameters
nameThe name of the charged species.

◆ chargeInSpeciesName()

auto Reaktoro::chargeInSpeciesName ( std::string  name) -> double

Return the electrical charge in a species name.

The charge in the species name must be represended as H+, Ca++, HCO3-, CO3--, SO4--, and so forth.

Parameters
nameThe name of the species

◆ splitSpeciesNameSuffix()

auto Reaktoro::splitSpeciesNameSuffix ( std::string  name) -> std::pair< std::string, std::string >

Split name and suffix from a substance name or chemical formula.

The suffix must start with (, end with ) and cannot contain upper case characters.

Example:

using namespace Reaktoro;
const auto [name, suffix] = splitSpeciesNameSuffix("H2O(aq)"); // name: "H2O", suffix: "aq"
const auto [name, suffix] = splitSpeciesNameSuffix("CaCO3(s, calcite)"); // name: "CaCO3", suffix: "s, calcite"
const auto [name, suffix] = splitSpeciesNameSuffix("MgCO3"); // name: "MgCO3", suffix: ""
const auto [name, suffix] = splitSpeciesNameSuffix("Methane(aq)"); // name: "Methane", suffix: "aq"
const auto [name, suffix] = splitSpeciesNameSuffix("Ca++"); // name: "Ca++", suffix: ""
const auto [name, suffix] = splitSpeciesNameSuffix("Fe[3+](aq)"); // name: "Fe[3+]", suffix: "aq"
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:28
auto splitSpeciesNameSuffix(std::string name) -> std::pair< std::string, std::string >
Split name and suffix from a substance name or chemical formula.

◆ parseNumberStringPairs()

auto Reaktoro::parseNumberStringPairs ( const String str) -> Pairs< String, double >

Parse a formatted string containing pairs of numbers and strings.

See below several examples of parsing different formatted strings:

using namespace Reaktoro;
auto pairs0 = parseNumberStringPairs("2:H 1:O");
auto pairs1 = parseNumberStringPairs("1:Ca 2:Cl");
auto pairs2 = parseNumberStringPairs("1:Mg 1:C 3:O");
auto pairs3 = parseNumberStringPairs("1:Ca 1:Mg 2:C 6:O");
auto pairs4 = parseNumberStringPairs("3:Fe 2:Al 3:Si 12:O");
auto pairs5 = parseNumberStringPairs("1:Na+ 1:Cl-");
auto pairs6 = parseNumberStringPairs("1:Ca++ 1:CO3--");
auto parseNumberStringPairs(const String &str) -> Pairs< String, double >
Parse a formatted string containing pairs of numbers and strings.

◆ parseChemicalFormula()

auto Reaktoro::parseChemicalFormula ( const String formula) -> Pairs< String, double >

Return the element symbols and their coefficients in a chemical formula.

Successfully parsing a chemical formula requires that the first letter in the formula is uppercase and all others in lowercase. Thus, even chemical formulas such as AaBbb or (Aa2Bbb4)Cc6 are supported. There are two ways for specifying electric charge in a chemical formula:

  1. as a suffix containing as many symbols + and - as there are charges (e.g., Fe+++, Ca++, CO3--); or
  2. as a suffix containing the symbol + or - followed by the number of charges (e.g., Fe+3, Ca+2, Na+) Note that number 1 is optional for the second format (e.g., Na+ and Na+1 are equivalent). In both formats, (1) and (2), the symbol + is used for positively charged substances, and - for negatively charged ones. See below several examples of parsing different chemical formulas:
    using namespace Reaktoro;
    auto formula01 = parseChemicalFormula("H2O");
    auto formula02 = parseChemicalFormula("CaCl2");
    auto formula03 = parseChemicalFormula("MgCO3");
    auto formula04 = parseChemicalFormula("(CaMg)(CO3)2");
    auto formula05 = parseChemicalFormula("Fe3Al2Si3O12");
    auto formula06 = parseChemicalFormula("Na+");
    auto formula07 = parseChemicalFormula("Ca++");
    auto formula08 = parseChemicalFormula("Fe+++");
    auto formula09 = parseChemicalFormula("Fe+3");
    auto formula10 = parseChemicalFormula("CO3--");
    auto formula11 = parseChemicalFormula("CO3-2");
    auto parseChemicalFormula(const String &formula) -> Pairs< String, double >
    Return the element symbols and their coefficients in a chemical formula.

◆ parseElectricCharge()

auto Reaktoro::parseElectricCharge ( const String formula) -> double

Return the electric charge in a chemical formula.

using namespace Reaktoro;
auto charge01 = parseElectricCharge("H2O"); \\ charge01 === 0
auto charge02 = parseElectricCharge("CaCl2"); \\ charge02 === 0
auto charge03 = parseElectricCharge("MgCO3"); \\ charge03 === 0
auto charge04 = parseElectricCharge("(CaMg)(CO3)2"); \\ charge04 === 0
auto charge05 = parseElectricCharge("Fe3Al2Si3O12"); \\ charge05 === 0
auto charge06 = parseElectricCharge("Na+"); \\ charge06 === 1
auto charge07 = parseElectricCharge("Ca++"); \\ charge07 === 2
auto charge08 = parseElectricCharge("Fe+++"); \\ charge08 === 3
auto charge09 = parseElectricCharge("Fe+3"); \\ charge09 === 3
auto charge10 = parseElectricCharge("CO3--"); \\ charge10 === -2
auto charge11 = parseElectricCharge("CO3-2"); \\ charge11 === -2
auto parseElectricCharge(const String &formula) -> double
Return the electric charge in a chemical formula.
See also
parseChemicalFormula

◆ parseReactionEquation()

auto Reaktoro::parseReactionEquation ( const String equation) -> Pairs< String, double >

Parse a formatted string representing a reaction equation.

Below are examples of formatted strings representing reaction equations.

auto pairs1 = parseReactionEquation("Calcite + H+ = Ca++ + HCO3-");
auto pairs2 = parseReactionEquation("CO2(g) + H2O(l) = H+ + HCO3-");
auto pairs3 = parseReactionEquation("Dolomite + 2*H+ = Ca++ + Mg++ + 2*HCO3-");
auto parseReactionEquation(const String &equation) -> Pairs< String, double >
Parse a formatted string representing a reaction equation.

Note that unity stoichiometric coefficients can be ommited from the equation. The operator * must be used when this is not the case.

Returns
The species names and their stoichiometric coefficients

◆ time()

auto Reaktoro::time ( ) -> Time

Return the time point now.

See also
elapsed

◆ elapsed() [1/2]

auto Reaktoro::elapsed ( const Time &  end,
const Time &  begin 
) -> double

Return the elapsed time between two time points (in units of s)

Parameters
endThe end time point
beginThe begin time point
Returns
The elapsed time between end and begin in seconds

◆ elapsed() [2/2]

auto Reaktoro::elapsed ( const Time &  begin) -> double

Return the elapsed time between a time point and now (in units of s)

Parameters
beginThe begin time point
Returns
The elapsed time between now and begin in seconds

◆ asFunction()

constexpr auto Reaktoro::asFunction ( const Fun &  f)
constexpr

Convert lambda/function pointers/member functions to std::function.

This exists in Reaktoro because AppleClang 9.0/10.0/11.0 do not perform template type deduction for std::function. Instead of just writting std::function(f), we need to use instead asFunction(f).

◆ parseAggregateState()

auto Reaktoro::parseAggregateState ( const std::string &  symbol) -> AggregateState

Return the AggregateState value from given aggregate state symbol.

The following table maps a symbol to an aggregate state value.

Symbol AggregateState
g AggregateState::Gas
l AggregateState::Liquid
s AggregateState::Solid
pl AggregateState::Plasma
cd AggregateState::CondensedPhase
fl AggregateState::Fluid
lc AggregateState::LiquidCrystal
cr AggregateState::CrystallineSolid
am AggregateState::AmorphousSolid
vit AggregateState::Vitreous
ads AggregateState::Adsorbed
mon AggregateState::Monomeric
pol AggregateState::Polymeric
ss AggregateState::SolidSolution
ex AggregateState::IonExchange
aq AggregateState::Aqueous
Note
symbol can also be a string containing the aggregate state name. For example, symbol can be "Gas", "Aqueous", "Solid", etc.

AggregateState::Undefined is returned if symbol is none of above.

◆ identifyAggregateState()

auto Reaktoro::identifyAggregateState ( const std::string &  name) -> AggregateState

Identify the aggregate state in the name of a substance or chemical species.

This methods searches for aggregate state symbols in the suffix of a substance or chemical species name. The suffix must start with (, end with ) and cannot contain upper case characters. The words within the suffix must be separated by comma and/or space. Example:

using namespace Reaktoro;
const auto res = identifyAggregateState("H2O(aq)"); // res is AggregateState::Aqueous
const auto res = identifyAggregateState("CO2(g)"); // res is AggregateState::Gas
const auto res = identifyAggregateState("CaCO3(s, calcite)"); // res is AggregateState::Solid
const auto res = identifyAggregateState("MgCO3(magnesite, s)"); // res is AggregateState::Solid
const auto res = identifyAggregateState("Fe+++"); // res is AggregateState::Aqueous
const auto res = identifyAggregateState("Na+(pl)"); // res is AggregateState::Plasma
auto identifyAggregateState(const std::string &name) -> AggregateState
Identify the aggregate state in the name of a substance or chemical species.
Note
By default, charged species without explicit aggregate state identification is considered aqueous. Thus species names such as HCO3-, Ca++, H+ will produce AggregateState::Aqueous.
See also
AggregateState, parseAggregateState

◆ derivativeForward() [1/2]

auto Reaktoro::derivativeForward ( const ScalarFunction f,
VectorXdConstRef  x 
) -> VectorXd

Calculate the partial derivatives of a scalar function using a 1st-order forward finite difference scheme.

Parameters
fThe scalar function as an instance of ScalarFunction
xThe point where the derivative is calculated
Returns
The partial derivatives of the scalar function

◆ derivativeBackward() [1/2]

auto Reaktoro::derivativeBackward ( const ScalarFunction f,
VectorXdConstRef  x 
) -> VectorXd

Calculate the partial derivatives of a scalar function using a 1st-order backward finite difference scheme.

Parameters
fThe scalar function as an instance of ScalarFunction
xThe point where the derivative is calculated
Returns
The partial derivatives of the scalar function

◆ derivativeCentral() [1/2]

auto Reaktoro::derivativeCentral ( const ScalarFunction f,
VectorXdConstRef  x 
) -> VectorXd

Calculate the partial derivatives of a scalar function using a 2nd-order central finite difference scheme.

Parameters
fThe scalar function as an instance of ScalarFunction
xThe point where the derivative is calculated
Returns
The partial derivatives of the scalar function

◆ derivativeForward() [2/2]

auto Reaktoro::derivativeForward ( const VectorFunction f,
VectorXdConstRef  x 
) -> MatrixXd

Calculate the partial derivatives of a vector function using a 1st-order forward finite difference scheme.

Parameters
fThe scalar function as an instance of ScalarFunction
xThe point where the derivative is calculated
Returns
The partial derivatives of the scalar function

◆ derivativeBackward() [2/2]

auto Reaktoro::derivativeBackward ( const VectorFunction f,
VectorXdConstRef  x 
) -> MatrixXd

Calculate the partial derivatives of a vector function using a 1st-order backward finite difference scheme.

Parameters
fThe scalar function as an instance of ScalarFunction
xThe point where the derivative is calculated
Returns
The partial derivatives of the scalar function

◆ derivativeCentral() [2/2]

auto Reaktoro::derivativeCentral ( const VectorFunction f,
VectorXdConstRef  x 
) -> MatrixXd

Calculate the partial derivatives of a vector function using a 2nd-order central finite difference scheme.

Parameters
fThe scalar function as an instance of ScalarFunction
xThe point where the derivative is calculated
Returns
The partial derivatives of the scalar function

◆ linearlyIndependentCols() [1/2]

auto Reaktoro::linearlyIndependentCols ( MatrixXdConstRef  A) -> Indices

Determine the set of linearly independent columns in a matrix using a column pivoting QR algorithm.

Parameters
AThe matrix whose linearly independent columns must be found
Returns
The indices of the linearly independent columns

◆ linearlyIndependentRows() [1/2]

auto Reaktoro::linearlyIndependentRows ( MatrixXdConstRef  A) -> Indices

Determine the set of linearly independent rows in a matrix.

Parameters
AThe matrix whose linearly independent rows must be found
Returns
The indices of the linearly independent rows

◆ linearlyIndependentCols() [2/2]

auto Reaktoro::linearlyIndependentCols ( MatrixXdConstRef  A,
MatrixXdRef  B 
) -> Indices

Determine the set of linearly independent columns in a matrix.

Parameters
[in]AThe matrix whose linearly independent columns must be found
[out]BThe matrix composed by linearly independent columns only
Returns
The indices of the linearly independent columns

◆ linearlyIndependentRows() [2/2]

auto Reaktoro::linearlyIndependentRows ( MatrixXdConstRef  A,
MatrixXdRef  B 
) -> Indices

Determine the set of linearly independent rows in a matrix.

Parameters
[in]AThe matrix whose linearly independent rows must be found
[out]BThe matrix composed by linearly independent rows only
Returns
The indices of the linearly independent rows

◆ inverseShermanMorrison()

auto Reaktoro::inverseShermanMorrison ( MatrixXdConstRef  invA,
VectorXdConstRef  D 
) -> MatrixXd

Calculate the inverse of A + D where inv(A) is already known and D is a diagonal matrix.

Parameters
invAThe inverse of the matrix A and the final inverse of A + D
DThe diagonal matrix D

◆ rationalize()

auto Reaktoro::rationalize ( double  x,
unsigned  maxden 
) -> std::tuple< long, long >

Calculates the rational number that approximates a given real number.

The algorithm is based on Farey sequence as shown here.

Parameters
xThe real number.
maxdenThe maximum denominator.
Returns
A tuple containing the numerator and denominator.

◆ cleanRationalNumbers() [1/2]

auto Reaktoro::cleanRationalNumbers ( double *  vals,
long  size,
long  maxden = 6 
) -> void

Clean an array that is known to have rational numbers from round-off errors.

Parameters
[in,out]valsThe values to be cleaned
sizeThe size of the data in vals
maxdenThe maximum known denominator in the array with rational numbers

◆ cleanRationalNumbers() [2/2]

auto Reaktoro::cleanRationalNumbers ( MatrixXdRef  A,
long  maxden = 6 
) -> void

Clean a matrix that is known to have rational numbers from round-off errors.

Parameters
[in,out]AThe matrix to be cleaned
maxdenThe maximum known denominator in the matrix with rational numbers

◆ cardano()

auto Reaktoro::cardano ( const T &  b,
const T &  c,
const T &  d 
) -> CubicRoots<T>

Calculate the roots of a cubic equation using Cardano's method.

The calculation uses the approach presented in:

Nickalls, R. W. D. (2012). A New Approach to Solving the Cubic: Cardan’s Solution Revealed. The Mathematical Gazette, 77(480), 354–359* to solve the cubic equation: \( x^{3}+bx^{2}+cx+d=0 \).

Parameters
bThe coefficient b of the cubic equation
cThe coefficient c of the cubic equation
dThe coefficient d of the cubic equation
Returns
The three roots \( (r_1, r_2, r_3) \) that solve the cubic equation. No ordering is performed on the roots!

◆ newton()

auto Reaktoro::newton ( const std::function< std::tuple< T, T >(const T &)> &  f,
const T &  x0,
const T &  epsilon,
std::size_t  maxiter 
) -> std::tuple<T, std::size_t, bool>

Calculate the root of a non-linear function using Newton's method.

Parameters
fThe function that returns a pair of \( f(x) \) and \( f^{\prime}(x) \).
x0The initial guess for the iterative root calculation.
epsilonThe tolerance used in \( |f(x)| < \epsilon \) to check convergence.
maxiterThe maximum number of iterations.
Returns
A tuple containing the root, the number of iterations, and a boolean flag indicating success if true.

◆ realRoots()

auto Reaktoro::realRoots ( const CubicRoots< T > &  roots) -> std::vector<T>

Return all real roots of a group of roots.

Parameters
rootsCubicRoots with of complex and real roots
Returns
A vector with all real roots

◆ ReactionThermoModelConstLgK()

auto Reaktoro::ReactionThermoModelConstLgK ( const ReactionThermoModelParamsConstLgK params) -> ReactionThermoModel

Return a function that calculates thermodynamic properties of a reaction using a constant model for \(\lg K(T)\).

In this model, the equilibrium constant of the reaction remains constant:

\[\lg K(T)=\lg K_{\mathrm{r}},\]

where \(\lg K_{\mathrm{r}}\) is a given equilibrium constant at a reference temperature and pressure.

The standard Gibbs energy of the reaction is computed using:

\[\Delta G^{\circ}(T,P)=-RT\ln K_{\mathrm{r}}+\Delta V^{\circ}(P-P_{\mathrm{r}})\]

while the standard enthalpy of the reaction is:

\[\Delta H^{\circ}(T,P)=\Delta V^{\circ}(P-P_{\mathrm{r}}).\]

Note that a pressure correction is introduced above, where \(\Delta V^{\circ}\) is the change of standard molar volume of the reaction at \(T\) and \(P\), with \(P_{\mathrm{r}}\) denoting a given reference pressure.

◆ ReactionThermoModelGemsLgK()

auto Reaktoro::ReactionThermoModelGemsLgK ( const ReactionThermoModelParamsGemsLgK params) -> ReactionThermoModel

Return a function that calculates thermodynamic properties of a reaction using GEM-Selektor's expression for \(\lg K(T)\).

In this model, the equilibrium constant of the reaction is computed at a given temperature with:

\[\log_{10}K=A_{0}+A_{1}T+A_{2}T^{-1}+A_{3}\ln T+A_{4}T^{-2}+A_{5}T^{2}+A_{6}T^{-0.5},\]

where \(A_i\) are given coefficients. From this model, we can calculate the standard Gibbs energy of reaction using:

\[\Delta G^{\circ}=-RT\left(A_{0}+A_{1}T+A_{2}T^{-1}+A_{3}\ln T+A_{4}T^{-2}+A_{5}T^{2}+A_{6}T^{-0.5}\right)\ln_{10}\]

and the standard enthalpy of reaction using:

\[\Delta H^{\circ}=R\left(A_{1}T^{2}-A_{2}+A_{3}T-2A_{4}T^{-1}+2A_{5}T^{3}-0.5A_{6}T^{0.5}\right)\ln_{10},\]

considering that:

\[\Delta G^{\circ}=-RT\ln K\]

and

\[\Delta H^{\circ}\equiv T^{2}\frac{\partial}{\partial T}\left(-\frac{\Delta G^{\circ}}{T}\right)=RT^{2}\frac{\partial\ln K}{\partial T}.\]

Reference:

  • Kulik, D., Wagner T. (2010) Part 3. Temperature corrections of standard molar (partial molal) thermodynamic properties of substances and reactions using data in ReacDC records of GEM-Selektor.
  • Haas, J.L., Fisher, J.R. (1976). Simultaneous evaluation and correlation of thermodynamic data. In American Journal of Science (Vol. 276, Issue 4, pp. 525–545). https://doi.org/10.2475/ajs.276.4.525

◆ ReactionThermoModelPhreeqcLgK()

auto Reaktoro::ReactionThermoModelPhreeqcLgK ( const ReactionThermoModelParamsPhreeqcLgK params) -> ReactionThermoModel

Return a function that calculates thermodynamic properties of a reaction using PHREEQC's analytical expression.

In this model, the equilibrium constant of the reaction is computed at a given temperature with:

\[\log_{10}K=A_{1}+A_{2}T+A_{3}T^{-1}+A_{4}\log_{10}T+A_{5}T^{-2}+A_{6}T^{2},\]

where \(A_i\) are given coefficients. From this model, we can calculate the standard Gibbs energy of reaction using:

\[\Delta G^{\circ}=-RT\left(A_{1}+A_{2}T+A_{3}T^{-1}+A_{4}\log_{10}T+A_{5}T^{-2}+A_{6}T^{2}\right)\ln_{10}+\Delta V^{\circ}(P-P_{\mathrm{r}})\]

and the standard enthalpy of reaction using:

\[\Delta H^{\circ}=R\left(A_{2}T^{2}-A_{3}+\frac{A_{4}}{\ln10}T-2A_{5}T^{-1}+2A_{6}T^{3}\right)\ln_{10}+\Delta V^{\circ}(P-P_{\mathrm{r}}),\]

considering that:

\[\Delta G^{\circ}=-RT\ln K+\Delta V^{\circ}(P-P_{\mathrm{r}})\]

and

\[\Delta H^{\circ}\equiv T^{2}\frac{\partial}{\partial T}\left(-\frac{\Delta G^{\circ}}{T}\right)=RT^{2}\frac{\partial\ln K}{\partial T}+\Delta V^{\circ}(P-P_{\mathrm{r}}).\]

Reference:

  • Parkhurst, D.L., Appelo, C.A.J. (2013). Description of input and examples for PHREEQC version 3—A computer program for speciation, batch-reaction, one-dimensional transport, and inverse geochemical calculations. In Groundwater Book 6, Modeling Techniques (p. 497). U.S. Geological Survey Techniques and Methods. http://pubs.usgs.gov/tm/06/a43

◆ ReactionThermoModelPressureCorrection()

auto Reaktoro::ReactionThermoModelPressureCorrection ( Param  Pr) -> ReactionThermoModel

Return a function that calculates pressure correction for standard Gibbs energy and enthalpy a reaction.

In this model, the standard Gibbs energy and enthalpy of reaction are computed using:

\[\Delta G^{\circ}=\Delta G_{\mathrm{base}}^{\circ}+\Delta V^{\circ}(P-P_{r})\]

\[\Delta H^{\circ}=\Delta H_{\mathrm{base}}^{\circ}+\Delta V^{\circ}(P-P_{r})\]

where \(\Delta G_{\mathrm{base}}^{\circ}\) and \(\Delta H_{\mathrm{base}}^{\circ}\) denote standard properties computed using a given base thermodynamic model function of the reaction.

Parameters
PrThe reference pressure for the pressure correction (in Pa).

◆ ReactionThermoModelVantHoff()

auto Reaktoro::ReactionThermoModelVantHoff ( const ReactionThermoModelParamsVantHoff params) -> ReactionThermoModel

Return a function that calculates thermodynamic properties of a reaction using van't Hoff's model.

In this model, the equilibrium constant of the reaction is computed at a given temperature with:

\[\ln K=\ln K_{\mathrm{r}}-\frac{\Delta H_{\mathrm{r}}^{\circ}}{R}\left(\frac{1}{T}-\frac{1}{T_{\mathrm{r}}}\right),\]

where \(\ln K_{\mathrm{r}}\) and \(\Delta H_{\mathrm{r}}^{\circ}\) are the equilibrium constant and enthalpy of reaction at reference temperature \(T_\mathrm{r}\). From this model, we can calculate the standard Gibbs energy of reaction using:

\[\Delta G^{\circ}=-RT\ln K_{\mathrm{r}}+\Delta V^{\circ}(P-P_{\mathrm{r}})\]

while the standard enthalpy of reaction is:

\[\Delta H^{\circ}=\Delta H_{\mathrm{r}}^{\circ}+\Delta V^{\circ}(P-P_{\mathrm{r}}).\]

Note that a pressure correction is introduced above, where \(\Delta V^{\circ}\) is the change of standard molar volume of the reaction at \(T\) and \(P\), with \(P_{\mathrm{r}}\) denoting a given reference pressure.

◆ ActivityModelSpycherPruessEnnis()

auto Reaktoro::ActivityModelSpycherPruessEnnis ( ) -> ActivityModelGenerator

Return the activity model for gaseous phases formulated in Spycher et al.

(2003). This is an activity model for a gaseous phase supporting only the gases H22O(g) and CO2(g).

References:

  • Spycher, N., Pruess, K., Ennis-King, J. (2003). CO2-H2O mixtures in the geological sequestration of CO2. I. Assessment and calculation of mutual solubilities from 12 to 100C and up to 600 bar. Geochimica et Cosmochimica Acta, 67(16), 3015-3031.

◆ ActivityModelSpycherReed()

auto Reaktoro::ActivityModelSpycherReed ( ) -> ActivityModelGenerator

Return the activity model for gaseous phases formulated in Spycher and Reed (1988).

This is an activity model for a gaseous phase supporting only the gases H22O(g), CO2(g), and CH4(g).

References:

  • Spycher, N., Reed, M. (1988). Fugacity coefficients of H2, CO2, CH4, H2O and of H2O–CO2–CH4 mixtures: A virial equation treatment for moderate pressures and temperatures applicable to calculations of hydrothermal boiling. Geochimica et Cosmochimica Acta, 52(3), 739-749.

◆ ActivityModelIdealSolution()

auto Reaktoro::ActivityModelIdealSolution ( StateOfMatter  stateofmatter) -> ActivityModelGenerator

Return the activity model for an ideal solution.

Parameters
stateofmatterThe state of matter of the solution

◆ ActivityModelRedlichKister()

auto Reaktoro::ActivityModelRedlichKister ( real  a0,
real  a1,
real  a2 
) -> ActivityModelGenerator

Return the activity model for a binary solid solution phase based on Redlich-Kister model.

The Redlich-Kister model calculates the activity coefficient of the end-members in a solid solution using the equations:

\[\ln\gamma_{1}=x_{2}^{2}[a_{0}+a_{1}(3x_{1}-x_{2})+a_{2}(x_{1}-x_{2})(5x_{1}-x_{2})]\]

and

\[\ln\gamma_{2}=x_{1}^{2}[a_{0}-a_{1}(3x_{2}-x_{1})+a_{2}(x_{2}-x_{1})(5x_{2}-x_{1})]\]

. The parameters \(a_0\), \(a_1\), and \(a_2\) must be provided. Set them to zero if not needed.

Parameters
a0The Redlich-Kister parameter a0
a1The Redlich-Kister parameter a1
a2The Redlich-Kister parameter a2
Returns
The equation of state function for the mineral phase
See also
ActivityModel

◆ ActivityModelIonExchange()

auto Reaktoro::ActivityModelIonExchange ( ) -> ActivityModelGenerator

Return the activity model for the ion exchange.

See also
Gaines–Thomas ion exchange activity model

◆ ActivityModelIonExchangeGainesThomas()

auto Reaktoro::ActivityModelIonExchangeGainesThomas ( ) -> ActivityModelGenerator

Return the Gaines-Thomas activity model for ion exchange.

See also
Gaines–Thomas ion exchange activity model

◆ waterElectroPropsJohnsonNorton()

auto Reaktoro::waterElectroPropsJohnsonNorton ( real  T,
real  P,
const WaterThermoProps wtp 
) -> WaterElectroProps

Calculate the electrostatic state of water using the model of Johnson and Norton (1991).

Reference:

  • Johnson, J. W., Norton, D. (1991). Critical phenomena in hydrothermal systems; state, thermodynamic, electrostatic, and transport properties of H2O in the critical region. American Journal of Science, 291(6), 541–648. doi

◆ waterHelmholtzPropsHGK()

auto Reaktoro::waterHelmholtzPropsHGK ( real  T,
real  D 
) -> WaterHelmholtzProps

Calculate the Helmholtz free energy state of water using the Haar–Gallagher–Kell (1984) equation of state.

Parameters
TThe temperature of water (in units of K)
DThe density of water (in units of kg/m3)
Returns
The Helmholtz free energy state of water
See also
WaterHelmholtzProps

◆ waterHelmholtzPropsWagnerPruss()

auto Reaktoro::waterHelmholtzPropsWagnerPruss ( real  T,
real  D 
) -> WaterHelmholtzProps

Calculate the Helmholtz free energy state of water using the Wagner and Pruss (1995) equation of state.

Parameters
TThe temperature of water (in units of K)
DThe density of water (in units of kg/m3)
Returns
The Helmholtz free energy state of water
See also
WaterHelmholtzProps

◆ waterThermoPropsHGK()

auto Reaktoro::waterThermoPropsHGK ( real  T,
real  P,
StateOfMatter  stateofmatter 
) -> WaterThermoProps

Calculate the thermodynamic state of water using the Haar-Gallagher-Kell (1984) equation of state.

References:

  • Haar, L., Gallagher, J. S., Kell, G. S. (1984). NBS/NRC Steam Tables: Thermodynamic and Transport Properties and Computer Program for Vapor and Liquid States of Water in SI Units. New York: Hemisphere Publishing Corporation.
    Parameters
    TThe temperature of water (in units of K)
    PThe pressure of water (in units of Pa)
    stateofmatterThe state of matter of water
    Returns
    The thermodynamic state of water
    See also
    WaterThermoProps

◆ waterThermoPropsHGKMemoized()

auto Reaktoro::waterThermoPropsHGKMemoized ( real  T,
real  P,
StateOfMatter  stateofmatter 
) -> WaterThermoProps

Calculate the thermodynamic state of water using the Haar-Gallagher-Kell (1984) equation of state.

Note
This function will skip the computation if given arguments are the same as in its last invocation. The cached result will be returned, thus improving performance.

◆ waterThermoPropsWagnerPruss()

auto Reaktoro::waterThermoPropsWagnerPruss ( real  T,
real  P,
StateOfMatter  stateofmatter 
) -> WaterThermoProps

Calculate the thermodynamic state of water using the Wagner and Pruss (1995) equation of state.

References:

  • Wagner, W., Pruss, A. (1999). The IAPWS Formulation 1995 for the Thermodynamic Properties of Ordinary Water Substance for General and Scientific Use. Journal of Physical and Chemical Reference Data, 31(2), 387. doi
    Parameters
    TThe temperature of water (in units of K)
    PThe pressure of water (in units of Pa)
    stateofmatterThe state of matter of water
    Returns
    The thermodynamic state of water
    See also
    WaterThermoProps

◆ waterThermoPropsWagnerPrussMemoized()

auto Reaktoro::waterThermoPropsWagnerPrussMemoized ( real  T,
real  P,
StateOfMatter  stateofmatter 
) -> WaterThermoProps

Calculate the thermodynamic state of water using the Wagner and Pruss (1995) equation of state.

Note
This function will skip the computation if given arguments are the same as in its last invocation. The cached result will be returned, thus improving performance.

◆ waterThermoProps()

auto Reaktoro::waterThermoProps ( real  T,
real  P,
const WaterHelmholtzProps whp 
) -> WaterThermoProps

Calculate the thermodynamic state of water.

This is a general method that uses the Helmholtz free energy state of water, as an instance of WaterHelmholtzProps, to completely resolve its thermodynamic state.

Parameters
TThe temperature of water (in units of K)
PThe pressure of water (in units of Pa)
whpThe Helmholtz free energy state of water
Returns
The thermodynamic state of water
See also
WaterHelmholtzProps, WaterThermoProps

◆ waterDensityHGK()

auto Reaktoro::waterDensityHGK ( real  T,
real  P,
StateOfMatter  stateofmatter 
) -> real

Calculate the density of water using the Haar–Gallagher–Kell (1984) equation of state.

Parameters
TThe temperature of water (in units of K)
PThe pressure of water (in units of Pa)
stateofmatterThe state of matter of water
Returns
The density of liquid water (in units of kg/m3)

◆ waterDensityWagnerPruss()

auto Reaktoro::waterDensityWagnerPruss ( real  T,
real  P,
StateOfMatter  stateofmatter 
) -> real

Calculate the density of water using the Wagner and Pruss (1995) equation of state.

Parameters
TThe temperature of water (in units of K)
PThe pressure of water (in units of Pa)
stateofmatterThe state of matter of water
Returns
The density of liquid water (in units of kg/m3)

◆ waterLiquidDensityHGK()

auto Reaktoro::waterLiquidDensityHGK ( real  T,
real  P 
) -> real

Calculate the density of liquid water using the Haar–Gallagher–Kell (1984) equation of state.

Parameters
TThe temperature of water (in units of K)
PThe pressure of water (in units of Pa)
Returns
The density of liquid water (in units of kg/m3)

◆ waterLiquidDensityWagnerPruss()

auto Reaktoro::waterLiquidDensityWagnerPruss ( real  T,
real  P 
) -> real

Calculate the density of liquid water using the Wagner and Pruss (1995) equation of state.

Parameters
TThe temperature of water (in units of K)
PThe pressure of water (in units of Pa)
Returns
The density of liquid water (in units of kg/m3)

◆ waterVaporDensityHGK()

auto Reaktoro::waterVaporDensityHGK ( real  T,
real  P 
) -> real

Calculate the density of vapor water using the Haar–Gallagher–Kell (1984) equation of state.

Parameters
TThe temperature of water (in units of K)
PThe pressure of water (in units of Pa)
Returns
The density of water (in units of kg/m3)

◆ waterVaporDensityWagnerPruss()

auto Reaktoro::waterVaporDensityWagnerPruss ( real  T,
real  P 
) -> real

Calculate the density of vapor water using the Wagner and Pruss (1995) equation of state.

Parameters
TThe temperature of water (in units of K)
PThe pressure of water (in units of Pa)
Returns
The density of water (in units of kg/m3)

◆ waterPressureHGK()

auto Reaktoro::waterPressureHGK ( real  T,
real  D 
) -> real

Calculate the pressure of water using the Haar–Gallagher–Kell (1984) equation of state.

Parameters
TThe temperature of water (in units of K)
DThe density of water (in units of kg/m3)
Returns
The pressure of water (in units of Pa)

◆ waterPressureWagnerPruss()

auto Reaktoro::waterPressureWagnerPruss ( real  T,
real  D 
) -> real

Calculate the pressure of water using the Wagner and Pruss (1995) equation of state.

Parameters
TThe temperature of water (in units of K)
DThe density of water (in units of kg/m3)
Returns
The pressure of water (in units of Pa)

◆ waterSaturatedPressureWagnerPruss()

auto Reaktoro::waterSaturatedPressureWagnerPruss ( real  T) -> real

Calculate the saturated pressure of water using the Wagner and Pruss (1995) equation of state.

Parameters
TThe temperature of water (in units of K)
Returns
The saturated pressure of water (in units of Pa)

◆ waterSaturatedLiquidDensityWagnerPruss()

auto Reaktoro::waterSaturatedLiquidDensityWagnerPruss ( real  T) -> real

Calculate the saturated liquid-density of water using the Wagner and Pruss (1995) equation of state.

Parameters
TThe temperature of water (in units of K)
Returns
The saturated liquid-density of water (in units of kg/m3)

◆ waterSaturatedVapourDensityWagnerPruss()

auto Reaktoro::waterSaturatedVapourDensityWagnerPruss ( real  T) -> real

Calculate the saturated vapour-density of water using the Wagner and Pruss (1995) equation of state.

Parameters
TThe temperature of water (in units of K)
Returns
The saturated vapour-density of water (in units of kg/m3)