Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
    Allan Leal
    The new package for reaktoro that will work well with these deps is being built by conda at the moment.
    Thanks for reporting this issue.
    Allan Leal
    It's working for me now on Google Colab.
    Thanks a lot @allanleal It's working as expected.
    Hi @allanleal , I wanted to ask if I can access the Pitzer parameters on Reaktoro to add ones for new materials or modify them. I want to model CO2 solubility using an aqueous amine solvent and would like to correlate the pitzer parameters using experimental data.
    Allan Leal
    Hi Omar. ATM the parameters for the Pitzer model are embedded in the implementation (which needs to be decoupled). This is a planned important work, but I don't have an estimate for when this will be implemented. Can you program in C++?
    3 replies
    Hi Allan. I have installed reaktoro from environment.yml file. But getting an error in above line. Any suggestions?
    Svetlana Kyas
    Hi @bgvinayk! This is Svetlana, postdoc from Allan's team. He is on vocation at the moment, so I will try to help you.
    From the environment.yml file I see that you are installing 1.2.2 version of reaktoro. At the same time, you are calling db = PhreeqcDatabase("minteq.v4.dat") which is a new functionality from the reaktoro v.2. May I ask if you intend to use the reaktoro v1 or v2?
    If it is v2, you should remove the version of the reaktoro python package in the yml-file.
    Svetlana Kyas
    After activating your conda environment, and executing conda list, you should see reaktoro 2.0.0rc22 py39hfc627dd_0 conda-forge if you intend to use the most recent version of reaktoro v2.

    Hi @mtsveta Appreciate you quick response. I need to use following code. Which version is recommended?
    db = PhreeqcDatabase("minteq.v4.dat")
    solution = AqueousPhase(speciate("H O Ca Mg Na K C P S Cl N"))
    system = ChemicalSystem(db, solution)
    specs = EquilibriumSpecs(system)
    solver = EquilibriumSolver(specs)
    state = ChemicalState(system)

    I have listed reaktoro 2.0.0rc22 version in dependencies now. I am getting some errors like:
    PhreeqcDatabase is not defined
    speciate is not defined
    EquilibriumSpecs is not defined

    I had to use Phreeqc("minteq.v4.dat") instead of PhreeqcDatabase and it worked.
    Also tried removing the reaktoro version and got same result
    Svetlana Kyas

    Hi @bgvinayk.

    I need to use following code. Which version is recommended?

    This looks like Reaktoro v2. The snippet of code you shared above runs for me on the 2.0.0rc22 version. Phreeqc("minteq.v4.dat") is the functionality of the version 1.2. I think, you have to make sure that you activate the environment with Reaktoro v2.

    Could you include this lines of code in the try.py script so that I understand better what is going on?

    import sys

    In the command line, it would be python -c 'import sys; print(sys.path)'

    Svetlana Kyas

    Also tried removing the reaktoro version and got same result

    I would also try to remove old environment and create the new one from the scratch. Maybe this would help.

    Enrique Garcia Franco

    Hello to all:

    I hope you had a good summer

    I tried creating a new environment

    But since then I get the same errors as @bgvinayk

    It seems like it weren't importing libraries from Reaktoro

    It does

    import reaktoro as rkt

    and then import all

    But it won't be recognized later on the code

    I tried changing the environment and activating it

    Thank you!

    Allan Leal
    Hi Enrique. I'm checking what is going on. Some dependencies were updated today/recently, and something may be happening related to this.
    Web capture_8-9-2022_205511_colab.research.google.com.jpeg
    As you see above, just used Google Colab to install reaktoro and then run the script in the screenshot. It worked without any issues (the results on the right-hand side). Could you please double check? This is the script I executed:
    from reaktoro import *
    db = PhreeqcDatabase("phreeqc.dat")
    solution = AqueousPhase(speciate("H O C Na Cl"))
    gases = GaseousPhase("CO2(g)")
    system = ChemicalSystem(db, solution, gases)
    T = 25.0 # temperature in celsius
    P = 1.0  # pressure in bar
    state = ChemicalState(system)
    state.temperature(T, "celsius")
    state.pressure(P, "bar")
    state.set("H2O"   , 1.0 , "kg")
    state.set("CO2(g)", 10.0, "mol")
    state.set("Na+"   , 4.00, "mol")
    state.set("Cl-"   , 4.00, "mol")
    solver = EquilibriumSolver(system)
    props = ChemicalProps(state)
    aprops = AqueousProps(state)
    print("Success! Check outputted files `props.txt` and `aprops.txt`.")
    Allan Leal
    Also tried in Windows, and all is working fine. Curious to know what you may be doing differently.
    Enrique Garcia Franco

    OK, after chatting one-on-one with Allan it might be the case that I am not working on the right conda environment

    I also had to create a new environment and seems like Reaktoro isn't updated in whichever environment that has been loaded by default on Jupyter Notebook

    I am learning how to change the environment in whichever Python app that I use

    Trying with

    1. Microsoft Visual Studio Code (Community)

    2. Anaconda Jupyter Notebook

    3. Anaconda Spyder

    Allan Leal
    Thanks, Enrique, for sharing. I highly recommend Visual Studio Code (it's what I use for C++ programming, and Jupyter Notebooks)
    Enrique Garcia Franco

    Yes, thank you. I have been doing my best. Seems that I will need to invest a couple of days into getting all done with it

    I have been able to fix it with Anaconda

    The issue was indeed with the environment

    I fixed it by launching Spyder from Anaconda Navigator after choosing my environment in the very same GUI

    So, my advice for @bgvinayk would be to choose the right environment, in Anaconda distribution or Visual Studio Code

    I find Anaconda easier for me. Visual Code Studio has a more abstract GUI

    1 reply
    Hi @allanleal I am using above attached code to get tricalcium phosphate saturation index with variation in temperature. I just noticed that its saturation index is decreasing with increase in temperature. But theoretically it is expected to increase with increase in temperature.
    My guess is it is because delta_H value is positive in the database
    George Dan Miron
    @bgvinayk you are right this is because of positive reaction enthalpy which leads to products being more favoured with increasing T. You have to look in the literature for the enthalpy of this reaction or for the enthalpy of formation for this solid. Maybe the value in the database is outdated.
    Enrique Garcia Franco


    Calcium salts are strange when heating, this is true

    Calcium hardness tends to precipitate on the walls of dishwashers as a reaction of the temperature increase

    I would analyze the combined effects of enthalpy and entropy

    They key is to see the trend of DG with the increasing temperature for an intuitive set up

    3Ca+2 + 2PO43- -> Ca3(PO4)2 (prec)

    k = exp(-DG/(RT))

    DG = DH - TDS

    If DG is increasing, then k is decreasing with T

    If DG is decreasing, then k is increasing with T

    Allan Leal
    Interesting. Perhaps, @bgvinayk , you should try one of ThermoFun databases. ThermoFun is fully integrated in Reaktoro. Dan Miron ( @gdmiron ) is the author/main developer. Dan, is there any database in ThermoFun that has this salt?
    George Dan Miron
    @bgvinayk I think they have the wrong enthalpy sign there. You can try using mines19-thermofun.json ThermoFun database, you will find this phase there (as whitlockite). This database should have a better T dependence for solids, based on the compilation of Robie and Hemingway. Otherwhise I provide you with a revised data for this phase from PSI tdb2020.
    Ca3(PO4)2 = 3Ca+2 + 2PO4-3
    -analytical_expression 1922.963 0 -83280.97 -675.9268474 0 0 0
    -log_K -28.8997
    for this delta_h -81.2 , in this case phreeqc uses the analytical expression so you don't need delta_h explicitly, but you can see it has a negative sign
    @gdmiron Thanks. I will try it out.
    Heewon Jung
    Hi all,
    I have recently encountered the paper Kyas et al. (2022) and interested in exploring the ODML capability of reaktoro. The paper says that the ODML has been implemented in reaktoro but I am not sure if this capability has been released or is still in the development phase. What should I do, let's say, if I want to test the accuracy of the ODML approach compared to the GEM method in reaktoro? The C++ API reference includes SmartEqulibriumOptions but it doesn't seem to be accessible from python. Any help would be greatly appreciated.
    Enrique Garcia Franco
    Hello Heewon, I have a silly question to kick-start the discussion. What does ODML stand for? Thanks and looking forward to debating!
    Ok, I read it now 🤜🤛
    Allan Leal

    Hi @HeewonJung_CNU_twitter , the ODML algorithm (as well as chemical kinetics solver) has been recently (late September) implemented for Reaktoro v2, but it is currently available only through my personal GitHub repo in the kinetics branch:


    See these classes:


    I need to merge that kinetics branch above into main and then produce conda packages for it. However, I'm currently very busy with another project that ends on Nov 15th, so this work will only happen after that.

    Hi @allanleal, I hope you are doing well. I was wondering how to write chemical reactions in the canonical form in Reaktoro. For instance, how can the following reactions, in the canonical form,
    HCO_3^− <-> H+ + CO_3 ^2−
    HSO_4^− <-> H+ + SO_4^2−
    OH^− <-> H2O − H^+
    CaCO3 <-> Ca^2+ + CO_3 ^2−
    CaSO4 <-> Ca^2+ + SO_4^2−
    be written in Reaktoro.
    Allan Leal
    Hi @taj004 - what do you mean by writing them in Reaktoro? What is the context (e.g., defining database from scratch, or extending one with new species)?
    HCO3− = H+ + CO3-2
    HSO4− = H+ + SO4-2
    OH− = H2O − H+
    CaCO3 = Ca+2 + CO3-2
    CaSO4 = Ca+2 + SO4-2
    Above is how the species would be written following the usual convention in Reaktoro
    In case you have a non-unit coefficient, then use * as multiplication sign:
    CaMg(CO3)2 = Ca+2 + Mg+2 + 2*CO3-2