state = ChemicalState(system)
I'm getting an error in following line which used to work before:
TypeError: temperature(): incompatible function arguments. The following argument types are supported:
1. (self: reaktoro.reaktoro4py.ChemicalState, arg0: autodiff::detail::Real<1ul, double>) -> None 2. (self: reaktoro.reaktoro4py.ChemicalState, arg0: autodiff::detail::Real<1ul, double>, arg1: str) -> None 3. (self: reaktoro.reaktoro4py.ChemicalState) -> autodiff::detail::Real<1ul, double>
Is there any solution to fix this?
v2.0rc19, wondering if this is the issue
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?
reaktoropython package in the yml-file.
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 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 print(sys.path)
In the command line, it would be
python -c 'import sys; print(sys.path)'
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
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
reaktoroand 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")) solution.setActivityModel(chain( ActivityModelHKF(), ActivityModelDrummond("CO2") )) gases = GaseousPhase("CO2(g)") gases.setActivityModel(ActivityModelPengRobinson()) 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) solver.solve(state) props = ChemicalProps(state) props.output("props.txt") aprops = AqueousProps(state) aprops.output("aprops.txt") print("Success! Check outputted files `props.txt` and `aprops.txt`.")
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
Microsoft Visual Studio Code (Community)
Anaconda Jupyter Notebook
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