# -*- coding: utf-8 -*-"""Created on Tue Mar 7 09:29:09 2023@author: che458"""from win32com.client import Dispatchdef result(input_str): db_path = 'LLNL.DAT'#'carbfix.dat' dbase = Dispatch('IPhreeqcCOM.Object') dbase.LoadDatabase(db_path) dbase.RunString(input_str) return dbase.GetSelectedOutputArray()if __name__ == '__main__': a = """DATABASE c:\phreeqc\database\LLNL.DATSOLUTION 1 EQUILIBRIUM_PHASES 1CO2(g) 3 100SAVE SOLUTION 1ENDSELECTED_OUTPUT -file selected.out -reset falseUSER_PUNCH -headings pH Mol(CaCO3) Mol(CO3-2) Mol(Ca) TotalC Al An -start 10 PUNCH -LA("H+")#PR_P("CO2(g)") 20 PUNCH MOL("CaCO3")*1000 30 PUNCH MOL("CO3-2")*1000 40 PUNCH MOL("Ca+2")*1000 50 PUNCH TOT("C") 60 PUNCH -EQUI_DELTA("Albite")*1000 70 PUNCH -EQUI_DELTA("Anorthite")*1000 -end ENDUSE SOLUTION 1EQUILIBRIUM_PHASES 2Albite 0 24.9Anorthite 0 24.5SAVE SOLUTION 2END """ tem = result(a) print(tem)
DATABASE c:\phreeqc\database\LLNL.DATSOLUTION 1 EQUILIBRIUM_PHASES 1CO2(g) 3 100SAVE SOLUTION 1ENDSELECTED_OUTPUT -file selected.out -reset falseUSER_PUNCH -headings pH Mol(CaCO3) Mol(CO3-2) Mol(Ca) TotalC Al An -start 10 PUNCH -LA("H+")#PR_P("CO2(g)") 20 PUNCH MOL("CaCO3")*1000 30 PUNCH MOL("CO3-2")*1000 40 PUNCH MOL("Ca+2")*1000 50 PUNCH TOT("C") 60 PUNCH -EQUI_DELTA("Albite")*1000 70 PUNCH -EQUI_DELTA("Anorthite")*1000 -end ENDUSE SOLUTION 1EQUILIBRIUM_PHASES 2Albite 0 24.9Anorthite 0 24.5SAVE SOLUTION 2END
LK_PHASE("Albite")
(('pH', 'Mol(CaCO3)', 'Mol(CO3-2)', 'Mol(Ca)', 'TotalC', 'Al', 'An', 'LogK(Al)'), (4.794098585416058, 0.08333842715243284, 0.011002936982880721, 112.39594014981397, 35.108246694244414, -8.071054935498978e-08, 333.8527245630374, 2.6574779847717167))
pH Mol(CaCO3) Mol(CO3-2) Mol(Ca) TotalC Al An Logk(Al) 4.7941e+00 8.3338e-02 1.1003e-02 1.1240e+02 3.5108e+01 1.9279e-08 3.3385e+02 2.6575e+00
KNOBS-conv 1e-10