a unified framework for modeling chemically reactive systems

Overview

Reaktoro

Linux Build OSX Build Windows Build

Reaktoro is a unified framework for modeling chemically reactive systems. It provides methods for chemical equilibrium and kinetic calculations for multiphase systems. Reaktoro is mainly developed in C++ for performance reasons. A Python interface is available for a more convenient and simpler use. Currently, Reaktoro can interface with two widely used geochemical software: PHREEQC and GEMS.

Quick example

Here is a simple C++ code using Reaktoro to perform a multiphase chemical equilibrium calculation:

#include <Reaktoro/Reaktoro.hpp>

using namespace Reaktoro;

int main()
{
    ChemicalEditor editor;
    editor.addAqueousPhase("H2O NaCl CaCO3 CO2");
    editor.addGaseousPhase("CO2(g)");
    editor.addMineralPhase("Calcite");

    ChemicalSystem system(editor);

    EquilibriumProblem problem(system);
    problem.add("H2O", 1, "kg");
    problem.add("CO2", 1, "mol");
    problem.add("NaCl", 0.7, "mol");
    problem.add("CaCO3", 1, "g");

    ChemicalState state = equilibrate(problem);

    state.output("result.txt");
}

This calculation could also be performed using Reaktoro's Python interface:

from reaktoro import *

editor = ChemicalEditor()
editor.addAqueousPhase("H2O NaCl CaCO3 CO2")
editor.addGaseousPhase("CO2(g)")
editor.addMineralPhase("Calcite")

system = ChemicalSystem(editor)

problem = EquilibriumProblem(system)
problem.add("H2O", 1, "kg")
problem.add("CO2", 1, "mol")
problem.add("NaCl", 0.7, "mol")
problem.add("CaCO3", 1, "g")

state = equilibrate(problem)

state.output("result.txt")

Installation and Tutorials

For installation instructions, tutorials, and list of publications related to this project, please access reaktoro.org. This web site describes how to download and install Reaktoro, and demonstrate some basic usage.

FAQ

How do I ask a question about Reaktoro?

If you have questions about using or installing Reaktoro, please go to Reaktoro's GitHub Issues and let us know. Please select the question label on the right side of the issue pages. We'll do our best to answer your question as soon as possible.

How can I report a bug?

You got a bug and this is frustrating, we understand you. But don't worry — we'll be happy to fix it for you (provided it is indeed a bug!).

Before you report a bug, please check first if someone else has already reported the same issue. If not, go to Reaktoro's GitHub Issues and enter a descriptive title and write your issue with enough details. Please select the label bug on the right side of the page.

Please provide a Minimum Reproducible Example? Please provide such an example so that we can be more efficient in identifying the bug and fixing it for you.

Have you heard about Markdown? Please use Markdown syntax when reporting your issues.

How can I contribute to Reaktoro?

First, thanks for your interest in contributing to Reaktoro! You can do so in many ways, from reporting bugs and writing tutorials to helping us with code development. You might also consider financially supporting Reaktoro's development by helping us extending the development team if you plan to make Reaktoro an essential software component in your company or academic group.

Read more on how to contribute to Reaktoro here.

Contributors

You can see the list of awesome people who has contributed code to Reaktoro in the contributors page.

We would love to have you as a contributor too, see CONTRIBUTING for more information.

Developing Quick-Start

In order to start developing, you'll need to build Reaktoro from sources. There are two ways: install the dependencies manually, as described here, or using Conda. Conda is a tool for managing packages, dependencies and environments for multiple languages, including Python and C++, and supporting multiple platforms: Windows, Linux and macOS. In order to start developing Reaktoro using Conda, these are the steps:

  1. Install Miniconda, pick the 64-bit installer that uses the latest Python version from: conda.io/miniconda.html.
  2. Add conda-forge as a channel: conda config --append channels conda-forge
  3. Install conda-devenv: conda install -n base conda-devenv
  4. Create an environment for Reaktoro, from the repository root directory: conda devenv
  5. Activate the environment: source activate reaktoro from Linux/macOS or activate reaktoro from Windows
  6. Create a build directory and call cmake from it (for now check the .travis.yml file for an example on CMake parameters), OR, on Windows, call the inv msvc task to generate a project under build\msvc directory, open it in the IDE and build the INSTALL project. (inv is short for invoke, from the Invoke tool.)

License

LGPL v2.1

Copyright (C) 2014-2018 Allan Leal

Reaktoro is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

Reaktoro is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

Comments
  • Implement class GeochemicalState

    Implement class GeochemicalState

    Currently, we have class ChemicalState, which stores temperature, pressure, and amounts of species distributed among one or more phases. This class should be general (i.e., applicable to any chemical system). However, it currently has some hard coded geochemical concepts in it (e.g., when printing a ChemicalState object, there is a section for aqueous phase, showing pH, pe, ionic strength, etc). This should be stripped from ChemicalState, otherwise those interested in chemical systems without water/aqueous phase will experience runtime errors when printing a ChemicalState object.

    If the application of interest is related to geochemical modeling, then one has to convert a ChemicalState object into a GeochemicalState one:

    state = equilibrate(problem)  # type(state) is ChemicalState
    state = GeochemicalState(state)  # type(state) is now GeochemicalState
    
    state.output()  # this will now output in a format that (most) geochemists are happy with
    

    To address issue #57, we should also have a member method that converts the state into a dictionary so that it can be nicely printed in a Jupyter notebook using pandas.

    Foreseen steps to accomplish this task:

    • [ ] implement GeochemicalState class
    • [ ] implement a conversion method from a GeochemicalState object to a dictionary
    • [ ] implement methods pH, pe, Eh, ionicStrength, alkalinity, saturationIndex, etc.
    • [ ] species should be printed in sections of chemical elements
    • [ ] species with higher amounts should be higher in the column
    • [ ] species with relatively low amounts should be filtered out from the output
    • [ ] phases that are not close to saturation with respect to the aqueous phase should be left out (possibly displayed in another section for completeness)

    Printing could follow the following suggestion of @martinvoigt (#58):

    pH, sometimes also alkalinity Concentrations of elements and species of interest in the aqueous solution Saturation states of solids/gases of interest (with respect to the aqueous solution) How much of a phase reacted, in case this was part of the model Temperature, pressure, ionic strength, charge balance, masses of phases, etc. - mainly to verify the model ran correctly, if something seems off

    enhancement proposal 
    opened by allanleal 25
  • Add pre commit and formatters

    Add pre commit and formatters

    Hi, @allanleal and reaktoro's contributors!

    This PR aims to include pre-commit, providing several git hooks for a proper standardization while developing reaktoro. The PR is based on #16.

    Following the issue, the below modifications are submitted:

    • pre-commit is included in environment.devenv.yaml. In order to use it, all developers must have pre-commit installed, then run in the console:
    $ pre-commit install
    

    After that, git hooks are settled (and will be performed before every commit), but the developer can run the following command, just to guarantee that everything is according to the formatters:

    $ pre-commit run --all-files
    

    If the developer wants to check just one of the new hooks, the developer can execute:

    $ pre-commit run <id> --all-files
    

    The id means the hook id, one can find all the available ids inside .pre-commit-config.yaml. For example, if you want to run just black in all files, you can do $ pre-commit run black --all-files.

    • The main modifications are the files .pre-commit-config.yaml, pyproject.toml (this one provides additional configurations to black formatter) and environment.devenv.yaml (which includes pre-commit and black). All the modifications which are not in these files were done by the formatters. Please note that the diff is huge!

    • The following hooks are added:

      • trailing-whitespace
      • end-of-file-fixer
      • black
      • blacken-docs

    Information about the hooks can be found here. I need help to configure clang-format. I never did it before and I have been struggling with it.

    opened by volpatto 14
  • Fix return policy for the python binding of method ChemicalState::properties

    Fix return policy for the python binding of method ChemicalState::properties

    Consider the following code:

    from reaktoro import *
    
    editor = ChemicalEditor()
    editor.addAqueousPhase("H O C")
    
    system = ChemicalSystem(editor)
    
    problem = EquilibriumProblem(system)
    problem.add("H2O", 1.0, "kg")
    problem.add("CO2", 1.0, "mmol")
    
    state = equilibrate(problem)
    
    properties = state.properties()
    
    print(state.properties().lnActivities().val - properties.lnActivities().val)
    

    This should print:

    [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
    

    but instead it prints:

    [49.9775413  0.         0.         0.         0.         0.
      0.         0.         0.         0.         0.       ]
    

    The reason is that state.properties() returns a ChemicalProperties object that does not live long enough and a subsequent call to lnActivities() does not return correct properties. method.

    By keeping this retured ChemicalProperties instance alive as long as the instance of ChemicalState, this resource leakage problem is fixed.

    opened by allanleal 13
  • gems/node.h isn't found by the compiler

    gems/node.h isn't found by the compiler

    Offending line: https://github.com/reaktoro/reaktoro/blob/master/Reaktoro/Interfaces/Gems.cpp#L28

    Error:

    /usr/ports/science/reaktoro/work/reaktoro-1.2.2/Reaktoro/Interfaces/Gems.cpp:28:10: fatal error: 'gems/node.h' file not found
    #include <gems/node.h>
             ^~~~~~~~~~~~~
    1 error generated.
    

    clang-10 FreeBSD 12.2

    opened by yurivict 11
  • Issue Regarding Equilibrium Calculations

    Issue Regarding Equilibrium Calculations

    Hey Allan, hope you are doing great!

    I have encountered an issue while performing equilibrium calculations.

    I want to calculate the equilibrium state of a system consists of Quartz, Kaolinite, Calcite, K-Feldspar, and H2O. Here is my code:

    #include <Reaktoro/Reaktoro.hpp>
    using namespace Reaktoro;
    
    int main()
    {	
    	
    	std::string theElements = "H O Cl C Ca F Al Si K";
    	Reaktoro::ChemicalEditor editorInit;
    	editorInit.addAqueousPhaseWithElements(theElements);
    	editorInit.addMineralPhaseWithElements(theElements);
    	Reaktoro::ChemicalSystem systemInit(editorInit);
    	int numberOfAqueousSpeciesInit = systemInit.numSpeciesInPhase (0);
    	
    	///////////////////////////////////////////////////////////////////
    	
    	Reaktoro::ChemicalEditor editor;
    	editor.addAqueousPhaseWithElements(theElements);
    	
    	int c = 0;
    	for(auto species : systemInit.species()){
    		if (c >=numberOfAqueousSpeciesInit){
    			editor.addMineralPhase(species.name());
    		}
    		c++;
    	}
    	
    	Reaktoro::ChemicalSystem system(editor);
    	
    	Reaktoro::EquilibriumProblem problemInternal(system);
    	problemInternal.add("H2O", 1, "g");
    	problemInternal.add("Calcite",10,"g");
    	problemInternal.add("Kaolinite", 10, "g");
    	problemInternal.add("Quartz", 10, "g");
    	problemInternal.add("K-Feldspar", 10, "g");
    	Reaktoro::ChemicalState state = Reaktoro::equilibrate(problemInternal);
    	state.output("res");
        
    }
    

    The reason I've added F and Cl to the system is that I'm simulating reactive flow in porous media injecting HF and HCl.

    However, the strange thing is, after performing calculations, no amount of K-Feldspar is left, and some Muscovite is formed, although no F is present in the system:

    ===================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
    Temperature [K]          Temperature [C]          Pressure [Pa]            Pressure [bar]           
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    298.15                   25                       100000                   1                        
    ===================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
    Element                  Amount [mol]             Aqueous [mol]            Amorphous-Silica [mol]   Andalusite [mol]         Anorthite [mol]          Aragonite [mol]          Boehmite [mol]           Ca-Al-Pyroxene [mol]     Calcite [mol]            Chalcedony [mol]         Clinozoisite [mol]       Coesite [mol]            Corundum [mol]           Cristobalite [mol]       Cristobalite,alpha [mol] Cristobalite,beta [mol]  Diaspore [mol]           Fluorite [mol]           Gehlenite [mol]          Gibbsite [mol]           Graphite [mol]           Grossular [mol]          K-Feldspar [mol]         Kalsilite [mol]          Kaolinite [mol]          Kyanite [mol]            Laumontite [mol]         Lawsonite [mol]          Lime [mol]               Margarite [mol]          Microcline,maximum [mol] Muscovite [mol]          Potassium-Oxide [mol]    Prehnite [mol]           Pyrophyllite [mol]       Quartz [mol]             Sanidine,high [mol]      Sillimanite [mol]        Sylvite [mol]            Wairakite [mol]          Wollastonite [mol]       Zoisite [mol]            Dual Potential [kJ/mol]  
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Al                       0.1134                   1.19637e-09              0                        1.69151e-21              1.76813e-21              0                        2.30799e-21              8.42387e-22              0                        0                        3.91137e-21              0                        1.45889e-21              0                        0                        0                        4.18687e-21              0                        5.50452e-22              1.75865e-20              0                        1.91074e-21              4.58297e-21              1.05334e-21              0.00561423               1.78556e-21              2.2864e-07               1.58544e-20              0                        3.78342e-21              4.58297e-21              0.107785                 0                        2.12352e-20              5.33481e-21              0                        2.02296e-21              1.57966e-21              0                        1.96989e-21              0                        3.85956e-21              -755.276                 
    C                        0.0999132                4.10165e-07              0                        0                        0                        3.00754e-20              0                        0                        0.0999128                0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        6.83152e-23              0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        -362.871                 
    Ca                       0.0999132                2.95846e-07              0                        0                        8.84066e-22              3.00754e-20              0                        4.21193e-22              0.0999128                0                        2.60758e-21              0                        0                        0                        0                        0                        0                        1e-20                    5.50452e-22              0                        0                        2.86611e-21              0                        0                        0                        0                        1.1432e-07               7.92719e-21              2.45078e-22              9.45854e-22              0                        0                        0                        2.12352e-20              0                        0                        0                        0                        0                        9.84945e-22              1.49526e-21              2.57304e-21              -674.612                 
    Cl                       1.3e-19                  1.2e-19                  0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        1e-20                    0                        0                        0                        0                        
    F                        1.3e-19                  1.1e-19                  0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        2e-20                    0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        
    H                        0.265959                 0.182873                 0                        0                        0                        0                        2.30799e-21              0                        0                        0                        1.30379e-21              0                        0                        0                        0                        0                        4.18687e-21              0                        0                        5.27595e-20              0                        0                        0                        0                        0.0112285                0                        9.14559e-07              3.17088e-20              0                        1.89171e-21              0                        0.0718567                0                        2.12352e-20              5.33481e-21              0                        0                        0                        0                        3.93978e-21              0                        1.28652e-21              -103.308                 
    K                        0.0359284                1.84508e-09              0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        4.58297e-21              1.05334e-21              0                        0                        0                        0                        0                        0                        4.58297e-21              0.0359284                1.12367e-22              0                        0                        0                        2.02296e-21              0                        1e-20                    0                        0                        0                        -366.531                 
    O                        1.32416                  0.0914382                6.75581e-21              4.22877e-21              7.07253e-21              9.02261e-20              4.61598e-21              2.52716e-21              0.299738                 3.20262e-20              1.69493e-20              1.07237e-20              2.18833e-21              1.57786e-20              1.57786e-20              8.73872e-21              8.37374e-21              0                        1.92658e-21              5.27595e-20              0                        1.14644e-20              3.66638e-20              4.21338e-21              0.025264                 4.4639e-21               1.82912e-06              7.92719e-20              2.45078e-22              1.13502e-20              3.66638e-20              0.43114                  5.61836e-23              1.27411e-19              3.20088e-20              0.476578                 1.61837e-20              3.94916e-21              0                        1.37892e-20              4.48579e-21              1.67248e-20              -30.565                  
    Si                       0.351689                 2.59867e-07              3.37791e-21              8.45754e-22              1.76813e-21              0                        0                        4.21193e-22              0                        1.60131e-20              3.91137e-21              5.36185e-21              0                        7.88928e-21              7.88928e-21              4.36936e-21              0                        0                        2.75226e-22              0                        0                        2.86611e-21              1.37489e-20              1.05334e-21              0.00561423               8.92779e-22              4.5728e-07               1.58544e-20              0                        1.89171e-21              1.37489e-20              0.107785                 0                        3.18528e-20              1.06696e-20              0.238289                 6.06889e-21              7.89832e-22              0                        3.93978e-21              1.49526e-21              3.85956e-21              -795.109                 
    Z                        1.18938e-18              1.18938e-18              0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        50.0363                  
    ===================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
    Species                  Amount [mol]             Mole Fraction [mol/mol]  Activity Coefficient [-] Activity [-]             Potential [kJ/mol]       Dual Potential [kJ/mol]  
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Al+++                    1.39899e-21              1.53e-20                 0.788022                 6.69257e-19              -587.448                 17.7196                  
    AlO+                     1.87693e-16              2.05269e-15              0.973813                 1.10959e-13              -735.805                 0.000132075              
    AlO2-                    1.19421e-09              1.30604e-08              0.973779                 7.05963e-07              -866.443                 2.07581e-11              
    AlOH++                   2.91911e-20              3.19247e-19              0.899449                 1.59392e-17              -788.228                 0.849217                 
    CO(aq)                   1.50464e-22              1.64555e-21              1.00012                  9.13541e-20              -228.682                 164.754                  
    CO2(aq)                  3.58712e-10              3.92304e-09              1.00007                  2.17779e-07              -424.001                 6.91071e-11              
    CO3--                    3.91695e-08              4.28376e-07              0.899546                 2.13901e-05              -554.638                 6.32879e-13              
    Ca(HCO3)+                6.17728e-10              6.75575e-09              0.973813                 3.65185e-07              -1182.45                 4.01302e-11              
    Ca(HSiO3)+               1.50051e-10              1.64103e-09              0.973813                 8.87065e-08              -1614.69                 1.65207e-10              
    Ca++                     2.83416e-07              3.09956e-06              0.89947                  0.000154757              -574.54                  8.74671e-14              
    CaCO3(aq)                1.15792e-08              1.26636e-07              1.00012                  7.0303e-06               -1129.18                 2.14087e-12              
    CaCl+                    1e-20                    1.09365e-19              0.973813                 5.91175e-18              -780.75                  0                        
    CaCl2(aq)                1e-20                    1.09365e-19              1.00012                  6.07148e-18              -909.969                 0                        
    CaF+                     1e-20                    1.09365e-19              0.973813                 5.91175e-18              -936.771                 0                        
    CaOH+                    8.26968e-11              9.0441e-10               0.973813                 4.88883e-08              -758.449                 2.99765e-10              
    Cl-                      1e-20                    1.09365e-19              0.973779                 5.91154e-18              -229.629                 0                        
    ClO-                     1e-20                    1.09365e-19              0.973779                 5.91154e-18              -135.158                 0                        
    ClO2-                    1e-20                    1.09365e-19              0.973779                 5.91154e-18              -81.1849                 0                        
    ClO3-                    1e-20                    1.09365e-19              0.973779                 5.91154e-18              -106.289                 0                        
    ClO4-                    1e-20                    1.09365e-19              0.974018                 5.913e-18                -106.874                 0                        
    F-                       1e-20                    1.09365e-19              0.973759                 5.91142e-18              -380.09                  0                        
    H+                       7.85921e-13              8.59519e-12              0.97392                  4.64668e-10              -53.272                  3.15421e-08              
    H2(aq)                   2.12745e-22              2.32668e-21              1.00012                  1.29168e-19              -90.0943                 116.522                  
    H2O(l)                   0.0914363                0.999989                 1                        0.999991                 -237.182                 2.71113e-19              
    H2O2(aq)                 8.45057e-22              9.24193e-21              1.00012                  5.13075e-19              -238.412                 29.3348                  
    HAlO2(aq)                2.16176e-12              2.3642e-11               1.00012                  1.31251e-09              -919.715                 1.14673e-08              
    HCO3-                    3.5844e-07               3.92007e-06              0.973807                 0.0002119                -607.91                  6.91595e-14              
    HCl(aq)                  1e-20                    1.09365e-19              1.00012                  6.07148e-18              -225.509                 0                        
    HClO(aq)                 1e-20                    1.09365e-19              1.00012                  6.07148e-18              -178.188                 0                        
    HClO2(aq)                1e-20                    1.09365e-19              1.00012                  6.07148e-18              -92.4155                 0                        
    HF(aq)                   1e-20                    1.09365e-19              1.00012                  6.07148e-18              -398.107                 0                        
    HF2-                     1e-20                    1.09365e-19              0.973779                 5.91154e-18              -676.401                 0                        
    HO2-                     5.92896e-22              6.48418e-21              0.973779                 3.50493e-19              -172.664                 41.811                   
    HSiO3-                   9.47375e-08              1.03609e-06              0.973779                 5.60045e-05              -1040.15                 2.61666e-13              
    K+                       1.84506e-09              2.01784e-08              0.973808                 1.09075e-06              -316.495                 1.34356e-11              
    KCl(aq)                  1e-20                    1.09365e-19              1.00012                  6.07148e-18              -497.552                 0                        
    KOH(aq)                  1.40832e-14              1.54021e-13              1.00012                  8.55061e-12              -500.404                 1.76022e-06              
    O2(aq)                   4.06437e-17              4.44497e-16              1.00012                  2.46767e-14              -61.1294                 0.000609925              
    OH-                      3.6817e-08               4.02647e-07              0.973759                 2.17641e-05              -183.91                  6.73319e-13              
    SiF6--                   1e-20                    1.09365e-19              0.899605                 5.46126e-18              -2298.06                 0                        
    SiO2(aq)                 1.64979e-07              1.80429e-06              1.00012                  0.000100167              -856.239                 1.50259e-13              
    Amorphous-Silica         3.37791e-21              1                        1                        1                        -848.9                   7.33874                  
    Andalusite               8.45754e-22              1                        1                        1                        -2429.18                 29.3106                  
    Anorthite                8.84066e-22              1                        1                        1                        -3991.86                 28.0404                  
    Aragonite                3.00754e-20              1                        1                        1                        -1128.35                 0.824248                 
    Boehmite                 2.30799e-21              1                        1                        1                        -908.974                 10.7408                  
    Ca-Al-Pyroxene           4.21193e-22              1                        1                        1                        -3104.81                 58.8556                  
    Calcite                  0.0999128                1                        1                        1                        -1129.18                 2.48112e-19              
    Chalcedony               1.60131e-20              1                        1                        1                        -854.691                 1.54808                  
    Clinozoisite             1.30379e-21              1                        1                        1                        -6482.02                 19.0135                  
    Coesite                  5.36185e-21              1                        1                        1                        -851.616                 4.62332                  
    Corundum                 7.29445e-22              1                        1                        1                        -1568.26                 33.9842                  
    Cristobalite             7.88928e-21              1                        1                        1                        -853.097                 3.14218                  
    Cristobalite,alpha       7.88928e-21              1                        1                        1                        -853.097                 3.14218                  
    Cristobalite,beta        4.36936e-21              1                        1                        1                        -850.565                 5.6735                   
    Diaspore                 4.18687e-21              1                        1                        1                        -913.794                 5.92079                  
    Fluorite                 1e-20                    1                        1                        1                        -1173.58                 0                        
    Gehlenite                2.75226e-22              1                        1                        1                        -3778.77                 90.0699                  
    Gibbsite                 1.75865e-20              1                        1                        1                        -1155.49                 1.40958                  
    Graphite                 6.83152e-23              1                        1                        1                        0                        362.871                  
    Grossular                9.55369e-22              1                        1                        1                        -6260.55                 25.9476                  
    **_K-Feldspar_**               4.58297e-21              1                        1                        1                        -3746.24                 5.40906                  
    Kalsilite                1.05334e-21              1                        1                        1                        -2015.64                 23.5341                  
    Kaolinite                0.00280711               1                        1                        1                        -3789.09                 8.83098e-18              
    Kyanite                  8.92779e-22              1                        1                        1                        -2430.72                 27.7667                  
    Laumontite               1.1432e-07               1                        1                        1                        -6681.11                 2.16844e-13              
    Lawsonite                7.92719e-21              1                        1                        1                        -4491.14                 3.12716                  
    Lime                     2.45078e-22              1                        1                        1                        -604.027                 101.15                   
    Margarite                9.45854e-22              1                        1                        1                        -5833.12                 26.2087                  
    Microcline,maximum       4.58297e-21              1                        1                        1                        -3746.24                 5.40906                  
    **_Muscovite_**                0.0359284                1                        1                        1                        -5591.08                 6.89972e-19              
    Potassium-Oxide          5.61836e-23              1                        1                        1                        -322.402                 441.224                  
    Prehnite                 1.06176e-20              1                        1                        1                        -5816.17                 2.33476                  
    Pyrophyllite             2.6674e-21               1                        1                        1                        -5255.09                 9.29352                  
    Quartz                   0.238289                 1                        1                        1                        -856.239                 1.04031e-19              
    Sanidine,high            2.02296e-21              1                        1                        1                        -3739.4                  12.2541                  
    Sillimanite              7.89832e-22              1                        1                        1                        -2427.1                  31.3859                  
    Sylvite                  1e-20                    1                        1                        1                        -408.923                 0                        
    Wairakite                9.84945e-22              1                        1                        1                        -6181.58                 25.1685                  
    Wollastonite             1.49526e-21              1                        1                        1                        -1544.84                 16.5787                  
    Zoisite                  1.28652e-21              1                        1                        1                        -6481.76                 19.2687                  
    ===================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
    Phase                    Amount [mol]             Stability                Stability Index [-]      Mass [kg]                Volume [m3]              Density [kg/m3]          Molar Volume [m3/mol]    Volume Fraction [m3/m3]  
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Aqueous                  0.0914373                stable                   -4.82164e-17             0.00164731               1.65214e-06              997.075                  1.80685e-05              0.102723                 
    Amorphous-Silica         3.37791e-21              under stable             -1.28569                 2.02959e-22              9.79593e-26              2071.87                  2.9e-05                  6.09068e-21              
    Andalusite               8.45754e-22              under stable             -5.135                   1.37051e-22              4.35817e-26              3144.68                  5.153e-05                2.70972e-21              
    Anorthite                8.84066e-22              under stable             -4.91247                 2.45954e-22              8.9105e-26               2760.27                  0.00010079               5.54016e-21              
    Aragonite                3.00754e-20              under stable             -0.144402                3.01015e-21              1.02707e-24              2930.8                   3.415e-05                6.38589e-20              
    Boehmite                 2.30799e-21              under stable             -1.8817                  1.38452e-22              4.50866e-26              3070.81                  1.9535e-05               2.80329e-21              
    Ca-Al-Pyroxene           4.21193e-22              under stable             -10.311                  9.18719e-23              2.67458e-26              3435.01                  6.35e-05                 1.66293e-21              
    Calcite                  0.0999128                stable                   -4.34674e-20             0.00999996               3.69018e-06              2709.89                  3.6934e-05               0.229439                 
    Chalcedony               1.60131e-20              under stable             -0.271212                9.62136e-22              3.63305e-25              2648.29                  2.2688e-05               2.25887e-20              
    Clinozoisite             1.30379e-21              under stable             -3.33102                 5.92386e-22              1.77576e-25              3335.96                  0.0001362                1.10409e-20              
    Coesite                  5.36185e-21              under stable             -0.809971                3.22163e-22              1.10674e-25              2910.92                  2.0641e-05               6.88122e-21              
    Corundum                 7.29445e-22              under stable             -5.95377                 7.43751e-23              1.86556e-26              3986.76                  2.5575e-05               1.15992e-21              
    Cristobalite             7.88928e-21              under stable             -0.550487                4.74022e-22              2.0307e-25               2334.28                  2.574e-05                1.2626e-20               
    Cristobalite,alpha       7.88928e-21              under stable             -0.550487                4.74022e-22              2.0307e-25               2334.28                  2.574e-05                1.2626e-20               
    Cristobalite,beta        4.36936e-21              under stable             -0.993955                2.6253e-22               1.19633e-25              2194.46                  2.738e-05                7.43825e-21              
    Diaspore                 4.18687e-21              under stable             -1.03728                 2.51163e-22              7.43588e-26              3377.72                  1.776e-05                4.6233e-21               
    Fluorite                 1e-20                    stable                    -0                      7.80748e-22              2.4542e-25               3181.27                  2.4542e-05               1.52591e-20              
    Gehlenite                2.75226e-22              under stable             -15.7796                 7.5467e-23               2.48364e-26              3038.57                  9.024e-05                1.54422e-21              
    Gibbsite                 1.75865e-20              under stable             -0.246948                1.37181e-21              5.61994e-25              2440.97                  3.1956e-05               3.49423e-20              
    Graphite                 6.83152e-23              under stable             -63.5722                 8.20513e-25              3.61934e-28              2267.03                  5.298e-06                2.25034e-23              
    Grossular                9.55369e-22              under stable             -4.54583                 4.30343e-22              1.19708e-25              3594.94                  0.0001253                7.4429e-21               
    K-Feldspar               4.58297e-21              under stable             -0.947626                1.27559e-21              4.98948e-25              2556.55                  0.00010887               3.10224e-20              
    Kalsilite                1.05334e-21              under stable             -4.123                   1.666e-22                6.30848e-26              2640.89                  5.989e-05                3.92233e-21              
    Kaolinite                0.00280711               stable                   -1.54712e-18             0.000724686              2.79364e-07              2594.06                  9.952e-05                0.0173696                
    Kyanite                  8.92779e-22              under stable             -4.86452                 1.44671e-22              3.93626e-26              3675.34                  4.409e-05                2.44739e-21              
    Laumontite               1.1432e-07               stable                   -3.79894e-14             5.37803e-08              2.37271e-11              2266.62                  0.00020755               1.47525e-06              
    Lawsonite                7.92719e-21              under stable             -0.547854                2.49102e-21              8.03183e-25              3101.44                  0.00010132               4.99384e-20              
    Lime                     2.45078e-22              under stable             -17.7207                 1.37433e-23              4.10848e-27              3345.11                  1.6764e-05               2.55447e-22              
    Margarite                9.45854e-22              under stable             -4.59156                 3.76624e-22              1.22394e-25              3077.15                  0.0001294                7.60989e-21              
    Microcline,maximum       4.58297e-21              under stable             -0.947626                1.27559e-21              4.98357e-25              2559.58                  0.000108741              3.09856e-20              
    Muscovite                0.0359284                stable                   -1.20878e-19             0.0143106                5.05548e-06              2830.7                   0.00014071               0.314327                 
    Potassium-Oxide          5.61836e-23              under stable             -77.2992                 5.29227e-24              2.26869e-27              2332.74                  4.038e-05                1.41057e-22              
    Prehnite                 1.06176e-20              under stable             -0.409032                4.37853e-21              1.48997e-24              2938.67                  0.00014033               9.26397e-20              
    Pyrophyllite             2.6674e-21               under stable             -1.62815                 9.61102e-22              3.37693e-25              2846.08                  0.0001266                2.09963e-20              
    Quartz                   0.238289                 stable                   -1.82255e-20             0.0143174                5.4063e-06               2648.29                  2.2688e-05               0.33614                  
    Sanidine,high            2.02296e-21              under stable             -2.14682                 5.63055e-22              2.20519e-25              2553.31                  0.000109008              1.37109e-20              
    Sillimanite              7.89832e-22              under stable             -5.49857                 1.27989e-22              3.94126e-26              3247.41                  4.99e-05                 2.4505e-21               
    Sylvite                  1e-20                    stable                    -0                      7.45513e-22              3.7524e-25               1986.76                  3.7524e-05               2.33308e-20              
    Wairakite                9.84945e-22              under stable             -4.40933                 4.27867e-22              1.84057e-25              2324.65                  0.00018687               1.14438e-20              
    Wollastonite             1.49526e-21              under stable             -2.90447                 1.73692e-22              5.97059e-26              2909.13                  3.993e-05                3.71225e-21              
    Zoisite                  1.28652e-21              under stable             -3.37573                 5.8454e-22               1.74838e-25              3343.32                  0.0001359                1.08707e-20              
    ===================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
    Ionic Strength [molal]   pH                       pE                       Reduction Potential [V]  Alkalinity [eq/L]        
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    0.000541577              9.33286                  8.76601                  0.518592                 0.00034309               
    ===================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
    

    But if I add all the minerals that can potentially be formed manually, except for Muscovite, we can see the amount of residual K-Feldspar:

    ==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
    Temperature [K]          Temperature [C]          Pressure [Pa]            Pressure [bar]           
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    298.15                   25                       100000                   1                        
    ==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
    Element                  Amount [mol]             Aqueous [mol]            Amorphous-Silica [mol]   Andalusite [mol]         Anorthite [mol]          Aragonite [mol]          Boehmite [mol]           Ca-Al-Pyroxene [mol]     Calcite [mol]            Chalcedony [mol]         Clinozoisite [mol]       Coesite [mol]            Corundum [mol]           Cristobalite [mol]       Cristobalite,alpha [mol] Cristobalite,beta [mol]  Diaspore [mol]           Fluorite [mol]           Gehlenite [mol]          Gibbsite [mol]           Graphite [mol]           Grossular [mol]          K-Feldspar [mol]         Kalsilite [mol]          Kaolinite [mol]          Kyanite [mol]            Laumontite [mol]         Lawsonite [mol]          Lime [mol]               Margarite [mol]          Microcline,maximum [mol] Potassium-Oxide [mol]    Prehnite [mol]           Pyrophyllite [mol]       Quartz [mol]             Sanidine,high [mol]      Sillimanite [mol]        Sylvite [mol]            Wairakite [mol]          Wollastonite [mol]       Zoisite [mol]            Dual Potential [kJ/mol]  
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Al                       0.1134                   7.32198e-10              0                        1.69151e-21              1.76813e-21              0                        2.30799e-21              8.42387e-22              0                        0                        3.91137e-21              0                        1.45889e-21              0                        0                        0                        4.18687e-21              0                        5.50452e-22              1.75865e-20              0                        1.91074e-21              0.0179642                1.36769e-21              0.0774711                1.78556e-21              1.48645e-07              1.58544e-20              0                        3.78342e-21              0.0179642                0                        2.12352e-20              5.33481e-21              0                        3.62155e-21              1.57966e-21              0                        1.96989e-21              0                        3.85956e-21              -756.932                 
    C                        0.0999132                2.51162e-07              0                        0                        0                        3.00754e-20              0                        0                        0.0999129                0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        6.79021e-23              0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        -365.078                 
    Ca                       0.0999132                1.7684e-07               0                        0                        8.84066e-22              3.00754e-20              0                        4.21193e-22              0.0999129                0                        2.60758e-21              0                        0                        0                        0                        0                        0                        1e-20                    5.50452e-22              0                        0                        2.86611e-21              0                        0                        0                        0                        7.43224e-08              7.92719e-21              2.45078e-22              9.45854e-22              0                        0                        2.12352e-20              0                        0                        0                        0                        0                        9.84945e-22              1.49526e-21              2.57304e-21              -675.716                 
    Cl                       1.3e-19                  1.2e-19                  0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        1e-20                    0                        0                        0                        0                        
    F                        1.3e-19                  1.1e-19                  0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        2e-20                    0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        
    H                        0.265959                 0.111017                 0                        0                        0                        0                        2.30799e-21              0                        0                        0                        1.30379e-21              0                        0                        0                        0                        0                        4.18687e-21              0                        0                        5.27594e-20              0                        0                        0                        0                        0.154942                 0                        5.94579e-07              3.17088e-20              0                        1.89171e-21              0                        0                        2.12352e-20              5.33481e-21              0                        0                        0                        0                        3.93978e-21              0                        1.28652e-21              -103.86                  
    K                        0.0359284                9.84839e-09              0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0.0179642                1.36769e-21              0                        0                        0                        0                        0                        0                        0.0179642                1.15191e-22              0                        0                        0                        3.62155e-21              0                        1e-20                    0                        0                        0                        -361.674                 
    O                        1.32416                  0.0555093                6.75581e-21              4.22877e-21              7.07253e-21              9.02261e-20              4.61598e-21              2.52716e-21              0.299739                 3.20262e-20              1.69493e-20              1.07237e-20              2.18833e-21              1.57786e-20              1.57786e-20              8.73872e-21              8.37374e-21              0                        1.92658e-21              5.27594e-20              0                        1.14644e-20              0.143713                 5.47077e-21              0.34862                  4.4639e-21               1.18916e-06              7.92719e-20              2.45078e-22              1.13502e-20              0.143713                 5.75957e-23              1.27411e-19              3.20088e-20              0.332865                 2.89724e-20              3.94916e-21              0                        1.37892e-20              4.48579e-21              1.67248e-20              -29.4613                 
    Si                       0.351689                 1.58226e-07              3.37791e-21              8.45754e-22              1.76813e-21              0                        0                        4.21193e-22              0                        1.60131e-20              3.91137e-21              5.36185e-21              0                        7.88928e-21              7.88928e-21              4.36936e-21              0                        0                        2.75226e-22              0                        0                        2.86611e-21              0.0538925                1.36769e-21              0.0774711                8.92779e-22              2.97289e-07              1.58544e-20              0                        1.89171e-21              0.0538925                0                        3.18528e-20              1.06696e-20              0.166433                 1.08646e-20              7.89832e-22              0                        3.93978e-21              1.49526e-21              3.85956e-21              -797.316                 
    Z                        2.39013e-17              2.39013e-17              0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        0                        50.5681                  
    ==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
    Species                  Amount [mol]             Mole Fraction [mol/mol]  Activity Coefficient [-] Activity [-]             Potential [kJ/mol]       Dual Potential [kJ/mol]  
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Al+++                    1.31427e-21              2.36767e-20              0.78788                  1.03549e-18              -586.366                 18.8619                  
    AlO+                     1.13028e-16              2.03623e-15              0.973793                 1.10067e-13              -735.825                 0.000219322              
    AlO2-                    7.30886e-10              1.3167e-08               0.973759                 7.11711e-07              -866.423                 3.39171e-11              
    AlOH++                   2.02733e-20              3.65226e-19              0.899377                 1.82334e-17              -787.895                 1.22277                  
    CO(aq)                   1.48387e-22              2.67322e-21              1.00012                  1.48406e-19              -227.479                 167.06                   
    CO2(aq)                  2.17763e-10              3.92304e-09              1.00007                  2.17779e-07              -424.001                 1.13838e-10              
    CO3--                    2.41693e-08              4.35415e-07              0.899474                 2.17398e-05              -554.598                 1.02566e-12              
    Ca(HCO3)+                3.71982e-10              6.70132e-09              0.973793                 3.62236e-07              -1182.47                 6.66419e-11              
    Ca(HSiO3)+               9.03575e-11              1.62781e-09              0.973793                 8.799e-08                -1614.71                 2.7435e-10               
    Ca++                     1.69299e-07              3.04994e-06              0.899398                 0.000152268              -574.58                  1.46425e-13              
    CaCO3(aq)                7.02938e-09              1.26636e-07              1.00012                  7.0303e-06               -1129.18                 3.52657e-12              
    CaCl+                    1e-20                    1.80152e-19              0.973793                 9.73799e-18              -779.512                 0                        
    CaCl2(aq)                1e-20                    1.80152e-19              1.00012                  1.00013e-17              -908.732                 0                        
    CaF+                     1e-20                    1.80152e-19              0.973793                 9.73799e-18              -935.534                 0                        
    CaOH+                    4.97982e-11              8.97123e-10              0.973793                 4.84934e-08              -758.469                 4.97801e-10              
    Cl-                      1e-20                    1.80152e-19              0.973759                 9.73765e-18              -228.392                 0                        
    ClO-                     1e-20                    1.80152e-19              0.973759                 9.73765e-18              -133.921                 0                        
    ClO2-                    1e-20                    1.80152e-19              0.973759                 9.73765e-18              -79.9477                 0                        
    ClO3-                    1e-20                    1.80152e-19              0.973759                 9.73765e-18              -105.052                 0                        
    ClO4-                    1e-20                    1.80152e-19              0.973999                 9.74005e-18              -105.637                 0                        
    F-                       1e-20                    1.80152e-19              0.973739                 9.73745e-18              -378.853                 0                        
    H+                       4.73264e-13              8.52594e-12              0.9739                   4.60915e-10              -53.2921                 5.238e-08                
    H2(aq)                   2.0864e-22               3.75868e-21              1.00012                  2.08667e-19              -88.9053                 118.815                  
    H2O(l)                   0.0555081                0.999989                 1                        0.999991                 -237.182                 4.46593e-19              
    H2O2(aq)                 8.41523e-22              1.51602e-20              1.00012                  8.41634e-19              -237.185                 29.458                   
    HAlO2(aq)                1.31234e-12              2.3642e-11               1.00012                  1.31251e-09              -919.715                 1.88897e-08              
    HCO3-                    2.19374e-07              3.95206e-06              0.973787                 0.000213625              -607.89                  1.13001e-13              
    HCl(aq)                  1e-20                    1.80152e-19              1.00012                  1.00013e-17              -224.271                 0                        
    HClO(aq)                 1e-20                    1.80152e-19              1.00012                  1.00013e-17              -176.95                  0                        
    HClO2(aq)                1e-20                    1.80152e-19              1.00012                  1.00013e-17              -91.1782                 0                        
    HF(aq)                   1e-20                    1.80152e-19              1.00012                  1.00013e-17              -396.87                  0                        
    HF2-                     1e-20                    1.80152e-19              0.973759                 9.73765e-18              -675.163                 0                        
    HO2-                     5.91381e-22              1.06538e-20              0.973759                 5.75866e-19              -171.433                 41.9181                  
    HSiO3-                   5.79816e-08              1.04455e-06              0.973759                 5.64605e-05              -1040.13                 4.27542e-13              
    K+                       9.84831e-09              1.77419e-07              0.973788                 9.59023e-06              -311.106                 2.51714e-12              
    KCl(aq)                  1e-20                    1.80152e-19              1.00012                  1.00013e-17              -496.315                 0                        
    KOH(aq)                  7.57819e-14              1.36523e-12              1.00012                  7.57919e-11              -494.995                 3.27117e-07              
    O2(aq)                   6.01055e-17              1.08281e-15              1.00012                  6.01133e-14              -58.9222                 0.000412435              
    OH-                      2.25329e-08              4.05934e-07              0.973739                 2.19413e-05              -183.89                  1.10015e-12              
    SiF6--                   1e-20                    1.80152e-19              0.899533                 8.99539e-18              -2296.83                 0                        
    SiO2(aq)                 1.00154e-07              1.80429e-06              1.00012                  0.000100167              -856.239                 2.47515e-13              
    Amorphous-Silica         3.37791e-21              1                        1                        1                        -848.9                   7.33874                  
    Andalusite               8.45754e-22              1                        1                        1                        -2429.18                 29.3106                  
    Anorthite                8.84066e-22              1                        1                        1                        -3991.86                 28.0404                  
    Aragonite                3.00754e-20              1                        1                        1                        -1128.35                 0.824248                 
    Boehmite                 2.30799e-21              1                        1                        1                        -908.974                 10.7408                  
    Ca-Al-Pyroxene           4.21193e-22              1                        1                        1                        -3104.81                 58.8556                  
    Calcite                  0.0999129                1                        1                        1                        -1129.18                 2.48112e-19              
    Chalcedony               1.60131e-20              1                        1                        1                        -854.691                 1.54808                  
    Clinozoisite             1.30379e-21              1                        1                        1                        -6482.02                 19.0135                  
    Coesite                  5.36185e-21              1                        1                        1                        -851.616                 4.62332                  
    Corundum                 7.29445e-22              1                        1                        1                        -1568.26                 33.9842                  
    Cristobalite             7.88928e-21              1                        1                        1                        -853.097                 3.14218                  
    Cristobalite,alpha       7.88928e-21              1                        1                        1                        -853.097                 3.14218                  
    Cristobalite,beta        4.36936e-21              1                        1                        1                        -850.565                 5.6735                   
    Diaspore                 4.18687e-21              1                        1                        1                        -913.794                 5.92079                  
    Fluorite                 1e-20                    1                        1                        1                        -1173.58                 0                        
    Gehlenite                2.75226e-22              1                        1                        1                        -3778.77                 90.0699                  
    Gibbsite                 1.75865e-20              1                        1                        1                        -1155.49                 1.40958                  
    Graphite                 6.79021e-23              1                        1                        1                        0                        365.078                  
    Grossular                9.55369e-22              1                        1                        1                        -6260.55                 25.9476                  
    **_K-Feldspar_**               0.0179642                1                        1                        1                        -3746.24                 1.37994e-18              
    Kalsilite                1.36769e-21              1                        1                        1                        -2015.64                 18.1251                  
    Kaolinite                0.0387355                1                        1                        1                        -3789.09                 6.3997e-19               
    Kyanite                  8.92779e-22              1                        1                        1                        -2430.72                 27.7667                  
    Laumontite               7.43224e-08              1                        1                        1                        -6681.11                 3.33541e-13              
    Lawsonite                7.92719e-21              1                        1                        1                        -4491.14                 3.12716                  
    Lime                     2.45078e-22              1                        1                        1                        -604.027                 101.15                   
    Margarite                9.45854e-22              1                        1                        1                        -5833.12                 26.2087                  
    Microcline,maximum       0.0179642                1                        1                        1                        -3746.24                 1.37994e-18              
    Potassium-Oxide          5.75957e-23              1                        1                        1                        -322.402                 430.406                  
    Prehnite                 1.06176e-20              1                        1                        1                        -5816.17                 2.33476                  
    Pyrophyllite             2.6674e-21               1                        1                        1                        -5255.09                 9.29352                  
    Quartz                   0.166433                 1                        1                        1                        -856.239                 1.48947e-19              
    Sanidine,high            3.62155e-21              1                        1                        1                        -3739.4                  6.84502                  
    Sillimanite              7.89832e-22              1                        1                        1                        -2427.1                  31.3859                  
    Sylvite                  1e-20                    1                        1                        1                        -408.923                 0                        
    Wairakite                9.84945e-22              1                        1                        1                        -6181.58                 25.1685                  
    Wollastonite             1.49526e-21              1                        1                        1                        -1544.84                 16.5787                  
    Zoisite                  1.28652e-21              1                        1                        1                        -6481.76                 19.2687                  
    ==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
    Phase                    Amount [mol]             Stability                Stability Index [-]      Mass [kg]                Volume [m3]              Density [kg/m3]          Molar Volume [m3/mol]    Volume Fraction [m3/m3]  
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Aqueous                  0.0555087                stable                   -4.82164e-17             0.00100003               1.00296e-06              997.076                  1.80685e-05              0.061784                 
    Amorphous-Silica         3.37791e-21              under stable             -1.28569                 2.02959e-22              9.79593e-26              2071.87                  2.9e-05                  6.03445e-21              
    Andalusite               8.45754e-22              under stable             -5.135                   1.37051e-22              4.35817e-26              3144.68                  5.153e-05                2.6847e-21               
    Anorthite                8.84066e-22              under stable             -4.91247                 2.45954e-22              8.9105e-26               2760.27                  0.00010079               5.48901e-21              
    Aragonite                3.00754e-20              under stable             -0.144402                3.01015e-21              1.02707e-24              2930.8                   3.415e-05                6.32694e-20              
    Boehmite                 2.30799e-21              under stable             -1.8817                  1.38452e-22              4.50866e-26              3070.81                  1.9535e-05               2.77741e-21              
    Ca-Al-Pyroxene           4.21193e-22              under stable             -10.311                  9.18719e-23              2.67458e-26              3435.01                  6.35e-05                 1.64758e-21              
    Calcite                  0.0999129                stable                   -4.34673e-20             0.00999997               3.69018e-06              2709.89                  3.6934e-05               0.227321                 
    Chalcedony               1.60131e-20              under stable             -0.271212                9.62136e-22              3.63305e-25              2648.29                  2.2688e-05               2.23802e-20              
    Clinozoisite             1.30379e-21              under stable             -3.33101                 5.92387e-22              1.77576e-25              3335.96                  0.0001362                1.0939e-20               
    Coesite                  5.36185e-21              under stable             -0.809971                3.22163e-22              1.10674e-25              2910.92                  2.0641e-05               6.8177e-21               
    Corundum                 7.29445e-22              under stable             -5.95377                 7.43751e-23              1.86556e-26              3986.76                  2.5575e-05               1.14921e-21              
    Cristobalite             7.88928e-21              under stable             -0.550487                4.74022e-22              2.0307e-25               2334.28                  2.574e-05                1.25094e-20              
    Cristobalite,alpha       7.88928e-21              under stable             -0.550487                4.74022e-22              2.0307e-25               2334.28                  2.574e-05                1.25094e-20              
    Cristobalite,beta        4.36936e-21              under stable             -0.993955                2.6253e-22               1.19633e-25              2194.46                  2.738e-05                7.36958e-21              
    Diaspore                 4.18687e-21              under stable             -1.03728                 2.51163e-22              7.43588e-26              3377.72                  1.776e-05                4.58062e-21              
    Fluorite                 1e-20                    stable                    -0                      7.80748e-22              2.4542e-25               3181.27                  2.4542e-05               1.51183e-20              
    Gehlenite                2.75226e-22              under stable             -15.7796                 7.5467e-23               2.48364e-26              3038.57                  9.024e-05                1.52996e-21              
    Gibbsite                 1.75865e-20              under stable             -0.246948                1.37181e-21              5.61994e-25              2440.97                  3.1956e-05               3.46197e-20              
    Graphite                 6.79021e-23              under stable             -63.9589                 8.15552e-25              3.59745e-28              2267.03                  5.298e-06                2.21609e-23              
    Grossular                9.55369e-22              under stable             -4.54583                 4.30343e-22              1.19708e-25              3594.94                  0.0001253                7.37419e-21              
    K-Feldspar               0.0179642                stable                   -2.41756e-19             0.005                    1.95576e-06              2556.55                  0.00010887               0.120478                 
    Kalsilite                1.36769e-21              under stable             -3.17538                 2.16318e-22              8.19112e-26              2640.89                  5.989e-05                5.04586e-21              
    Kaolinite                0.0387355                stable                   -1.12118e-19             0.00999998               3.85496e-06              2594.06                  9.952e-05                0.237472                 
    Kyanite                  8.92779e-22              under stable             -4.86452                 1.44671e-22              3.93626e-26              3675.34                  4.409e-05                2.4248e-21               
    Laumontite               7.43224e-08              stable                   -5.84339e-14             3.4964e-08               1.54256e-11              2266.62                  0.00020755               9.50242e-07              
    Lawsonite                7.92719e-21              under stable             -0.547854                2.49102e-21              8.03183e-25              3101.44                  0.00010132               4.94774e-20              
    Lime                     2.45078e-22              under stable             -17.7207                 1.37433e-23              4.10848e-27              3345.11                  1.6764e-05               2.53089e-22              
    Margarite                9.45854e-22              under stable             -4.59156                 3.76624e-22              1.22394e-25              3077.15                  0.0001294                7.53964e-21              
    Microcline,maximum       0.0179642                stable                   -2.41756e-19             0.005                    1.95344e-06              2559.58                  0.000108741              0.120335                 
    Potassium-Oxide          5.75957e-23              under stable             -75.4039                 5.42529e-24              2.32572e-27              2332.74                  4.038e-05                1.43268e-22              
    Prehnite                 1.06176e-20              under stable             -0.409032                4.37854e-21              1.48997e-24              2938.67                  0.00014033               9.17845e-20              
    Pyrophyllite             2.6674e-21               under stable             -1.62815                 9.61102e-22              3.37693e-25              2846.08                  0.0001266                2.08024e-20              
    Quartz                   0.166433                 stable                   -2.60943e-20             0.00999998               3.77602e-06              2648.29                  2.2688e-05               0.232609                 
    Sanidine,high            3.62155e-21              under stable             -1.1992                  1.00799e-21              3.94777e-25              2553.31                  0.000109008              2.43189e-20              
    Sillimanite              7.89832e-22              under stable             -5.49857                 1.27989e-22              3.94126e-26              3247.41                  4.99e-05                 2.42788e-21              
    Sylvite                  1e-20                    stable                    -0                      7.45513e-22              3.7524e-25               1986.76                  3.7524e-05               2.31154e-20              
    Wairakite                9.84945e-22              under stable             -4.40933                 4.27867e-22              1.84057e-25              2324.65                  0.00018687               1.13382e-20              
    Wollastonite             1.49526e-21              under stable             -2.90447                 1.73692e-22              5.97059e-26              2909.13                  3.993e-05                3.67798e-21              
    Zoisite                  1.28652e-21              under stable             -3.37573                 5.8454e-22               1.74838e-25              3343.32                  0.0001359                1.07703e-20              
    ==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
    Ionic Strength [molal]   pH                       pE                       Reduction Potential [V]  Alkalinity [eq/L]        
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    0.000542429              9.33638                  8.85916                  0.524102                 0.000337597              
    ==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
    

    Is there a way to solve this problem? I would be very appreciative if you can help me with this. Best, Mohammad

    opened by mcrossover97 11
  • PyReaktoro with pip

    PyReaktoro with pip

    Hi, @allanleal and contributors!

    This issue is a proposal. What do you all think about put reaktoro's Python bindings inside pip? I know that it can be challenging, since reaktoro has external dependencies that aren't available in PyPI.

    In this regard, I found conda-press, which looks promising. Would it be possible to generate reaktoro's wheels from there? If yes, then would it be possible to put it into PyPI?

    Thanks and congratulations for the nice work here!

    opened by volpatto 10
  • Removing cotire

    Removing cotire

    Removing cotire as it never actually improved the compilation time for Reaktoro. This is most likely due to the heavy dependency on Eigen template library. Cotire also brings some inconvenience - adding a translation unit to the project causes a full recompilation.

    opened by allanleal 10
  • Chemical systems with the same properties delivering different results

    Chemical systems with the same properties delivering different results

    I have ran into a somewhat weird behaviour of Reaktoro due to two apparently identical problems delivering different results.

    I have defined two instances of ChemicalEditors with the exact same species. The only difference is the order of the gaseous species, which I are reversed in one of the editors. I use "H2O(g) CO2(g)" for the first, and "CO2(g) H2O(g)" for the second. The entire setup is done rigorously in the same manner for both problems. It turns out that after equilibrating the chemical states, results slightly differ (absolute error < 1e-11).

    This doesn't seems as much, but in an iterative setup, where systems are solved relying on the chemical state from the previous solution, it may lead to full blown divergence in just a few steps. And actually this was the issue that brought me here.

    I have made this MWE in Reaktoro v1 implementing the description above. I also make an attempt to reduce the absolute errors by using the Exact Hessian evaluation, which indeed bring the errors down, though not to plain zero, which I think would be the actual expected behaviour.

    My guess is that by merely changing the input order of species affects the matrix row indices, which in turn leads to slightly different floating point solutions.

    If this turns out to be an actual problem to other users, I propose that ChemicalEditors always store species in a well-defined order (alphabetically, probably), so as to make the ChemicalSystems independent of input order.

    P.S.: I have worked on the same issue in this other MWE notebook using Reaktoro v2, and verified that the issue also happens, and actually with stronger differences. I am not as profficient in v2 as in v1, so I was not able to work the same Exact Hessian study as for v1.

    opened by hfcpeixoto 9
  • Compilation error:  recompile with -fPIC

    Compilation error: recompile with -fPIC

    [ 42%] Building CXX object Reaktoro/CMakeFiles/Reaktoro.dir/Thermodynamics/Water/WaterThermoPropsUtils.cpp.o [ 42%] Building CXX object Reaktoro/CMakeFiles/Reaktoro.dir/Thermodynamics/Water/WaterUtils.cpp.o [ 42%] Building CXX object Reaktoro/CMakeFiles/Reaktoro.dir/Utils/Material.cpp.o [ 43%] Linking CXX shared library libReaktoro.so /usr/bin/ld: ../databases/libReaktoroDatabases.a(lib.cpp.o): relocation R_X86_64_PC32 against symbol `_ZN4cmrc17ReaktoroDatabases9res_chars27f_af3b_CMakeLists_txt_beginE' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status make[2]: *** [Reaktoro/CMakeFiles/Reaktoro.dir/build.make:2102: Reaktoro/libReaktoro.so] Error 1 make[1]: *** [CMakeFiles/Makefile2:410: Reaktoro/CMakeFiles/Reaktoro.dir/all] Error 2 make: *** [Makefile:156: all] Error 2

    intersting detail, if I look at my environment I can see that CXXFLAGS=-fvisibility-inlines-hidden -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/eme/miniconda3/envs/reaktoro/include -fPIC is in there.

    Do I need to clean something before compiling again? I did remove the build folder before running cmake again

    opened by eric-methorst 9
  • Could not load embedded database file

    Could not load embedded database file

    Hi,

    I am using the supcrt07-organics.xml database to run some DNA and protein calculations, until a couple of months ago I didn't have any problems using the database, only recently after updating my computer and reinstalling everything I started getting this error:

    RuntimeError: ERROR Could not load embedded database file with name /Desktop/SynCell/supcrt07-organics_AABB.xml. The currently supported names are: - supcrt98.xml - supcrt07.xml - supcrt16.xml - supcrtbl.xml

    I'm wondering if I missed anything in the installation process or if the compatibility changed recently, I have also tried using the database names suggested by the error message but won't change much.

    Thanks

    Screenshot 2021-10-15 at 23 51 15
    opened by Edwin-OA 9
  • Installed include/cvode/cvode.h conflicts with sundials that installs cvode

    Installed include/cvode/cvode.h conflicts with sundials that installs cvode

    Instead of bundling cvode you should depends on cvode from the sundials package.

    Sundials packages are available on about every distro: https://repology.org/project/sundials/versions

    opened by yurivict 9
  • Viscosity of Solutions

    Viscosity of Solutions

    Will any model to get viscosity for aqueous solutions be implemented in future?

    I work in chloralkali industry & utilising python examples I made a small calculator for my android. This shows pH & density of caustic solutions at user defined process temperature, pressure & caustic weight%

    Viscosity is the only thing that I lack so that I can use values effectively for my piping calculations.

    from reaktoro import *
    
    db = ThermoFunDatabase("aq17")
    
    caustic = float(input("Caustic weight % (e.g 32) = ">
    caustic = caustic/100
    press = float(input("Process pressure barA = "))
    temp = float(input("Process temperature degC = "))
    
    solution = AqueousPhase(speciate("H O Na"))
    solution.setActivityModel(chain(
        ActivityModelHKF(),
    ))
    system = ChemicalSystem(db, solution)
    
    specs = EquilibriumSpecs(system)
    specs.temperature()
    specs.pressure()
    
    solver = EquilibriumSolver(specs)
    
    state = ChemicalState(system)
    state.set("H2O@", 1-caustic, "kg")
    state.set("Na+",  caustic*23/40, "kg")
    state.set("OH-",  caustic*17/40, "kg")
    
    conditions = EquilibriumConditions(specs)
    conditions.temperature(temp, "celsius")
    conditions.pressure(press, "bar")
    
    solver.solve(state, conditions)
    
    props = ChemicalProps(state)
    aprops = AqueousProps(state)
    
    
    print("Caustic density kg/m^3 ", props.density())
    print("Caustic pH ", aprops.pH())
    
    opened by defencedog 1
  • Runtime error:invalid node; this may result from using a map iterator as a sequence iterator or vice-versa

    Runtime error:invalid node; this may result from using a map iterator as a sequence iterator or vice-versa

    Hi Leal,

    When I run "A very simple custom thermodynamic database in YAML format" in python produces the following error:

    Runtime error: invalid node; this may result from using a map iterator as a sequence iterator or vice-versa

    Could be a YAML configuration issue?

    Best,

    Martin

    opened by mdiazv64 1
  • Possible use of uninitialized / out of bounds memory for gibbs energy

    Possible use of uninitialized / out of bounds memory for gibbs energy

    ChemicalProp.speciesStandardGibbsEnergies seems to read invalid values in the first element of the array, each time I execute the following code the first value changes.

    import reaktoro as rk
    
    db = rk.SupcrtDatabase("supcrtbl")
    solution = rk.GaseousPhase(rk.speciate("H O"))
    system = rk.ChemicalSystem(db, solution)
    init = rk.ChemicalState(system)
    init.temperature(25, "celsius")
    init.pressure(1, "bar")
    
    # a[0] changes
    a = rk.ChemicalProps(init).speciesStandardGibbsEnergies().asarray()
    
    # b[0] doesn't
    b = np.array([s.props(init.temperature().val(), "K", 1, "bar").G0.val() for s in system.species()])
    print(a, b)
    
    opened by aseyboldt 11
  • Surface complexation functionality

    Surface complexation functionality

    This PR implements a mechanism of surface complexation on the charged surface. The surface complexation phases are formed by the species collected from the PHREEQC database. The creation of the phases replies to the functionality provided by the class GenericPhase.

    The current implementation assumes only the default surface Hfo with two sites Hfo_s and Hfo_w and the species sorbed on them (defined by the PHREEQC databases).

    For the activity model of the surface complexation, the no double layer and double layer base on Dzombak and Morel 1990 are implemented.

    Tasks:

    • [x] Extend class Phases with DoubleLayerPhase and SurfaceComplexationPhase classes.
    • [x] Implement ComplexationSurface,ComplexationSurfaceSite, and DoubleLayer classes to be used for the activity models used in DoubleLayerPhase and SurfaceComplexationPhase.
    • [x] Implement ActivityModelSurfaceComplexation and ComplexationSurface classes with activity models described above.
    • [x] Implement DoubleLayerProps and ComplexationSurfaceProps classes to output the properties of the double layer and complexion surface, respectively.
    • [x] Implement surface complexation cpp and python tests.
    • [x] Implement python bindings for implemented above functionality.
    • [x] Implement surface complexation cpp and python examples.
    • [x] Add cosmetic and type corrections to other classes.
    opened by mtsveta 0
  • compilation error: libReaktoroDatabases.a no created as Position Independent Code

    compilation error: libReaktoroDatabases.a no created as Position Independent Code

    When compiling Reaktoro (main branch, gcc 11.2.1), I'm running into the following issue:

    /usr/bin/ld: ../databases/libReaktoroDatabases.a(lib.cpp.o): relocation R_X86_64_32 against.bss' can not be used when making a shared object; recompile with -fPIC `

    Setting set_target_properties(.... PROPERTIES POSITION_INDEPENDENT_CODE ON) on the target would make it work... but I'm not sure yet about the resource library stuff to know where it would be best suited

    opened by specmicp 2
Releases(v2.2.0)
  • v2.2.0(Jan 9, 2023)

    🐞 Bug Fixes

    Fixed a bug in PhreeqcDatabase that sometimes caused wrong computation of log(K) of a reaction when the product species is recursively defined in terms of other product species (e.g., (CO2)2 defined as 2 CO2 = (CO2)2 where CO2 is defined solely in terms of master species as CO3-2 + 2 H+ = CO2 + H2O)

    🛠️ Improvements

    The interface of cubic equations of states implemented in Reaktoro has been redesigned to make it easier for use as well as for specifying binary interaction parameter (BIP) models. See example below:

    #include <Reaktoro/Reaktoro.hpp>
    using namespace Reaktoro;
    
    int main()
    {
        CubicEOS::EquationSpecs eqspecs;
        eqspecs.eqmodel = CubicEOS::EquationModelPengRobinson();
        eqspecs.substances = {
            CubicEOS::Substance{"CO2", 304.20,  73.83e5, 0.2240},
            CubicEOS::Substance{"H2O", 647.10, 220.55e5, 0.3450},
            CubicEOS::Substance{"CH4", 190.60,  45.99e5, 0.0120},
        };
        eqspecs.bipmodel = CubicEOS::BipModelPHREEQC();
    
        CubicEOS::Equation equation(eqspecs);
        
        real T = 300.0; temperature in K
        real P = 1.0e5; // pressure in Pa
        ArrayXr x = {{0.90, 0.08, 0.02}}; // mole fractions of CO2, H2O, CH4
    
        CubicEOS::Props props;  // the properties of the fluid phase to be computed below
        
        equation.compute(props, T, P, x);
    
        std::cout << "The molar volume of the phase (in m3/mol)" << std::endl;
        std::cout << props.V << std::endl;            
        
        std::cout << "The temperature derivative of the molar volume at constant pressure (in m3/(mol*K))" << std::endl;
        std::cout << props.VT << std::endl;           
        
        std::cout << "The pressure derivative of the molar volume constant temperature (in m3/(mol*Pa))" << std::endl;
        std::cout << props.VP << std::endl;           
        
        std::cout << "The residual molar Gibbs energy of the phase (in J/mol)" << std::endl;
        std::cout << props.Gres << std::endl;         
        
        std::cout << "The residual molar enthalpy of the phase (in J/mol)" << std::endl;
        std::cout << props.Hres << std::endl;         
        
        std::cout << "The residual molar heat capacity at constant pressure of the phase (in J/(mol*K))" << std::endl;
        std::cout << props.Cpres << std::endl;        
        
        std::cout << "The residual molar heat capacity at constant volume of the phase (in J/(mol*K))" << std::endl;
        std::cout << props.Cvres << std::endl;        
        
        std::cout << "The ln fugacity coefficients of the species in the phase" << std::endl;
        std::cout << props.ln_phi << std::endl;    
        
        std::cout << "The state of matter of the fluid phas" << std::endl;
        std::cout << props.som << std::endl; 
    }
    

    Currently, only a BIP model is implemented; that used in PHREEQC for gases which specify BIP values for the pairs H2O-CO2, H2O-H2S, H2O-CH4, H2O-N2). More will be added later.

    🚀 New Features

    The temperature unit strings "°C", "°F", "°R" are now accepted in methods that temperature units can be specified.

    When defining a fluid phase (gaseous or liquid) with a cubic equation of state as an activity model, a BIP model can be assigned to it:

    gaseousphase = GaseousPhase("CO2(g) H2O(g) CH4(g)")
    gaseousphase.setActivityModel(ActivityModelPengRobinson76(CubicBipModelPHREEQC()))
    

    The code below is identical to:

    gaseousphase.setActivityModel(ActivityModelPengRobinsonPHREEQC()))
    

    where ActivityModelPengRobinsonPHREEQC was introduced as a short for ActivityModelPengRobinson76(CubicBipModelPHREEQC()).

    Source code(tar.gz)
    Source code(zip)
  • v2.1.3(Jan 4, 2023)

    🐞 Bug Fix Release

    This release fixes a bug in KineticSolver in which any EquilibriumSpecs other than that with given temperature and pressure was not working.

    Source code(tar.gz)
    Source code(zip)
  • v2.1.2(Dec 2, 2022)

    ⭐ Reaktoro v2.1.2

    This release improves error messages when finding indices of elements, species, phases, reactions and surfaces. It also adds missing Palandri-Kharaka kinetic rate parameters for Quartz.

    Full Changelog: https://github.com/reaktoro/reaktoro/compare/v2.1.1...v2.1.2

    Source code(tar.gz)
    Source code(zip)
  • v2.1.1(Nov 30, 2022)

    ⭐ Reaktoro v2.1.1

    This release improves the KineticsSolver class. As initial chemical states can be in strong disequilibrium, some reaction rates can be extremely high. Combined with large time steps for chemical kinetics, the first calculation may fail. This release detects when the time step is the first and automatically applies chemical kinetics to it using a tiny time step just to precondition it for subsequent larger time steps.

    Full Changelog: https://github.com/reaktoro/reaktoro/compare/v2.1.0...v2.1.1

    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Nov 29, 2022)

    ⭐ Reaktoro v2.1.0

    After initial release, some improvements (and bug fixes) became needed. This release improves on how reactions are defined in Reaktoro (for chemical kinetics modeling), and it also implements a new class called MineralReaction that facilitates the definition of mineral reaction rates:

    auto ratefn = [](MineralReactionRateModelArgs args)
    {
        const auto k = pow(10.0, -5.81);
        return args.area * k * (1 - args.Omega); 
    };
    
    auto reaction = MineralReaction("Calcite").setRateModel(ratefn);
    
    // above, area and Omega are the current surface 
    // area and saturation ratio of the mineral respectively
    // and k is a reaction rate constant
    

    The same reaction rate model can also be written as a general reaction rate model, but then a little bit "more verbose":

    auto ratefn = [](ChemicalProps const& props) 
    {
        const auto k = pow(10.0, -5.81);
        const auto area = props.surfaceArea("Calcite");
        const auto Omega = AqueousProps::compute(props).saturationRatio("Calcite");
        return area * k * (1 - Omega); 
    };
    
    auto reaction = MineralReaction("Calcite").setRateModel(ratefn);
    

    For Python, at the moment, only the general form for reaction rate definition (using ChemicalProps as argument) is supported:

    def ratefn(props: ChemicalProps):
        k = 10.0**-5.81
        area = props.surfaceArea("Calcite")
        Omega = AqueousProps.compute(props).saturationRatio("Calcite")
        return area * k * (1 - Omega)
    
    reaction = MineralReaction("Calcite").setRateModel(ratefn)
    

    Once some pybind11 work is done, we'll be able to define:

    def ratefn(args: MineralReactionRateModelArgs):
        k = 10.0**-5.81
        return args.area * k * (1 - args.Omega)
    
    reaction = MineralReaction("Calcite").setRateModel(ratefn)
    

    Below more details about important changes.

    New Features

    • Implemented MineralReaction class for conveniently defining mineral reactions and mineral reaction rates.
    • Implemented static method AqueousProps::compute to efficiently compute aqueous properties using memoization.
    • Implemented concept of stateid in ChemicalProps to facilitate efficient memoization of functions that depend on ChemicalProps

    Bug Fixes

    • Fixed bugs related to use of thread_local inside lambda functions.
    • Fixed C++ and Python tests for models SurfaceAreaModelPower*
    • Fixed C++ and Python tests for models SurfaceAreaModelLinear*
    • Fixed bug in models SurfaceAreaModelLinear* related to use of thread_local inside lambda function.
    • Fixed bug in models SurfaceAreaModelPower* related to use of thread_local inside lambda function.

    Deprecated

    • MineralReactions is no longer available; use MineralReaction instead.

    Other Changes

    • Improvements in GitHub workflows for continuous integration (e.g., using mamba)
    • Improved naming of variables in Optima logs for EquilibriumSolver
    • Disabled warning in ReactionRateModelParamsPalandriKharaka related to absense of CO2(g)
    • ReactionRateModelPalandriKharaka no longer relies on MineralReactionRateModel, but on ReactionRateModel instead.
    • Non-const version of ChemicalProps::phaseProps made private; renamed to phasePropsRef.
    • Implemented arithmetic operators for ReactionRate
    • Introduced ReactionRateModelGenerator for lazy construction of ReactionRateModel objects at the time of construction of ChemicalSystem, when indexing can be performed.
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Nov 21, 2022)

    ⭐ Reaktoro v2.0.0

    This release is the first in the Reaktoro v2 series of releases. Much has been improved and changed from Reaktoro v1!

    Reaktoro v2 was basically written from scratch. Its code design is much more flexible now and allows you to extend it to virtually any type of chemical system (with any number and type of phases and chemical species).

    Reaktoro v2 also contains new algorithms for chemical equilibrium and chemical kinetics calculations (including respective solvers accelerated by an on-demand machine learning strategy!).

    Reaktoro v2 relies on numerical libraries that were developed specifically to meet Reaktoro's numerical needs.

    • Optima, a C++ library for numerical optimization, was developed to be Reaktoro's numerical engine for minimizing Gibbs energy with any number of linear or non-linear constraints.
    • autodiff, a C++ library for automatic differentiation, has been developed to be Reaktoro's solution for calculating derivatives of thermochemical properties with respect to temperature, pressure, composition, model parameters, and any other input variable.

    To learn more about what Reaktoro v2 can offer in terms of modeling capabilities, visit https://reaktoro.org.

    Your feedback is always welcome!

    Source code(tar.gz)
    Source code(zip)
  • v1.2.3(Mar 17, 2021)

  • v1.2.2(Jan 13, 2021)

    In this release, the following has been corrected/improved:

    • CondaAware.cmake will select the python executable defined via PYTHON_EXECUTABLE if specified.
    • Solve memory leak in ChemicalQuantity class.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Jan 12, 2021)

    This release fixes a bug in the conversion of the molar mass values from ThermoFun (in g/mol) to Reaktoro (in kg/mol), which uses SI convention for all units.

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Sep 17, 2020)

    This release improves the HKF activity model in which the activity coefficient of neutral species are corrected according to log(gamma_i) = b*I where b = 0.1 as used in most geochemical modeling codes.

    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Apr 23, 2020)

  • v1.1.0(Nov 20, 2019)

    This release enables the use of ThermoFun for improved and extended support to many other thermodynamic databases:

    • aq17-thermofun.json
    • cemdata18-thermofun.json
    • heracles-thermofun.json
    • mines16-thermofun.json
    • psinagra07-thermofun.json

    See demos demo-equilibrium-using-thermofun-database-aq17.cpp and demo-equilibrium-using-thermofun-database-aq17.py, under Reaktoro/demos/cpp and Reaktoro/demos/python, respectively.

    Many thanks to @gdmiron for developing ThermoFun and integrating it into Reaktoro.

    Source code(tar.gz)
    Source code(zip)
  • v1.0.7(Oct 17, 2019)

  • v1.0.6(Oct 8, 2019)

    This release fixes issues related to building Reaktoro on conda-forge for both Windows and macOS.

    Changes:

    • Eigen library has been updated to the latest dev version
    • Use of std::optional::value replaced by std::optional::operator*
    • Addition of MSVC compiler option /Zc:__cplusplus to make MSVC set a proper value for __cplusplus.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.5(Sep 4, 2019)

    This release fixes the bugs documented in the pull request #109:

    • ChemicalProperties::update will not divide by zero anymore when computing mole fractions;
    • Using find_package(Reaktoro) and then target_link_libraries(mylib Reaktoro::Reaktoro) will now propagate the need of CXX17 to target mylib
    Source code(tar.gz)
    Source code(zip)
  • v1.0.4(Jun 26, 2019)

  • v1.0.3(Apr 10, 2019)

    This release introduces the following methods:

    ChemicalEditor::addAqueousPhaseWithElements
    ChemicalEditor::addAqueousPhaseWithElementsOf
    ChemicalEditor::addGaseousPhaseWithElements
    ChemicalEditor::addGaseousPhaseWithElementsOf
    
    Source code(tar.gz)
    Source code(zip)
  • v1.0.2(Mar 13, 2019)

    This new release fix the following bugs:

    • printing a ChemicalState object without an aqueous phase fails;
    • an object of ChemicalProperties created with ChemicalState.properties() being garbage collected before the ChemicalState object that created it (a Python).
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Feb 21, 2019)

    This release comes after a long time of development. It will serve to generate the conda package reaktoro v1.0.0.

    To learn more about Reaktoro, go to https://reaktoro.org

    Source code(tar.gz)
    Source code(zip)
Owner
Reaktoro
Reaktoro is a unified framework for modeling chemically reactive systems.
Reaktoro
An experimental sprite rendering setup utilizing SSBO's, Threading, EnTT reactive systems, and array-textures based sprite caching.

entt-reactive An experimental sprite rendering setup utilizing pooled SSBO's, a multithreaded setup based on Even Todd's The Poor Man's Threading Arch

Jackie Fuchs 7 Apr 29, 2022
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Cossack Labs 1.6k Jan 6, 2023
KernInfra, a unified kernel operation framework

KernInfra KernInfra is a developer-friendly kernel read-write framework. Why KernInfra KernInfra is built to address the following engineering issues:

null 30 Dec 14, 2022
Provide a unified trading framework and connectors to popular trading venues

Boost.connector Provide a unified trading framework and connectors to popular trading venues This is currently NOT an official Boost library. Introduc

Richard Hodges 6 Nov 24, 2021
C++React: A reactive programming library for C++11.

C++React is reactive programming library for C++14. It enables the declarative definition of data dependencies between state and event flows. Based on

Sebastian 968 Dec 22, 2022
DLBFoam: Dynamic load balancing for fast reactive simulations

DLBFoam: Dynamic load balancing for fast reactive simulations DLBFoam v1.1 - What's new? DLBFoam v1.1 introduces a fully analytical chemistry Jacobian

Aalto-CFD 47 Dec 31, 2022
RTL - Reactive Template Library for C++

RTL - Reactive Template Library It solves all my C++ animation problems -- me Using RTL Lazy, caching, reactive variables

Lorents Odin Gravås 3 Dec 22, 2021
Reactive Light Training Module used in fitness for developing agility and reaction speed.

Hello to you , Thanks for taking interest in this project. Use case of this project is to help people that want to improve their agility and reactio

null 6 Dec 14, 2022
Ureact - Minimalistic reactive library for c++

µReact µReact is an open-source minimalistic single-header reactive programming library for C++17. ❗️ This library is a work-in-progress. It should no

Yaroslav 126 Nov 27, 2022
C++React: A reactive programming library for C++11.

C++React is reactive programming library for C++14. It enables the declarative definition of data dependencies between state and event flows. Based on

Sebastian 969 Jan 3, 2023
Alien Swarm: Reactive Drop

Alien Swarm: Reactive Drop Alien Swarm: Reactive Drop is a standalone modification for Valve's Alien Swarm game. This repository contains the source c

Reactive Drop Team 34 Jan 4, 2023
This the contains the test examples and validator tool for the ISPD2021 Wafer-Scale Physics Modeling contest.

This readme documents information regarding the validator/scorer which will be used for the 2021 ISPD Contest problem: Wafer-Scale Physics Modelling

Cerebras 16 Aug 22, 2022
Monster Mash: New Sketch-Based Modeling and Animation Tool

Monster Mash is a new sketch-based modeling and animation tool that allows you to quickly sketch a character, inflate it into 3D, and promptly animate it. You can perform all interactions in the sketching plane. No 3D manipulation is required.

Google 1.2k Dec 31, 2022
NCNN+Int8+YOLOv4 quantitative modeling and real-time inference

NCNN+Int8+YOLOv4 quantitative modeling and real-time inference

pengtougu 20 Dec 6, 2022
Procedural Mesh Modeling Toolkit for Unreal Engine Artists

OpenLand Mesh Procedural Mesh Modeling Toolkit for Unreal Engine Artists. Installation Get it via the marketplace ??️ For non-commercial projects, you

GameDev4K 26 Nov 19, 2022
Procedural Mesh Modeling Toolkit for Unreal Engine Artists

OpenLand Mesh Procedural Mesh Modeling Toolkit for Unreal Engine Artists. Installation Get it via the marketplace ??️ For non-commercial projects, you

GDi4K 26 Nov 19, 2022
Grouped Feedback Delay Networks for Coupled Room Modeling

Grouped Feedback Delay Networks Reverb Plugin GFDNs connect multiple spaces with different T60 characteristics and a parameterized mixing matrix to co

Orchisama Das 28 Dec 5, 2022
Monster Mash: New Sketch-Based Modeling and Animation Tool

Monster Mash is a new sketch-based modeling and animation tool that allows you to quickly sketch a character, inflate it into 3D, and promptly animate it. You can perform all interactions in the sketching plane. No 3D manipulation is required.

Google 1.2k Dec 27, 2022
Real-time Skeletonization for Sketch-based Modeling (SMI:2021)

Real-time Skeletonization for Sketch-based Modeling (SMI:2021) Demo We provide an executable software under directory "demo_exe/". Tested Environment

null 247 Dec 21, 2022
Contour mapping and 3D surface modeling app

QuikGrid v5.4 for 64-bit editions of MS Windows Contour mapping and 3D surface modeling app A 64-Bit Windows installer for QuikGrid can be found in th

Stephen Ferrell 8 Nov 18, 2022