pyEQL 1.4.0rc9__cp312-cp312-macosx_10_13_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (491) hide show
  1. pyEQL/__init__.py +50 -0
  2. pyEQL/_phreeqc.cpython-312-darwin.so +0 -0
  3. pyEQL/activity_correction.py +879 -0
  4. pyEQL/database/geothermal.dat +5693 -0
  5. pyEQL/database/llnl.dat +19305 -0
  6. pyEQL/database/phreeqc_license.txt +54 -0
  7. pyEQL/database/pyeql_db.json +35607 -0
  8. pyEQL/engines.py +1153 -0
  9. pyEQL/equilibrium.py +227 -0
  10. pyEQL/functions.py +281 -0
  11. pyEQL/phreeqc/__init__.py +5 -0
  12. pyEQL/phreeqc/bindings.cpp +84 -0
  13. pyEQL/phreeqc/core.py +239 -0
  14. pyEQL/phreeqc/database/Amm.dat +1968 -0
  15. pyEQL/phreeqc/database/CMakeLists.txt +32 -0
  16. pyEQL/phreeqc/database/ColdChem.dat +267 -0
  17. pyEQL/phreeqc/database/Concrete_PHR.dat +158 -0
  18. pyEQL/phreeqc/database/Concrete_PZ.dat +195 -0
  19. pyEQL/phreeqc/database/Kinec.v2.dat +12039 -0
  20. pyEQL/phreeqc/database/Kinec_v3.dat +12159 -0
  21. pyEQL/phreeqc/database/Makefile.am +28 -0
  22. pyEQL/phreeqc/database/Makefile.in +530 -0
  23. pyEQL/phreeqc/database/PHREEQC_ThermoddemV1.10_15Dec2020.dat +12965 -0
  24. pyEQL/phreeqc/database/Tipping_Hurley.dat +4137 -0
  25. pyEQL/phreeqc/database/__init__.py +0 -0
  26. pyEQL/phreeqc/database/core10.dat +6824 -0
  27. pyEQL/phreeqc/database/frezchem.dat +634 -0
  28. pyEQL/phreeqc/database/iso.dat +7235 -0
  29. pyEQL/phreeqc/database/llnl.dat +19310 -0
  30. pyEQL/phreeqc/database/minteq.dat +5654 -0
  31. pyEQL/phreeqc/database/minteq.v4.dat +13212 -0
  32. pyEQL/phreeqc/database/phreeqc.dat +1972 -0
  33. pyEQL/phreeqc/database/phreeqc_rates.dat +3158 -0
  34. pyEQL/phreeqc/database/pitzer.dat +1044 -0
  35. pyEQL/phreeqc/database/sit.dat +14348 -0
  36. pyEQL/phreeqc/database/wateq4f.dat +4036 -0
  37. pyEQL/phreeqc/ext/README.md +10 -0
  38. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/CMakeLists.txt +476 -0
  39. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/INSTALL +302 -0
  40. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/IPhreeqc.rc +61 -0
  41. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/IPhreeqcConfig.cmake.in +4 -0
  42. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/Makefile.am +8 -0
  43. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/Makefile.in +816 -0
  44. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/aclocal.m4 +1217 -0
  45. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/CTestScript.cmake +167 -0
  46. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/CSelectedOutput.cpp.o +0 -0
  47. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/IPhreeqc.cpp.o +0 -0
  48. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/IPhreeqcLib.cpp.o +0 -0
  49. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/IPhreeqc_interface_F.cpp.o +0 -0
  50. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/Var.c.o +0 -0
  51. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Dictionary.cpp.o +0 -0
  52. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/ExchComp.cxx.o +0 -0
  53. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Exchange.cxx.o +0 -0
  54. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/GasComp.cxx.o +0 -0
  55. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/GasPhase.cxx.o +0 -0
  56. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/ISolution.cxx.o +0 -0
  57. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/ISolutionComp.cxx.o +0 -0
  58. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/KineticsComp.cxx.o +0 -0
  59. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/NameDouble.cxx.o +0 -0
  60. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/NumKeyword.cxx.o +0 -0
  61. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/PBasic.cpp.o +0 -0
  62. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/PHRQ_io_output.cpp.o +0 -0
  63. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/PPassemblage.cxx.o +0 -0
  64. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/PPassemblageComp.cxx.o +0 -0
  65. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Phreeqc.cpp.o +0 -0
  66. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/PhreeqcKeywords/Keywords.cpp.o +0 -0
  67. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Pressure.cxx.o +0 -0
  68. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Reaction.cxx.o +0 -0
  69. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/ReadClass.cxx.o +0 -0
  70. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SS.cxx.o +0 -0
  71. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SSassemblage.cxx.o +0 -0
  72. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SScomp.cxx.o +0 -0
  73. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SelectedOutput.cpp.o +0 -0
  74. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Serializer.cxx.o +0 -0
  75. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Solution.cxx.o +0 -0
  76. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SolutionIsotope.cxx.o +0 -0
  77. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/StorageBin.cxx.o +0 -0
  78. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/StorageBinList.cpp.o +0 -0
  79. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Surface.cxx.o +0 -0
  80. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SurfaceCharge.cxx.o +0 -0
  81. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/SurfaceComp.cxx.o +0 -0
  82. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/System.cxx.o +0 -0
  83. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Temperature.cxx.o +0 -0
  84. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/Use.cpp.o +0 -0
  85. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/UserPunch.cpp.o +0 -0
  86. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/advection.cpp.o +0 -0
  87. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/basicsubs.cpp.o +0 -0
  88. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/cl1.cpp.o +0 -0
  89. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/common/PHRQ_base.cxx.o +0 -0
  90. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/common/PHRQ_io.cpp.o +0 -0
  91. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/common/Parser.cxx.o +0 -0
  92. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/common/Utils.cxx.o +0 -0
  93. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/cvdense.cpp.o +0 -0
  94. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/cvode.cpp.o +0 -0
  95. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/cxxKinetics.cxx.o +0 -0
  96. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/cxxMix.cxx.o +0 -0
  97. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/dense.cpp.o +0 -0
  98. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/dumper.cpp.o +0 -0
  99. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/gases.cpp.o +0 -0
  100. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/input.cpp.o +0 -0
  101. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/integrate.cpp.o +0 -0
  102. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/inverse.cpp.o +0 -0
  103. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/isotopes.cpp.o +0 -0
  104. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/kinetics.cpp.o +0 -0
  105. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/mainsubs.cpp.o +0 -0
  106. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/model.cpp.o +0 -0
  107. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/nvector.cpp.o +0 -0
  108. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/nvector_serial.cpp.o +0 -0
  109. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/parse.cpp.o +0 -0
  110. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/phqalloc.cpp.o +0 -0
  111. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/pitzer.cpp.o +0 -0
  112. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/pitzer_structures.cpp.o +0 -0
  113. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/prep.cpp.o +0 -0
  114. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/print.cpp.o +0 -0
  115. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/read.cpp.o +0 -0
  116. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/readtr.cpp.o +0 -0
  117. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/runner.cpp.o +0 -0
  118. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/sit.cpp.o +0 -0
  119. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/smalldense.cpp.o +0 -0
  120. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/spread.cpp.o +0 -0
  121. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/step.cpp.o +0 -0
  122. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/structures.cpp.o +0 -0
  123. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/sundialsmath.cpp.o +0 -0
  124. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/tally.cpp.o +0 -0
  125. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/tidy.cpp.o +0 -0
  126. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/transport.cpp.o +0 -0
  127. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/IPhreeqc.dir/src/phreeqcpp/utilities.cpp.o +0 -0
  128. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CTestTestfile.cmake +6 -0
  129. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/DartConfiguration.tcl +109 -0
  130. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/cmake_install.cmake +45 -0
  131. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/libIPhreeqc.a +0 -0
  132. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/ar-lib +270 -0
  133. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/compile +347 -0
  134. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/config.guess +1441 -0
  135. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/config.sub +1813 -0
  136. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/depcomp +791 -0
  137. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/install-sh +508 -0
  138. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/ltmain.sh +11156 -0
  139. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/missing +215 -0
  140. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/test-driver +148 -0
  141. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/configure +23867 -0
  142. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/configure.ac +136 -0
  143. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Amm.dat +1968 -0
  144. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/CMakeLists.txt +32 -0
  145. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/ColdChem.dat +267 -0
  146. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Concrete_PHR.dat +158 -0
  147. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Concrete_PZ.dat +195 -0
  148. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Kinec.v2.dat +12039 -0
  149. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Kinec_v3.dat +12159 -0
  150. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Makefile.am +28 -0
  151. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Makefile.in +530 -0
  152. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/PHREEQC_ThermoddemV1.10_15Dec2020.dat +12965 -0
  153. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Tipping_Hurley.dat +4137 -0
  154. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/core10.dat +6824 -0
  155. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/frezchem.dat +634 -0
  156. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/iso.dat +7235 -0
  157. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/llnl.dat +19310 -0
  158. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/minteq.dat +5654 -0
  159. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/minteq.v4.dat +13212 -0
  160. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/phreeqc.dat +1972 -0
  161. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/phreeqc_rates.dat +3158 -0
  162. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/pitzer.dat +1044 -0
  163. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/sit.dat +14348 -0
  164. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/wateq4f.dat +4036 -0
  165. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/CMakeLists.txt +35 -0
  166. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/IPhreeqc.pdf +0 -0
  167. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/Makefile.am +24 -0
  168. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/Makefile.in +545 -0
  169. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/NOTICE +51 -0
  170. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/Phreeqc_2_1999_manual.pdf +0 -0
  171. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/Phreeqc_3_2013_manual.pdf +0 -0
  172. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/README +428 -0
  173. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/RELEASE +7294 -0
  174. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/IPhreeqc_8h.html +5096 -0
  175. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/IPhreeqc_8h_source.html +389 -0
  176. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/IPhreeqc_8hpp.html +83 -0
  177. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/IPhreeqc_8hpp_source.html +478 -0
  178. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/Var_8h.html +318 -0
  179. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/Var_8h_source.html +200 -0
  180. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/bc_s.png +0 -0
  181. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/bdwn.png +0 -0
  182. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/classIPhreeqc.html +2274 -0
  183. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/classIPhreeqc.png +0 -0
  184. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/classIPhreeqcStop.html +69 -0
  185. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/classIPhreeqcStop.png +0 -0
  186. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/closed.png +0 -0
  187. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html +68 -0
  188. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/doxygen.css +1440 -0
  189. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/doxygen.png +0 -0
  190. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/dynsections.js +97 -0
  191. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2blank.png +0 -0
  192. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2doc.png +0 -0
  193. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2folderclosed.png +0 -0
  194. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2folderopen.png +0 -0
  195. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2lastnode.png +0 -0
  196. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2link.png +0 -0
  197. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2mlastnode.png +0 -0
  198. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2mnode.png +0 -0
  199. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2node.png +0 -0
  200. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2plastnode.png +0 -0
  201. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2pnode.png +0 -0
  202. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2splitbar.png +0 -0
  203. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2vertline.png +0 -0
  204. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/index.html +58 -0
  205. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/jquery.js +31 -0
  206. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/nav_f.png +0 -0
  207. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/nav_g.png +0 -0
  208. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/nav_h.png +0 -0
  209. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/open.png +0 -0
  210. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/structVAR.html +143 -0
  211. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/sync_off.png +0 -0
  212. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/sync_on.png +0 -0
  213. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tab_a.png +0 -0
  214. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tab_b.png +0 -0
  215. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tab_h.png +0 -0
  216. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tab_s.png +0 -0
  217. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tabs.css +60 -0
  218. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/phreeqc3.chm +0 -0
  219. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/CMakeLists.txt +11 -0
  220. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/Makefile.am +88 -0
  221. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/Makefile.in +696 -0
  222. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/CMakeLists.txt +1 -0
  223. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/CMakeLists.txt +35 -0
  224. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/CMakeLists.txt.in +21 -0
  225. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/README.txt +44 -0
  226. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/advect.c +101 -0
  227. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/ic +17 -0
  228. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/phreeqc.dat +1579 -0
  229. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/CMakeLists.txt +10 -0
  230. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/README.txt +3 -0
  231. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/excel/CMakeLists.txt +9 -0
  232. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/excel/phreeqc.dat +1582 -0
  233. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/excel/runphreeqc.xls +0 -0
  234. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/excel/withcallback.xls +0 -0
  235. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/CMakeLists.txt +11 -0
  236. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/Gypsum.py +52 -0
  237. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/parallel_advect.py +465 -0
  238. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/phreeqc.dat +1582 -0
  239. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/pitzer.dat +790 -0
  240. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/wateq4f.dat +3846 -0
  241. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/CMakeLists.txt +1 -0
  242. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/CMakeLists.txt +35 -0
  243. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/CMakeLists.txt.in +20 -0
  244. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/README.txt +45 -0
  245. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/advect.cpp +110 -0
  246. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/ic +17 -0
  247. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/phreeqc.dat +1579 -0
  248. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/CMakeLists.txt +1 -0
  249. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/CMakeLists.txt +44 -0
  250. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/CMakeLists.txt.in +24 -0
  251. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/README.txt +45 -0
  252. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/advect.F90 +102 -0
  253. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/ic +17 -0
  254. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/phreeqc.dat +1579 -0
  255. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/CMakeLists.txt +26 -0
  256. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/CMakeLists.txt.in +20 -0
  257. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/README.txt +37 -0
  258. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/ex2 +26 -0
  259. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/main.cpp +20 -0
  260. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/phreeqc.dat +1837 -0
  261. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/post-install.cmake.in +7 -0
  262. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/CMakeLists.txt +185 -0
  263. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/FileTest.cpp +171 -0
  264. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/FileTest.h +34 -0
  265. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/Makefile.am +18 -0
  266. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/Makefile.in +466 -0
  267. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestCVar.cpp +9 -0
  268. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestIPhreeqc.cpp +4901 -0
  269. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestIPhreeqcLib.cpp +4644 -0
  270. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestSelectedOutput.cpp +669 -0
  271. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestVar.cpp +10 -0
  272. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/conv_fail.in +11 -0
  273. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/dump +42 -0
  274. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/iso.dat +7231 -0
  275. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/kinn20140218 +349 -0
  276. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/missing_e.dat +1556 -0
  277. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/multi_punch +105 -0
  278. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/multi_punch_no_set +102 -0
  279. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/phreeqc.dat.90a6449 +1935 -0
  280. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/phreeqc.dat.old +1556 -0
  281. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/libtool.m4 +8388 -0
  282. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/ltoptions.m4 +437 -0
  283. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/ltsugar.m4 +124 -0
  284. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/ltversion.m4 +23 -0
  285. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/lt~obsolete.m4 +99 -0
  286. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/resource.h +14 -0
  287. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/CSelectedOutput.cpp +401 -0
  288. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/CSelectedOutput.hxx +77 -0
  289. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/CVar.hxx +162 -0
  290. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Debug.h +12 -0
  291. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/ErrorReporter.hxx +70 -0
  292. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.cpp +1889 -0
  293. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.f.inc +91 -0
  294. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.f90.inc +603 -0
  295. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.h +2182 -0
  296. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.hpp +1027 -0
  297. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqcCallbacks.h +19 -0
  298. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqcF.f +653 -0
  299. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqcLib.cpp +1098 -0
  300. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc_interface.F90 +1283 -0
  301. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc_interface_F.cpp +535 -0
  302. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc_interface_F.h +162 -0
  303. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Makefile.am +210 -0
  304. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Makefile.in +1294 -0
  305. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/README.Fortran +17 -0
  306. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Var.c +84 -0
  307. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Var.h +152 -0
  308. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Version.h +36 -0
  309. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fimpl.h +282 -0
  310. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap.cpp +646 -0
  311. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap.h +163 -0
  312. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap1.cpp +24 -0
  313. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap2.cpp +24 -0
  314. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap3.cpp +24 -0
  315. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap4.cpp +24 -0
  316. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap5.cpp +24 -0
  317. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap6.cpp +25 -0
  318. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap7.cpp +25 -0
  319. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap8.cpp +24 -0
  320. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ChartHandler.cpp +225 -0
  321. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ChartHandler.h +59 -0
  322. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ChartObject.cpp +1382 -0
  323. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ChartObject.h +444 -0
  324. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/CurveObject.cpp +42 -0
  325. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/CurveObject.h +79 -0
  326. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Dictionary.cpp +41 -0
  327. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Dictionary.h +28 -0
  328. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ExchComp.cxx +398 -0
  329. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ExchComp.h +117 -0
  330. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Exchange.cxx +466 -0
  331. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Exchange.h +74 -0
  332. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Form1.h +1184 -0
  333. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Form1.resX +36 -0
  334. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/GasComp.cxx +265 -0
  335. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/GasComp.h +59 -0
  336. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/GasPhase.cxx +659 -0
  337. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/GasPhase.h +103 -0
  338. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ISolution.cxx +40 -0
  339. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ISolution.h +53 -0
  340. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ISolutionComp.cxx +202 -0
  341. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ISolutionComp.h +138 -0
  342. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/KineticsComp.cxx +318 -0
  343. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/KineticsComp.h +81 -0
  344. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NA.h +1 -0
  345. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NameDouble.cxx +537 -0
  346. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NameDouble.h +66 -0
  347. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NumKeyword.cxx +190 -0
  348. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NumKeyword.h +67 -0
  349. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PBasic.cpp +8350 -0
  350. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PBasic.h +572 -0
  351. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PHRQ_io_output.cpp +411 -0
  352. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PPassemblage.cxx +375 -0
  353. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PPassemblage.h +70 -0
  354. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PPassemblageComp.cxx +441 -0
  355. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PPassemblageComp.h +83 -0
  356. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Phreeqc.cpp +2087 -0
  357. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Phreeqc.h +2164 -0
  358. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PhreeqcKeywords/Keywords.cpp +242 -0
  359. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PhreeqcKeywords/Keywords.h +104 -0
  360. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Pressure.cxx +417 -0
  361. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Pressure.h +43 -0
  362. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Reaction.cxx +284 -0
  363. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Reaction.h +57 -0
  364. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ReadClass.cxx +1150 -0
  365. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SS.cxx +609 -0
  366. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SS.h +128 -0
  367. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SSassemblage.cxx +317 -0
  368. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SSassemblage.h +59 -0
  369. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SScomp.cxx +297 -0
  370. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SScomp.h +66 -0
  371. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SelectedOutput.cpp +115 -0
  372. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SelectedOutput.h +209 -0
  373. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Serializer.cxx +213 -0
  374. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Serializer.h +42 -0
  375. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Solution.cxx +1795 -0
  376. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Solution.h +154 -0
  377. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SolutionIsotope.cxx +333 -0
  378. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SolutionIsotope.h +85 -0
  379. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/StorageBin.cxx +1507 -0
  380. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/StorageBin.h +141 -0
  381. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/StorageBinList.cpp +358 -0
  382. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/StorageBinList.h +81 -0
  383. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Surface.cxx +837 -0
  384. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Surface.h +108 -0
  385. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SurfaceCharge.cxx +617 -0
  386. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SurfaceCharge.h +137 -0
  387. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SurfaceComp.cxx +509 -0
  388. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SurfaceComp.h +70 -0
  389. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/System.cxx +103 -0
  390. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/System.h +89 -0
  391. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Temperature.cxx +423 -0
  392. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Temperature.h +42 -0
  393. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Use.cpp +78 -0
  394. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Use.h +159 -0
  395. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/UserPunch.cpp +32 -0
  396. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/UserPunch.h +39 -0
  397. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ZedGraph.dll +0 -0
  398. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/advection.cpp +140 -0
  399. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/basicsubs.cpp +4333 -0
  400. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cl1.cpp +881 -0
  401. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_base.cxx +117 -0
  402. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_base.h +48 -0
  403. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_exports.h +20 -0
  404. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_io.cpp +914 -0
  405. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_io.h +207 -0
  406. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/Parser.cxx +1331 -0
  407. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/Parser.h +310 -0
  408. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/Utils.cxx +263 -0
  409. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/Utils.h +29 -0
  410. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/phrqtype.h +18 -0
  411. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cvdense.cpp +566 -0
  412. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cvdense.h +267 -0
  413. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cvode.cpp +3939 -0
  414. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cvode.h +940 -0
  415. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cxxKinetics.cxx +617 -0
  416. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cxxKinetics.h +78 -0
  417. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cxxMix.cxx +154 -0
  418. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cxxMix.h +58 -0
  419. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/dense.cpp +175 -0
  420. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/dense.h +341 -0
  421. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/dumper.cpp +277 -0
  422. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/dumper.h +60 -0
  423. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/gases.cpp +748 -0
  424. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/global_structures.h +1672 -0
  425. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/input.cpp +133 -0
  426. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/integrate.cpp +1219 -0
  427. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/inverse.cpp +5135 -0
  428. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/isotopes.cpp +1813 -0
  429. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/kinetics.cpp +3180 -0
  430. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/mainsubs.cpp +2320 -0
  431. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/model.cpp +5843 -0
  432. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/nvector.cpp +272 -0
  433. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/nvector.h +485 -0
  434. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/nvector_serial.cpp +1032 -0
  435. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/nvector_serial.h +369 -0
  436. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/parse.cpp +1044 -0
  437. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/phqalloc.cpp +316 -0
  438. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/phqalloc.h +47 -0
  439. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/pitzer.cpp +2709 -0
  440. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/pitzer_structures.cpp +225 -0
  441. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/prep.cpp +6267 -0
  442. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/print.cpp +3673 -0
  443. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/read.cpp +10245 -0
  444. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/readtr.cpp +1495 -0
  445. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/runner.cpp +158 -0
  446. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/runner.h +33 -0
  447. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/sit.cpp +1684 -0
  448. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/smalldense.cpp +324 -0
  449. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/smalldense.h +261 -0
  450. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/spread.cpp +1309 -0
  451. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/step.cpp +1566 -0
  452. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/structures.cpp +3381 -0
  453. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/sundialsmath.cpp +133 -0
  454. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/sundialsmath.h +162 -0
  455. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/sundialstypes.h +183 -0
  456. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/tally.cpp +1288 -0
  457. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/tidy.cpp +5600 -0
  458. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/transport.cpp +6403 -0
  459. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/utilities.cpp +1339 -0
  460. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/thread.h +64 -0
  461. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/CMakeLists.txt +133 -0
  462. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/Makefile.am +45 -0
  463. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/Makefile.in +1128 -0
  464. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/ex2.in +26 -0
  465. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/main.f90 +31 -0
  466. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/main77.f +6 -0
  467. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/main_fortran.cxx +8 -0
  468. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/phreeqc.dat.in +1556 -0
  469. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/test_c.c +148 -0
  470. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/test_cxx.cxx +152 -0
  471. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/test_f90.F90 +328 -0
  472. pyEQL/phreeqc/iphreeqc_wrapper.cpp +75 -0
  473. pyEQL/phreeqc/solution.py +74 -0
  474. pyEQL/phreeqc/var.py +50 -0
  475. pyEQL/presets/Ringers lactate.yaml +20 -0
  476. pyEQL/presets/__init__.py +17 -0
  477. pyEQL/presets/normal saline.yaml +17 -0
  478. pyEQL/presets/rainwater.yaml +17 -0
  479. pyEQL/presets/seawater.yaml +29 -0
  480. pyEQL/presets/urine.yaml +26 -0
  481. pyEQL/presets/wastewater.yaml +21 -0
  482. pyEQL/py.typed +0 -0
  483. pyEQL/salt_ion_match.py +112 -0
  484. pyEQL/solute.py +163 -0
  485. pyEQL/solution.py +2714 -0
  486. pyEQL/utils.py +237 -0
  487. pyeql-1.4.0rc9.dist-info/METADATA +130 -0
  488. pyeql-1.4.0rc9.dist-info/RECORD +491 -0
  489. pyeql-1.4.0rc9.dist-info/WHEEL +6 -0
  490. pyeql-1.4.0rc9.dist-info/licenses/AUTHORS.md +21 -0
  491. pyeql-1.4.0rc9.dist-info/licenses/LICENSE.txt +20 -0
@@ -0,0 +1,2709 @@
1
+ #include "Phreeqc.h"
2
+ #include "phqalloc.h"
3
+ #include "Exchange.h"
4
+ #include "Solution.h"
5
+ #define PITZER_LISTS
6
+ #define PITZER
7
+
8
+ #if defined(PHREEQCI_GUI)
9
+ #ifdef _DEBUG
10
+ #define new DEBUG_NEW
11
+ #undef THIS_FILE
12
+ static char THIS_FILE[] = __FILE__;
13
+ #endif
14
+ #endif
15
+
16
+ /* ---------------------------------------------------------------------- */
17
+ int Phreeqc::
18
+ pitzer_init(void)
19
+ /* ---------------------------------------------------------------------- */
20
+ {
21
+ int i;
22
+ /*
23
+ * Initialization for pitzer
24
+ */
25
+ pitzer_model = FALSE;
26
+ use_etheta = TRUE;
27
+ pitz_params.clear();
28
+ theta_params.clear();
29
+
30
+ ICON = TRUE;
31
+ OTEMP = -100.;
32
+ OPRESS = -100.;
33
+ for (i = 0; i < 23; i++)
34
+ {
35
+ BK[i] = 0.0;
36
+ DK[i] = 0.0;
37
+ }
38
+ pitzer_pe = FALSE;
39
+ VP = 0;
40
+ DW0 = 0;
41
+ return OK;
42
+ }
43
+
44
+ /* ---------------------------------------------------------------------- */
45
+ int Phreeqc::
46
+ pitzer_tidy(void)
47
+ /* ---------------------------------------------------------------------- */
48
+ {
49
+ /*
50
+ * Make lists of species for cations, anions, neutral
51
+ */
52
+ const char *string1, *string2;
53
+ int i, j, order;
54
+ int i0, i1, i2;
55
+ //int count_pos, count_neg, count_neut, count[3], jj;
56
+ int count_neut, count[3], jj;
57
+ LDBLE z0, z1;
58
+ class pitz_param *pzp_ptr;
59
+ class theta_param *theta_param_ptr;
60
+ /*
61
+ * Ensure new parameters are calculated
62
+ */
63
+ OTEMP = -100.;
64
+ OPRESS = -100.;
65
+ /*
66
+ * allocate pointers to species structures
67
+ */
68
+ spec.clear();
69
+ spec.resize(3 * s.size(), NULL);
70
+ cations = &spec[0];
71
+ neutrals = &(spec[s.size()]);
72
+ anions = &(spec[2 * s.size()]);
73
+ MAXCATIONS = (int)s.size();
74
+ FIRSTANION = 2 * (int)s.size();
75
+ MAXNEUTRAL = (int)s.size();
76
+ count_cations = 0;
77
+ count_anions = 0;
78
+ count_neutrals = 0;
79
+ if (itmax < 200)
80
+ itmax = 200;
81
+ /*
82
+ * allocate other arrays for Pitzer
83
+ */
84
+ IPRSNT.resize(3 * s.size());
85
+ M.resize(3 * s.size());
86
+ LGAMMA.resize(3 * s.size());
87
+
88
+ for (i = 0; i < (int)s.size(); i++)
89
+ {
90
+ if (s[i] == s_eminus)
91
+ continue;
92
+ if (s[i] == s_h2o)
93
+ continue;
94
+ if (s[i]->type == EX || s[i]->type == SURF)
95
+ continue;
96
+ if (s[i]->z < -.001)
97
+ {
98
+ anions[count_anions++] = s[i];
99
+ }
100
+ else if (s[i]->z > .001)
101
+ {
102
+ cations[count_cations++] = s[i];
103
+ }
104
+ else
105
+ {
106
+ neutrals[count_neutrals++] = s[i];
107
+ }
108
+ }
109
+ /*
110
+ * Add etheta to parameter list in case theta not defined for
111
+ * cation-cation or anion-anion pair
112
+ * Remove old TYPE_ETHETA definitions
113
+ */
114
+
115
+ std::vector<pitz_param*> pitz_params_temp = pitz_params;
116
+ pitz_params.clear();
117
+
118
+ for (i = 0; i < (int)pitz_params_temp.size(); i++)
119
+ {
120
+ if (pitz_params_temp[i]->type == TYPE_ETHETA)
121
+ {
122
+ delete pitz_params_temp[i];
123
+ }
124
+ else
125
+ {
126
+ pitz_params.push_back(pitz_params_temp[i]);
127
+ }
128
+ }
129
+ for (i = 0; i < count_cations - 1; i++)
130
+ {
131
+ for (j = i + 1; j < count_cations; j++)
132
+ {
133
+ snprintf(line, max_line, "%s %s 1", spec[i]->name, spec[j]->name);
134
+ pzp_ptr = pitz_param_read(line, 2);
135
+ pzp_ptr->type = TYPE_ETHETA;
136
+ size_t count_pitz_param = pitz_params.size();
137
+ pitz_params.resize(count_pitz_param + 1);
138
+ pitz_params[count_pitz_param] = pzp_ptr;
139
+ }
140
+ }
141
+ for (i = 2 * (int)s.size(); i < 2 * (int)s.size() + count_anions - 1; i++)
142
+ {
143
+ for (j = i + 1; j < 2 * (int)s.size() + count_anions; j++)
144
+ {
145
+ snprintf(line, max_line, "%s %s 1", spec[i]->name, spec[j]->name);
146
+ pzp_ptr = pitz_param_read(line, 2);
147
+ pzp_ptr->type = TYPE_ETHETA;
148
+ size_t count_pitz_param = pitz_params.size();
149
+ pitz_params.resize(count_pitz_param + 1);
150
+ pitz_params[count_pitz_param] = pzp_ptr;
151
+ }
152
+ }
153
+ /*
154
+ * put species numbers in pitz_params
155
+ */
156
+ for (i = 0; i < (int)pitz_params.size(); i++)
157
+ {
158
+ for (j = 0; j < 3; j++)
159
+ {
160
+ if (pitz_params[i]->species[j] == NULL)
161
+ continue;
162
+ pitz_params[i]->ispec[j] = ISPEC(pitz_params[i]->species[j]);
163
+ if ((j < 2 && pitz_params[i]->ispec[j] == -1) ||
164
+ (j == 2 && (pitz_params[i]->type == TYPE_PSI || pitz_params[i]->type == TYPE_ZETA)
165
+ && pitz_params[i]->ispec[j] == -1))
166
+ {
167
+ input_error++;
168
+ error_string = sformatf(
169
+ "Species for Pitzer parameter not defined in SOLUTION_SPECIES, %s",
170
+ pitz_params[i]->species[j]);
171
+ error_msg(error_string, CONTINUE);
172
+ return (ERROR);
173
+ }
174
+ }
175
+ }
176
+ /*
177
+ * MacInnes data
178
+ */
179
+ string1 = string_hsave("K+");
180
+ string2 = string_hsave("Cl-");
181
+ IC = ISPEC(string2);
182
+ for (i = 0; i < (int)pitz_params.size(); i++)
183
+ {
184
+ if ((pitz_params[i]->species[0] == string1 &&
185
+ pitz_params[i]->species[1] == string2) ||
186
+ (pitz_params[i]->species[0] == string2 &&
187
+ pitz_params[i]->species[1] == string1) )
188
+ {
189
+ switch (pitz_params[i]->type)
190
+ {
191
+ case TYPE_B0:
192
+ mcb0 = pitz_params[i];
193
+ break;
194
+ case TYPE_B1:
195
+ mcb1 = pitz_params[i];
196
+ break;
197
+ case TYPE_C0:
198
+ mcc0 = pitz_params[i];
199
+ break;
200
+ case TYPE_B2:
201
+ case TYPE_THETA:
202
+ case TYPE_LAMBDA:
203
+ case TYPE_ZETA:
204
+ case TYPE_PSI:
205
+ case TYPE_ETHETA:
206
+ case TYPE_ALPHAS:
207
+ case TYPE_MU:
208
+ case TYPE_ETA:
209
+ case TYPE_Other:
210
+ default:
211
+ break;
212
+ }
213
+ }
214
+ }
215
+ if (mcb0 == NULL && mcb1 == NULL && mcc0 == NULL && ICON == TRUE)
216
+ {
217
+ error_string = sformatf(
218
+ "No KCl interaction parameters, turning off MacInnes scaling.");
219
+ warning_msg(error_string);
220
+ ICON = FALSE;
221
+ }
222
+ /*
223
+ * Set alpha values
224
+ */
225
+ for (i = 0; i < (int)pitz_params.size(); i++)
226
+ {
227
+ z0 = fabs(spec[pitz_params[i]->ispec[0]]->z);
228
+ z1 = fabs(spec[pitz_params[i]->ispec[1]]->z);
229
+ if (equal(z0, 1.0, 1e-8) || equal(z1, 1.0, 1e-8))
230
+ {
231
+ order = 1;
232
+ }
233
+ else if (equal(z0, 2.0, 1e-8) && equal(z1, 2.0, 1e-8))
234
+ {
235
+ order = 2;
236
+ }
237
+ else
238
+ {
239
+ order = 3;
240
+ }
241
+ if (pitz_params[i]->type == TYPE_B1)
242
+ {
243
+ switch (order)
244
+ {
245
+ case 1:
246
+ case 3:
247
+ pitz_params[i]->alpha = 2.0;
248
+ break;
249
+ case 2:
250
+ pitz_params[i]->alpha = 1.4;
251
+ break;
252
+ }
253
+ }
254
+ else if (pitz_params[i]->type == TYPE_B2)
255
+ {
256
+ switch (order)
257
+ {
258
+ case 1:
259
+ pitz_params[i]->alpha = 12.0;
260
+ break;
261
+ case 2:
262
+ pitz_params[i]->alpha = 12.0;
263
+ break;
264
+ case 3:
265
+ pitz_params[i]->alpha = 50.0;
266
+ break;
267
+ }
268
+ }
269
+ }
270
+ /*
271
+ * Add specific alphas
272
+ */
273
+ for (i = 0; i < (int)pitz_params.size(); i++)
274
+ {
275
+ if (pitz_params[i]->type == TYPE_ALPHAS)
276
+ {
277
+ for (j = 0; j < (int)pitz_params.size(); j++)
278
+ {
279
+ if (pitz_params[j]->type != TYPE_B1)
280
+ continue;
281
+ if (pitz_params[i]->ispec[0] != pitz_params[j]->ispec[0])
282
+ continue;
283
+ if (pitz_params[i]->ispec[1] != pitz_params[j]->ispec[1])
284
+ continue;
285
+ pitz_params[j]->alpha = pitz_params[i]->a[0];
286
+ break;
287
+ }
288
+ for (j = 0; j < (int)pitz_params.size(); j++)
289
+ {
290
+ if (pitz_params[j]->type != TYPE_B2)
291
+ continue;
292
+ if (pitz_params[i]->ispec[0] != pitz_params[j]->ispec[0])
293
+ continue;
294
+ if (pitz_params[i]->ispec[1] != pitz_params[j]->ispec[1])
295
+ continue;
296
+ pitz_params[j]->alpha = pitz_params[i]->a[1];
297
+ break;
298
+ }
299
+ }
300
+ }
301
+
302
+ /*
303
+ * Add thetas pointer to etheta pitzer parameters
304
+ */
305
+
306
+ for (i = 0; i < (int)theta_params.size(); i++)
307
+ {
308
+ delete theta_params[i];
309
+ }
310
+ theta_params.clear();
311
+ for (i = 0; i < (int)pitz_params.size(); i++)
312
+ {
313
+ if (pitz_params[i]->type == TYPE_ETHETA)
314
+ {
315
+ z0 = spec[pitz_params[i]->ispec[0]]->z;
316
+ z1 = spec[pitz_params[i]->ispec[1]]->z;
317
+ theta_param_ptr = theta_param_search(z0, z1);
318
+ if (theta_param_ptr == NULL)
319
+ {
320
+ size_t count_theta_param = theta_params.size();
321
+ theta_params.resize(count_theta_param + 1);
322
+ theta_params[count_theta_param] = new class theta_param;
323
+ theta_params[count_theta_param]->zj = z0;
324
+ theta_params[count_theta_param]->zk = z1;
325
+ theta_param_ptr = theta_params[count_theta_param];
326
+ }
327
+ pitz_params[i]->thetas = theta_param_ptr;
328
+ }
329
+ }
330
+ /*
331
+ * Tidy TYPE_MU
332
+ */
333
+
334
+ /* Coef for Osmotic coefficient for TYPE_MU */
335
+
336
+ for (i = 0; i < (int)pitz_params.size(); i++)
337
+ {
338
+ if (pitz_params[i]->type == TYPE_MU)
339
+ {
340
+ i0 = pitz_params[i]->ispec[0];
341
+ i1 = pitz_params[i]->ispec[1];
342
+ i2 = pitz_params[i]->ispec[2];
343
+ //count_pos = count_neg = count_neut = 0;
344
+ count_neut = 0;
345
+ for (j = 0; j <= 2; j++)
346
+ {
347
+ if (spec[pitz_params[i]->ispec[j]]->z > 0)
348
+ {
349
+ //count_pos++;
350
+ }
351
+ if (spec[pitz_params[i]->ispec[j]]->z == 0)
352
+ {
353
+ count_neut++;
354
+ }
355
+ if (spec[pitz_params[i]->ispec[j]]->z < 0)
356
+ {
357
+ //count_neg++;
358
+ }
359
+ }
360
+ /* All neutral */
361
+ if (count_neut == 3)
362
+ {
363
+ if (i0 == i1 && i1 == i2)
364
+ {
365
+ /* type n, n, n */
366
+ pitz_params[i]->os_coef = 1;
367
+ continue;
368
+ }
369
+ else if (i0 == i1 || i1 == i2 || i0 == i2)
370
+ {
371
+ /* type n, n, n' */
372
+ pitz_params[i]->os_coef = 3;
373
+ continue;
374
+ }
375
+ else
376
+ {
377
+ /* type n, n', n'' */
378
+ pitz_params[i]->os_coef = 6;
379
+ continue;
380
+ }
381
+ }
382
+ /* Two neutral, one anion or cation */
383
+ if (i0 == i1 || i1 == i2 || i0 == i2)
384
+ {
385
+ /* type n, n, a|c */
386
+ pitz_params[i]->os_coef = 3;
387
+ continue;
388
+ }
389
+ else
390
+ {
391
+ /* type n, n', a|c */
392
+ pitz_params[i]->os_coef = 6;
393
+ continue;
394
+ }
395
+ }
396
+ }
397
+
398
+ /* Coef for gammas for TYPE_MU */
399
+
400
+ for (i = 0; i < (int)pitz_params.size(); i++)
401
+ {
402
+ if (pitz_params[i]->type == TYPE_MU)
403
+ {
404
+ for (j = 0; j <= 2; j++)
405
+ {
406
+ count[j] = 0;
407
+ for (jj = 0; jj <= 2; jj++)
408
+ {
409
+ if (pitz_params[i]->ispec[j] == pitz_params[i]->ispec[jj])
410
+ {
411
+ count[j]++;
412
+ }
413
+ }
414
+ }
415
+ for (j = 0; j <= 2; j++)
416
+ {
417
+ /* cation or anion */
418
+ if (spec[pitz_params[i]->ispec[j]]->z < 0
419
+ || spec[pitz_params[i]->ispec[j]]->z > 0)
420
+ {
421
+ if (count[0] > 1 || count[1] > 1)
422
+ {
423
+ pitz_params[i]->ln_coef[j] = 3;
424
+ }
425
+ else
426
+ {
427
+ pitz_params[i]->ln_coef[j] = 6;
428
+ }
429
+ continue;
430
+ }
431
+ /* Neutral */
432
+ if (count[j] == 3)
433
+ {
434
+ pitz_params[i]->ln_coef[j] = 1;
435
+ }
436
+ else if (count[j] == 2)
437
+ {
438
+ pitz_params[i]->ln_coef[j] = 3;
439
+ }
440
+ else if (count[j] == 1)
441
+ {
442
+ if (count[0] > 1 || count[1] > 1)
443
+ {
444
+ pitz_params[i]->ln_coef[j] = 3;
445
+ }
446
+ else
447
+ {
448
+ pitz_params[i]->ln_coef[j] = 6;
449
+ }
450
+ }
451
+ }
452
+ }
453
+ }
454
+ /* Debug TYPE_MU coefficients */
455
+ /*
456
+ for (i = 0; i < (int)pitz_params.size(); i++)
457
+ {
458
+ if (pitz_params[i]->type == TYPE_MU)
459
+ {
460
+ fprintf(stderr, "%s\t%s\t%s\n", pitz_params[i]->species[0], pitz_params[i]->species[1], pitz_params[i]->species[2]);
461
+ fprintf(stderr, "%f\t%f\t%f\n", pitz_params[i]->ln_coef[0], pitz_params[i]->ln_coef[1], pitz_params[i]->ln_coef[2]);
462
+ fprintf(stderr, "%f\n\n", pitz_params[i]->os_coef);
463
+ }
464
+ }
465
+ */
466
+ /*
467
+ * Tidy TYPE_LAMBDA
468
+ */
469
+
470
+ /* Coef for Osmotic coefficient for TYPE_LAMBDA */
471
+
472
+ for (i = 0; i < (int)pitz_params.size(); i++)
473
+ {
474
+ if (pitz_params[i]->type == TYPE_LAMBDA)
475
+ {
476
+ i0 = pitz_params[i]->ispec[0];
477
+ i1 = pitz_params[i]->ispec[1];
478
+ /* All neutral */
479
+ if (i0 == i1)
480
+ {
481
+ /* type n, n */
482
+ pitz_params[i]->os_coef = 0.5;
483
+ pitz_params[i]->ln_coef[0] = 1;
484
+ pitz_params[i]->ln_coef[1] = 1;
485
+ }
486
+ else
487
+ {
488
+ /* type nn', na, nc */
489
+ pitz_params[i]->os_coef = 1;
490
+ pitz_params[i]->ln_coef[0] = 2;
491
+ pitz_params[i]->ln_coef[1] = 2;
492
+ }
493
+ }
494
+ }
495
+ /* Debug TYPE_LAMBDA coefficients */
496
+ /*
497
+ for (i = 0; i < (int)pitz_params.size(); i++)
498
+ {
499
+ if (pitz_params[i]->type == TYPE_LAMBDA)
500
+ {
501
+ fprintf(stderr, "%s\t%s\n", pitz_params[i]->species[0], pitz_params[i]->species[1]);
502
+ fprintf(stderr, "%f\t%f\n", pitz_params[i]->ln_coef[0], pitz_params[i]->ln_coef[1]);
503
+ fprintf(stderr, "%f\n\n", pitz_params[i]->os_coef);
504
+ }
505
+ }
506
+ */
507
+ /* remake map */
508
+ {
509
+ pitz_param_map.clear();
510
+ for (int j = 0; j < (int)pitz_params.size(); j++)
511
+ {
512
+ std::set< std::string > header;
513
+ for (int i = 0; i < 3; i++)
514
+ {
515
+ if (pitz_params[j]->species[i] != NULL) header.insert(pitz_params[j]->species[i]);
516
+ }
517
+ std::ostringstream key_str;
518
+ key_str << pitz_params[j]->type << " ";
519
+ std::set< std::string >::iterator it = header.begin();
520
+ for(; it != header.end(); ++it)
521
+ {
522
+ key_str << *it << " ";
523
+ }
524
+ std::string key = key_str.str().c_str();
525
+ pitz_param_map[key] = j;
526
+ }
527
+ assert ((int) pitz_param_map.size() == (int)pitz_params.size());
528
+ }
529
+ return OK;
530
+ }
531
+
532
+ /* ---------------------------------------------------------------------- */
533
+ int Phreeqc::
534
+ ISPEC(const char *name)
535
+ /* ---------------------------------------------------------------------- */
536
+ /*
537
+ * Find species number in spec for character string species name
538
+ */
539
+ {
540
+ int i;
541
+ for (i = 0; i < 3 * (int)s.size(); i++)
542
+ {
543
+ if (spec[i] == NULL)
544
+ continue;
545
+ if (name == spec[i]->name)
546
+ {
547
+ return (i);
548
+ }
549
+ }
550
+ return (-1);
551
+ }
552
+
553
+ /* ---------------------------------------------------------------------- */
554
+ int Phreeqc::
555
+ read_pitzer(void)
556
+ /* ---------------------------------------------------------------------- */
557
+ {
558
+ /*
559
+ * Reads advection information
560
+ *
561
+ * Arguments:
562
+ * none
563
+ *
564
+ * Returns:
565
+ * KEYWORD if keyword encountered, input_error may be incremented if
566
+ * a keyword is encountered in an unexpected position
567
+ * EOF if eof encountered while reading mass balance concentrations
568
+ * ERROR if error occurred reading data
569
+ *
570
+ */
571
+ /*
572
+ * Read advection parameters:
573
+ * number of cells;
574
+ * number of shifts;
575
+ */
576
+ int n;
577
+ class pitz_param *pzp_ptr;
578
+ pitz_param_type pzp_type;
579
+
580
+ int return_value, opt, opt_save;
581
+ const char* next_char;
582
+ const char *opt_list[] = {
583
+ "b0", /* 0 */
584
+ "b1", /* 1 */
585
+ "b2", /* 2 */
586
+ "c0", /* 3 */
587
+ "theta", /* 4 */
588
+ "lamda", /* 5 */
589
+ "zeta", /* 6 */
590
+ "psi", /* 7 */
591
+ "macinnes", /* 8 */
592
+ "macinnis", /* 9 */
593
+ "mac", /* 10 */
594
+ "redox", /* 11 */
595
+ "pe", /* 12 */
596
+ "alphas", /* 13 */
597
+ "mu", /* 14 */
598
+ "eta", /* 15 */
599
+ "etheta", /* 16 */
600
+ "use_etheta", /* 17 */
601
+ "lambda", /* 18 */
602
+ "aphi" /* 19 */
603
+ };
604
+ int count_opt_list = 20;
605
+ /*
606
+ * Read lines
607
+ */
608
+ opt_save = OPTION_ERROR;
609
+ return_value = UNKNOWN;
610
+ n = -1;
611
+ pzp_type = TYPE_Other;
612
+ for (;;)
613
+ {
614
+ opt = get_option(opt_list, count_opt_list, &next_char);
615
+ if (opt == OPTION_DEFAULT)
616
+ {
617
+ opt = opt_save;
618
+ }
619
+ switch (opt)
620
+ {
621
+ case OPTION_EOF: /* end of file */
622
+ return_value = EOF;
623
+ break;
624
+ case OPTION_KEYWORD: /* keyword */
625
+ return_value = KEYWORD;
626
+ break;
627
+ case OPTION_DEFAULT:
628
+ pzp_ptr = pitz_param_read(line, n);
629
+ if (pzp_ptr != NULL)
630
+ {
631
+ pzp_ptr->type = pzp_type;
632
+ if (pzp_type == TYPE_APHI)
633
+ {
634
+ delete aphi;
635
+ aphi = pzp_ptr;
636
+ }
637
+ else
638
+ {
639
+ pitz_param_store(pzp_ptr);
640
+ }
641
+ }
642
+ break;
643
+ case OPTION_ERROR:
644
+ input_error++;
645
+ error_msg("Unknown input in PITZER keyword.", CONTINUE);
646
+ error_msg(line_save, CONTINUE);
647
+ break;
648
+ case 0: /* b0 */
649
+ pzp_type = TYPE_B0;
650
+ n = 2;
651
+ opt_save = OPTION_DEFAULT;
652
+ break;
653
+ case 1: /* b1 */
654
+ pzp_type = TYPE_B1;
655
+ n = 2;
656
+ opt_save = OPTION_DEFAULT;
657
+ break;
658
+ case 2: /* b2 */
659
+ pzp_type = TYPE_B2;
660
+ n = 2;
661
+ opt_save = OPTION_DEFAULT;
662
+ break;
663
+ case 3: /* c0 */
664
+ pzp_type = TYPE_C0;
665
+ n = 2;
666
+ opt_save = OPTION_DEFAULT;
667
+ break;
668
+ case 4: /* theta */
669
+ pzp_type = TYPE_THETA;
670
+ n = 2;
671
+ opt_save = OPTION_DEFAULT;
672
+ break;
673
+ case 5: /* lamda */
674
+ case 18: /* lambda */
675
+ pzp_type = TYPE_LAMBDA;
676
+ n = 2;
677
+ opt_save = OPTION_DEFAULT;
678
+ break;
679
+ case 6: /* zeta */
680
+ pzp_type = TYPE_ZETA;
681
+ n = 3;
682
+ opt_save = OPTION_DEFAULT;
683
+ break;
684
+ case 7: /* psi */
685
+ pzp_type = TYPE_PSI;
686
+ n = 3;
687
+ opt_save = OPTION_DEFAULT;
688
+ break;
689
+ case 13: /* alphas */
690
+ pzp_type = TYPE_ALPHAS;
691
+ n = 2;
692
+ opt_save = OPTION_DEFAULT;
693
+ break;
694
+ case 8: /* macinnes */
695
+ case 9: /* macinnis */
696
+ case 10: /* mac */
697
+ opt_save = OPTION_ERROR;
698
+ ICON = get_true_false(next_char, TRUE);
699
+ break;
700
+ case 11: /* redox */
701
+ case 12: /* pe */
702
+ opt_save = OPTION_ERROR;
703
+ pitzer_pe = get_true_false(next_char, TRUE);
704
+ break;
705
+ case 14: /* mu */
706
+ pzp_type = TYPE_MU;
707
+ n = 3;
708
+ opt_save = OPTION_DEFAULT;
709
+ break;
710
+ case 15: /* eta */
711
+ pzp_type = TYPE_ETA;
712
+ n = 3;
713
+ opt_save = OPTION_DEFAULT;
714
+ break;
715
+ case 16: /* etheta */
716
+ case 17: /* use_etheta */
717
+ opt_save = OPTION_ERROR;
718
+ use_etheta = get_true_false(next_char, TRUE);
719
+ break;
720
+ case 19: /* aphi */
721
+ pzp_type = TYPE_APHI;
722
+ n = 0;
723
+ opt_save = OPTION_DEFAULT;
724
+ break;
725
+ }
726
+ if (return_value == EOF || return_value == KEYWORD)
727
+ break;
728
+ }
729
+ pitzer_model = TRUE;
730
+ return (return_value);
731
+ }
732
+
733
+ /* ---------------------------------------------------------------------- */
734
+ int Phreeqc::
735
+ PTEMP(LDBLE TK)
736
+ /* ---------------------------------------------------------------------- */
737
+ {
738
+ /*
739
+ C
740
+ C SUBROUTINE TO CALCULATE TEMPERATURE DEPENDENCE OF PITZER PARAMETER
741
+ C
742
+ */
743
+ LDBLE TR = 298.15;
744
+
745
+ if (fabs(TK - OTEMP) < 0.001 && fabs(patm_x - OPRESS) < 0.1)
746
+ return OK;
747
+ DW0 = rho_0 = calc_rho_0(TK - 273.15, patm_x);
748
+ VP = patm_x;
749
+ #if !defined(PITZER_LISTS)
750
+ int i;
751
+ for (i = 0; i < (int)pitz_params.size(); i++)
752
+ {
753
+ calc_pitz_param(pitz_params[i], TK, TR);
754
+ }
755
+ #else
756
+ for (size_t j = 0; j < param_list.size(); j++)
757
+ {
758
+ int i = param_list[j];
759
+ calc_pitz_param(pitz_params[i], TK, TR);
760
+ }
761
+ if (aphi)
762
+ {
763
+ calc_pitz_param(aphi, TK, TR);
764
+ }
765
+ if (mcb0)
766
+ {
767
+ calc_pitz_param(mcb0, TK, TR);
768
+ }
769
+ if (mcb1)
770
+ {
771
+ calc_pitz_param(mcb1, TK, TR);
772
+ }
773
+ if (mcc0)
774
+ {
775
+ calc_pitz_param(mcc0, TK, TR);
776
+ }
777
+ #endif
778
+ calc_dielectrics(TK - 273.15, patm_x);
779
+ OTEMP = TK;
780
+ OPRESS = patm_x;
781
+ return OK;
782
+ }
783
+
784
+ /* ---------------------------------------------------------------------- */
785
+ int Phreeqc::
786
+ calc_pitz_param(class pitz_param *pz_ptr, LDBLE TK, LDBLE TR)
787
+ /* ---------------------------------------------------------------------- */
788
+ {
789
+ LDBLE param;
790
+ /*
791
+ */
792
+ if (fabs(TK - TR) < 0.001)
793
+ {
794
+ param = pz_ptr->a[0];
795
+ }
796
+ else
797
+ {
798
+ param = (pz_ptr->a[0] +
799
+ pz_ptr->a[1] * (1.e0 / TK - 1.e0 / TR) +
800
+ pz_ptr->a[2] * log(TK / TR) +
801
+ pz_ptr->a[3] * (TK - TR) +
802
+ pz_ptr->a[4] * (TK * TK - TR * TR)) +
803
+ pz_ptr->a[5] * (1.e0 / (TK * TK) - 1.e0 / (TR * TR));
804
+ }
805
+ pz_ptr->p = param;
806
+ switch (pz_ptr->type)
807
+ {
808
+ case TYPE_B0:
809
+ pz_ptr->U.b0 = param;
810
+ break;
811
+ case TYPE_B1:
812
+ pz_ptr->U.b1 = param;
813
+ break;
814
+ case TYPE_B2:
815
+ pz_ptr->U.b2 = param;
816
+ break;
817
+ case TYPE_C0:
818
+ pz_ptr->U.c0 = param;
819
+ break;
820
+ case TYPE_THETA:
821
+ pz_ptr->U.theta = param;
822
+ break;
823
+ case TYPE_LAMBDA:
824
+ pz_ptr->U.lambda = param;
825
+ break;
826
+ case TYPE_ZETA:
827
+ pz_ptr->U.zeta = param;
828
+ break;
829
+ case TYPE_ETHETA:
830
+ break;
831
+ case TYPE_PSI:
832
+ pz_ptr->U.psi = param;
833
+ break;
834
+ case TYPE_ALPHAS:
835
+ break;
836
+ case TYPE_MU:
837
+ pz_ptr->U.mu = param;
838
+ break;
839
+ case TYPE_ETA:
840
+ pz_ptr->U.eta = param;
841
+ break;
842
+ case TYPE_APHI:
843
+ pz_ptr->U.aphi = param;
844
+ break;
845
+ case TYPE_Other:
846
+ default:
847
+ error_msg("Should not be TYPE_Other in function calc_pitz_param",
848
+ STOP);
849
+ break;
850
+ }
851
+ return OK;
852
+ }
853
+ #if !defined(PITZER_LISTS)
854
+ /* ---------------------------------------------------------------------- */
855
+ int Phreeqc::
856
+ pitzer(void)
857
+ /* ---------------------------------------------------------------------- */
858
+ {
859
+ int i, i0, i1, i2;
860
+ LDBLE param, l_alpha, z0, z1;
861
+ LDBLE etheta, ethetap;
862
+ /*
863
+ LDBLE CONV, XI, XX, OSUM, BIGZ, DI, F, XXX, GAMCLM,
864
+ CSUM, PHIMAC, OSMOT, BMXP, ETHEAP, CMX, BMX, PHI,
865
+ BMXPHI, PHIPHI, AW, A, B;
866
+ */
867
+ LDBLE CONV, XX, OSUM, BIGZ, DI, F, F1, F2, F_var, XXX, GAMCLM, CSUM, PHIMAC, OSMOT,
868
+ B, B1, B2;
869
+ LDBLE I, TK;
870
+ /*
871
+ C
872
+ C INITIALIZE
873
+ C
874
+ */
875
+ CONV = 1.0 / LOG_10;
876
+ XX = 0.0;
877
+ OSUM = 0.0;
878
+ /*n
879
+ I = *I_X;
880
+ TK = *TK_X;
881
+ */
882
+ I = mu_x;
883
+ TK = tk_x;
884
+ /* DH_AB(TK, &A, &B); */
885
+ /*
886
+ C
887
+ C TRANSFER DATA FROM TO M
888
+ C
889
+ */
890
+ for (i = 0; i < 3 * (int)s.size(); i++)
891
+ {
892
+ IPRSNT[i] = FALSE;
893
+ M[i] = 0.0;
894
+ if (spec[i] != NULL && spec[i]->in == TRUE)
895
+ {
896
+ if (spec[i]->type == EX ||
897
+ spec[i]->type == SURF || spec[i]->type == SURF_PSI)
898
+ continue;
899
+ M[i] = under(spec[i]->lm);
900
+ if (M[i] > MIN_TOTAL)
901
+ IPRSNT[i] = TRUE;
902
+ }
903
+ }
904
+ if (ICON == TRUE)
905
+ {
906
+ IPRSNT[IC] = TRUE;
907
+ }
908
+ /*
909
+ ICON = 0;
910
+ M[1] = 1.40070736;
911
+ M[4] = 2.52131086E-05;
912
+ M[140] = 4.59985435E-09;
913
+ */
914
+
915
+ /*
916
+ C
917
+ C COMPUTE PITZER COEFFICIENTS' TEMPERATURE DEPENDENCE
918
+ C
919
+ */
920
+ PTEMP(TK);
921
+ for (i = 0; i < 2 * (int)s.size() + count_anions; i++)
922
+ {
923
+ LGAMMA[i] = 0.0;
924
+ if (IPRSNT[i] == TRUE)
925
+ {
926
+ XX = XX + M[i] * fabs(spec[i]->z);
927
+ OSUM = OSUM + M[i];
928
+ }
929
+ }
930
+ /*
931
+ C
932
+ C EQUATION (8)
933
+ C
934
+ */
935
+ BIGZ = XX;
936
+ DI = sqrt(I);
937
+ /*
938
+ C
939
+ C CALCULATE F & GAMCLM
940
+ C
941
+ */
942
+ B = 1.2;
943
+ F = F1 = F2 = -A0 * (DI / (1.0 + B * DI) + 2.0 * log(1.0 + B * DI) / B);
944
+ if (patm_x > 1.0)
945
+ {
946
+ LDBLE pap;
947
+ pap = (7e-5 + 1.93e-9 * pow(TK - 250.0, 2.0)) * patm_x;
948
+ B1 = B - (pap > 0.2 ? 0.2 : pap);
949
+ pap = (9.65e-10 * pow(TK - 263.0, 2.773)) * pow(patm_x, 0.623);
950
+ //pap = (-5.22e-4 + 7.19e-8 * pow(TK - 263.0, 2.0)) * pow(patm_x, 0.623);
951
+ B2 = B - (pap > 0.2 ? 0.2 : pap);
952
+ if (B1 != 0)
953
+ F1 = -A0 * (DI / (1.0 + B1 * DI) + 2.0 * log(1.0 + B1 * DI) / B1);
954
+ if (B2 != 0)
955
+ F2 = -A0 * (DI / (1.0 + B2 * DI) + 2.0 * log(1.0 + B2 * DI) / B2);
956
+ }
957
+ XXX = 2.0 * DI;
958
+ XXX =
959
+ (1.0 - (1.0 + XXX - XXX * XXX * 0.5) * exp(-XXX)) / (XXX * XXX);
960
+ /*GAMCLM=F+I*2.0e0*(BCX(1,IK,IC)+BCX(2,IK,IC)*XXX)+1.5e0*BCX(4,IK,IC)*I*I; */
961
+ /*GAMCLM=F+I*2.0e0*(mcb0->U.b0 + mcb1->U.b1*XXX) + 1.5e0*mcc0->U.c0*I*I; */
962
+ /*GAMCLM = F + I * 2.0e0 * (mcb0->p + mcb1->p * XXX) + 1.5e0 * mcc0->p * I * I; */
963
+ GAMCLM = F1;
964
+ if (mcb0 != NULL)
965
+ GAMCLM += I * 2.0 * mcb0->p;
966
+ if (mcb1 != NULL)
967
+ GAMCLM += I * 2.0 * mcb1->p * XXX;
968
+ if (mcc0 != NULL)
969
+ GAMCLM += 1.5 * mcc0->p * I * I;
970
+ CSUM = 0.0;
971
+ OSMOT = -(A0) * pow(I, (LDBLE) 1.5) / (1.0 + B * DI);
972
+ /*
973
+ * Calculate ethetas
974
+ */
975
+ for (i = 0; i < (int)theta_params.size(); i++)
976
+ {
977
+ z0 = theta_params[i]->zj;
978
+ z1 = theta_params[i]->zk;
979
+ ETHETAS(z0, z1, I, &etheta, &ethetap);
980
+ theta_params[i]->etheta = etheta;
981
+ theta_params[i]->ethetap = ethetap;
982
+ }
983
+ /*
984
+ * Sums for F, LGAMMA, and OSMOT
985
+ */
986
+ for (i = 0; i < (int)pitz_params.size(); i++)
987
+ {
988
+ i0 = pitz_params[i]->ispec[0];
989
+ i1 = pitz_params[i]->ispec[1];
990
+ if (IPRSNT[i0] == FALSE || IPRSNT[i1] == FALSE)
991
+ continue;
992
+ z0 = spec[i0]->z;
993
+ z1 = spec[i1]->z;
994
+ param = pitz_params[i]->p;
995
+ l_alpha = pitz_params[i]->alpha;
996
+ F_var = 0;
997
+ switch (pitz_params[i]->type)
998
+ {
999
+ case TYPE_B0:
1000
+ LGAMMA[i0] += M[i1] * 2.0 * param;
1001
+ LGAMMA[i1] += M[i0] * 2.0 * param;
1002
+ OSMOT += M[i0] * M[i1] * param;
1003
+ break;
1004
+ case TYPE_B1:
1005
+ if (param != 0.0)
1006
+ {
1007
+ F_var = M[i0] * M[i1] * param * GP(l_alpha * DI) / I;
1008
+ LGAMMA[i0] += M[i1] * 2.0 * param * G(l_alpha * DI);
1009
+ LGAMMA[i1] += M[i0] * 2.0 * param * G(l_alpha * DI);
1010
+ OSMOT += M[i0] * M[i1] * param * exp(-l_alpha * DI);
1011
+ }
1012
+ break;
1013
+ case TYPE_B2:
1014
+ if (param != 0.0)
1015
+ {
1016
+ F_var = M[i0] * M[i1] * param * GP(l_alpha * DI) / I;
1017
+ LGAMMA[i0] += M[i1] * 2.0 * param * G(l_alpha * DI);
1018
+ LGAMMA[i1] += M[i0] * 2.0 * param * G(l_alpha * DI);
1019
+ OSMOT += M[i0] * M[i1] * param * exp(-l_alpha * DI);
1020
+ }
1021
+ break;
1022
+ case TYPE_C0:
1023
+ CSUM +=
1024
+ M[i0] * M[i1] * pitz_params[i]->p / (2.0 *
1025
+ sqrt(fabs(z0 * z1)));
1026
+ LGAMMA[i0] += M[i1] * BIGZ * param / (2.0 * sqrt(fabs(z0 * z1)));
1027
+ LGAMMA[i1] += M[i0] * BIGZ * param / (2.0 * sqrt(fabs(z0 * z1)));
1028
+ OSMOT +=
1029
+ M[i0] * M[i1] * BIGZ * param / (2.0 * sqrt(fabs(z0 * z1)));
1030
+ break;
1031
+ case TYPE_THETA:
1032
+ LGAMMA[i0] += 2.0 * M[i1] * (param /*+ ETHETA(z0, z1, I) */ );
1033
+ LGAMMA[i1] += 2.0 * M[i0] * (param /*+ ETHETA(z0, z1, I) */ );
1034
+ OSMOT += M[i0] * M[i1] * param;
1035
+ break;
1036
+ case TYPE_ETHETA:
1037
+ /*
1038
+ ETHETAS(z0, z1, I, &etheta, &ethetap);
1039
+ */
1040
+ if (use_etheta == TRUE)
1041
+ {
1042
+ etheta = pitz_params[i]->thetas->etheta;
1043
+ ethetap = pitz_params[i]->thetas->ethetap;
1044
+ F_var = M[i0] * M[i1] * ethetap;
1045
+ LGAMMA[i0] += 2.0 * M[i1] * etheta;
1046
+ LGAMMA[i1] += 2.0 * M[i0] * etheta;
1047
+ OSMOT += M[i0] * M[i1] * (etheta + I * ethetap);
1048
+ /*
1049
+ F += M[i0]*M[i1]*ETHETAP(z0, z1, I);
1050
+ LGAMMA[i0] += 2.0*M[i1]*(ETHETA(z0, z1, I) );
1051
+ LGAMMA[i1] += 2.0*M[i0]*(ETHETA(z0, z1, I) );
1052
+ OSMOT += M[i0]*M[i1]*(ETHETA(z0, z1, I) + I*ETHETAP(z0, z1, I) );
1053
+ */
1054
+ }
1055
+ break;
1056
+ case TYPE_PSI:
1057
+ i2 = pitz_params[i]->ispec[2];
1058
+ if (IPRSNT[i2] == FALSE)
1059
+ continue;
1060
+ LGAMMA[i0] += M[i1] * M[i2] * param;
1061
+ LGAMMA[i1] += M[i0] * M[i2] * param;
1062
+ LGAMMA[i2] += M[i0] * M[i1] * param;
1063
+ OSMOT += M[i0] * M[i1] * M[i2] * param;
1064
+ break;
1065
+ case TYPE_LAMBDA:
1066
+ LGAMMA[i0] += M[i1] * param * pitz_params[i]->ln_coef[0];
1067
+ LGAMMA[i1] += M[i0] * param * pitz_params[i]->ln_coef[1];
1068
+ OSMOT += M[i0] * M[i1] * param * pitz_params[i]->os_coef;
1069
+ break;
1070
+ case TYPE_ZETA:
1071
+ i2 = pitz_params[i]->ispec[2];
1072
+ if (IPRSNT[i2] == FALSE)
1073
+ continue;
1074
+ LGAMMA[i0] += M[i1] * M[i2] * param;
1075
+ LGAMMA[i1] += M[i0] * M[i2] * param;
1076
+ LGAMMA[i2] += M[i0] * M[i1] * param;
1077
+ OSMOT += M[i0] * M[i1] * M[i2] * param;
1078
+ break;
1079
+ case TYPE_MU:
1080
+ i2 = pitz_params[i]->ispec[2];
1081
+ if (IPRSNT[i2] == FALSE)
1082
+ continue;
1083
+
1084
+ LGAMMA[i0] += M[i1] * M[i2] * param * pitz_params[i]->ln_coef[0];
1085
+ LGAMMA[i1] += M[i0] * M[i2] * param * pitz_params[i]->ln_coef[1];
1086
+ LGAMMA[i2] += M[i0] * M[i1] * param * pitz_params[i]->ln_coef[2];
1087
+ OSMOT += M[i0] * M[i1] * M[i2] * param * pitz_params[i]->os_coef;
1088
+ break;
1089
+ case TYPE_ETA:
1090
+ i2 = pitz_params[i]->ispec[2];
1091
+ if (IPRSNT[i2] == FALSE)
1092
+ continue;
1093
+ LGAMMA[i0] += M[i1] * M[i2] * param;
1094
+ LGAMMA[i1] += M[i0] * M[i2] * param;
1095
+ LGAMMA[i2] += M[i0] * M[i1] * param;
1096
+ OSMOT += M[i0] * M[i1] * M[i2] * param;
1097
+ break;
1098
+ case TYPE_ALPHAS:
1099
+ break;
1100
+ case TYPE_Other:
1101
+ default:
1102
+ error_msg("TYPE_Other in pitz_param list.", STOP);
1103
+ break;
1104
+ }
1105
+ F += F_var;
1106
+ F1 += F_var;
1107
+ F2 += F_var;
1108
+ }
1109
+
1110
+ /*
1111
+ * Add F and CSUM terms to LGAMMA
1112
+ */
1113
+
1114
+ for (i = 0; i < count_cations; i++)
1115
+ {
1116
+ if (!IPRSNT[i])
1117
+ continue;
1118
+ z0 = fabs(spec[i]->z);
1119
+ F_var = (z0 == 1 ? F1 : (z0 == 2.0 ? F2 : F));
1120
+ LGAMMA[i] += z0 * z0 * F_var + z0 * CSUM;
1121
+ }
1122
+ for (i = 2 * (int)s.size(); i < 2 * (int)s.size() + count_anions; i++)
1123
+ {
1124
+ if (!IPRSNT[i])
1125
+ continue;
1126
+ z0 = fabs(spec[i]->z);
1127
+ F_var = (z0 == 1 ? F1 : (z0 == 2.0 ? F2 : F));
1128
+ LGAMMA[i] += z0 * z0 * F_var + z0 * CSUM;
1129
+ }
1130
+ /*
1131
+ C
1132
+ C CONVERT TO MACINNES CONVENTION
1133
+ C
1134
+ */
1135
+ if (ICON == TRUE)
1136
+ {
1137
+ PHIMAC = LGAMMA[IC] - GAMCLM;
1138
+ /*
1139
+ C
1140
+ C CORRECTED ERROR IN PHIMAC, NOVEMBER, 1989
1141
+ C
1142
+ */
1143
+ for (i = 0; i < 2 * (int)s.size() + count_anions; i++)
1144
+ {
1145
+ if (IPRSNT[i] == TRUE)
1146
+ {
1147
+ LGAMMA[i] = LGAMMA[i] + spec[i]->z * PHIMAC;
1148
+ }
1149
+ }
1150
+ }
1151
+
1152
+ COSMOT = 1.0 + 2.0 * OSMOT / OSUM;
1153
+ /*
1154
+ C
1155
+ C CALCULATE THE ACTIVITY OF WATER
1156
+ C
1157
+ */
1158
+ AW = exp(-OSUM * COSMOT / 55.50837);
1159
+ /*
1160
+ if (AW > 1.0)
1161
+ AW = 1.0;
1162
+ */
1163
+ /*s_h2o->la=log10(AW); */
1164
+ mu_x = I;
1165
+ for (i = 0; i < 2 * (int)s.size() + count_anions; i++)
1166
+ {
1167
+ if (IPRSNT[i] == FALSE)
1168
+ continue;
1169
+ /*spec[i]->lg=LGAMMA[i]*CONV; */
1170
+ spec[i]->lg_pitzer = LGAMMA[i] * CONV;
1171
+ /*
1172
+ output_msg(sformatf( "%d %s:\t%e\t%e\t%e\t%e \n", i, spec[i]->name, M[i], spec[i]->la, spec[i]->lg_pitzer, spec[i]->lg));
1173
+ */
1174
+ }
1175
+ /*
1176
+ output_msg(sformatf( "OSUM: %e\n", OSUM));
1177
+ output_msg(sformatf( "OSMOT: %e\n", OSMOT));
1178
+ output_msg(sformatf( "COSMOT: %e\n", COSMOT));
1179
+ output_msg(sformatf( "F: %e\n", F));
1180
+ output_msg(sformatf( "AW: %e\n", AW));
1181
+ */
1182
+ /*
1183
+ *I_X = I;
1184
+ *COSMOT_X = COSMOT;
1185
+ */
1186
+ return (OK);
1187
+ }
1188
+ #else
1189
+ /* ---------------------------------------------------------------------- */
1190
+ int Phreeqc::
1191
+ pitzer(void)
1192
+ /* ---------------------------------------------------------------------- */
1193
+ {
1194
+ int i, i0, i1, i2;
1195
+ LDBLE param, l_alpha, z0, z1;
1196
+ LDBLE etheta, ethetap;
1197
+ /*
1198
+ LDBLE CONV, XI, XX, OSUM, BIGZ, DI, F, XXX, GAMCLM,
1199
+ CSUM, PHIMAC, OSMOT, BMXP, ETHEAP, CMX, BMX, PHI,
1200
+ BMXPHI, PHIPHI, AW, A, B;
1201
+ */
1202
+ LDBLE CONV, XX, OSUM, BIGZ, DI, F, F1, F2, F_var, XXX, GAMCLM, CSUM, PHIMAC, OSMOT,
1203
+ B, B1, B2;
1204
+ LDBLE I, TK;
1205
+ /*
1206
+ C
1207
+ C INITIALIZE
1208
+ C
1209
+ */
1210
+ CONV = 1.0 / LOG_10;
1211
+ XX = 0.0;
1212
+ OSUM = 0.0;
1213
+ I = mu_x;
1214
+ TK = tk_x;
1215
+ /* DH_AB(TK, &A, &B); */
1216
+ /*
1217
+ C
1218
+ C TRANSFER DATA FROM TO M
1219
+ C
1220
+ */
1221
+ for (size_t j = 0; j < s_list.size(); j++)
1222
+ {
1223
+ i = s_list[j];
1224
+ IPRSNT[i] = FALSE;
1225
+ M[i] = 0.0;
1226
+ if (spec[i] != NULL && spec[i]->in == TRUE)
1227
+ {
1228
+ if (spec[i]->type == EX ||
1229
+ spec[i]->type == SURF || spec[i]->type == SURF_PSI)
1230
+ continue;
1231
+ M[i] = under(spec[i]->lm);
1232
+ if (M[i] > MIN_TOTAL)
1233
+ IPRSNT[i] = TRUE;
1234
+ }
1235
+ }
1236
+ if (ICON == TRUE)
1237
+ {
1238
+ IPRSNT[IC] = TRUE;
1239
+ }
1240
+ /*
1241
+ C
1242
+ C COMPUTE PITZER COEFFICIENTS' TEMPERATURE DEPENDENCE
1243
+ C
1244
+ */
1245
+ PTEMP(TK);
1246
+ for (size_t j = 0; j < s_list.size(); j++)
1247
+ {
1248
+ int i = s_list[j];
1249
+ LGAMMA[i] = 0.0;
1250
+ XX = XX + M[i] * fabs(spec[i]->z);
1251
+ OSUM = OSUM + M[i];
1252
+ }
1253
+ /*
1254
+ C
1255
+ C EQUATION (8)
1256
+ C
1257
+ */
1258
+ BIGZ = XX;
1259
+ DI = sqrt(I);
1260
+ /*
1261
+ C
1262
+ C CALCULATE F & GAMCLM
1263
+ C
1264
+ */
1265
+ B = 1.2;
1266
+ F = F1 = F2 = -A0 * (DI / (1.0 + B * DI) + 2.0 * log(1.0 + B * DI) / B);
1267
+ if (patm_x > 1.0)
1268
+ {
1269
+ LDBLE pap = 0.0;
1270
+ pap = (7e-5 + 1.93e-9 * pow(TK - 250.0, 2.0)) * patm_x;
1271
+ B1 = B - (pap > 0.2 ? 0.2 : pap);
1272
+ if (TK > 263.0)
1273
+ {
1274
+ pap = (9.65e-10 * pow(TK - 263.0, 2.773)) * pow(patm_x, 0.623);
1275
+ //pap = (-5.22e-4 + 7.19e-8 * pow(TK - 263.0, 2.0)) * pow(patm_x, 0.623);
1276
+ }
1277
+ B2 = B - (pap > 0.2 ? 0.2 : pap);
1278
+ if (B1 != 0)
1279
+ F1 = -A0 * (DI / (1.0 + B1 * DI) + 2.0 * log(1.0 + B1 * DI) / B1);
1280
+ if (B2 != 0)
1281
+ F2 = -A0 * (DI / (1.0 + B2 * DI) + 2.0 * log(1.0 + B2 * DI) / B2);
1282
+ }
1283
+ XXX = 2.0 * DI;
1284
+ XXX = (1.0 - (1.0 + XXX - XXX * XXX * 0.5) * exp(-XXX)) / (XXX * XXX);
1285
+ GAMCLM = F1;
1286
+ if (mcb0 != NULL)
1287
+ GAMCLM += I * 2.0 * mcb0->p;
1288
+ if (mcb1 != NULL)
1289
+ GAMCLM += I * 2.0 * mcb1->p * XXX;
1290
+ if (mcc0 != NULL)
1291
+ GAMCLM += 1.5 * mcc0->p * I * I;
1292
+ CSUM = 0.0;
1293
+ OSMOT = -(A0) * pow(I, (LDBLE) 1.5) / (1.0 + B * DI);
1294
+ /*
1295
+ * Calculate ethetas
1296
+ */
1297
+ if (use_etheta == TRUE)
1298
+ {
1299
+ for (i = 0; i < (int)theta_params.size(); i++)
1300
+ {
1301
+ z0 = theta_params[i]->zj;
1302
+ z1 = theta_params[i]->zk;
1303
+ ETHETAS(z0, z1, I, &etheta, &ethetap);
1304
+ theta_params[i]->etheta = etheta;
1305
+ theta_params[i]->ethetap = ethetap;
1306
+ }
1307
+ }
1308
+ /*
1309
+ * Sums for F, LGAMMA, and OSMOT
1310
+ */
1311
+ for (size_t j = 0; j < param_list.size(); j++)
1312
+ {
1313
+ int i = param_list[j];
1314
+ i0 = pitz_params[i]->ispec[0];
1315
+ i1 = pitz_params[i]->ispec[1];
1316
+ z0 = spec[i0]->z;
1317
+ z1 = spec[i1]->z;
1318
+ param = pitz_params[i]->p;
1319
+ l_alpha = pitz_params[i]->alpha;
1320
+ F_var = 0;
1321
+ switch (pitz_params[i]->type)
1322
+ {
1323
+ case TYPE_B0:
1324
+ LGAMMA[i0] += M[i1] * 2.0 * param;
1325
+ LGAMMA[i1] += M[i0] * 2.0 * param;
1326
+ OSMOT += M[i0] * M[i1] * param;
1327
+ break;
1328
+ case TYPE_B1:
1329
+ if (param != 0.0)
1330
+ {
1331
+ F_var = M[i0] * M[i1] * param * GP(l_alpha * DI) / I;
1332
+ LGAMMA[i0] += M[i1] * 2.0 * param * G(l_alpha * DI);
1333
+ LGAMMA[i1] += M[i0] * 2.0 * param * G(l_alpha * DI);
1334
+ OSMOT += M[i0] * M[i1] * param * exp(-l_alpha * DI);
1335
+ }
1336
+ break;
1337
+ case TYPE_B2:
1338
+ if (param != 0.0)
1339
+ {
1340
+ F_var = M[i0] * M[i1] * param * GP(l_alpha * DI) / I;
1341
+ LGAMMA[i0] += M[i1] * 2.0 * param * G(l_alpha * DI);
1342
+ LGAMMA[i1] += M[i0] * 2.0 * param * G(l_alpha * DI);
1343
+ OSMOT += M[i0] * M[i1] * param * exp(-l_alpha * DI);
1344
+ }
1345
+ break;
1346
+ case TYPE_C0:
1347
+ CSUM +=
1348
+ M[i0] * M[i1] * pitz_params[i]->p / (2.0 *
1349
+ sqrt(fabs(z0 * z1)));
1350
+ LGAMMA[i0] += M[i1] * BIGZ * param / (2.0 * sqrt(fabs(z0 * z1)));
1351
+ LGAMMA[i1] += M[i0] * BIGZ * param / (2.0 * sqrt(fabs(z0 * z1)));
1352
+ OSMOT +=
1353
+ M[i0] * M[i1] * BIGZ * param / (2.0 * sqrt(fabs(z0 * z1)));
1354
+ break;
1355
+ case TYPE_THETA:
1356
+ LGAMMA[i0] += 2.0 * M[i1] * (param /*+ ETHETA(z0, z1, I) */ );
1357
+ LGAMMA[i1] += 2.0 * M[i0] * (param /*+ ETHETA(z0, z1, I) */ );
1358
+ OSMOT += M[i0] * M[i1] * param;
1359
+ break;
1360
+ case TYPE_ETHETA:
1361
+ /*
1362
+ ETHETAS(z0, z1, I, &etheta, &ethetap);
1363
+ */
1364
+ if (use_etheta == TRUE)
1365
+ {
1366
+ etheta = pitz_params[i]->thetas->etheta;
1367
+ ethetap = pitz_params[i]->thetas->ethetap;
1368
+ F_var = M[i0] * M[i1] * ethetap;
1369
+ LGAMMA[i0] += 2.0 * M[i1] * etheta;
1370
+ LGAMMA[i1] += 2.0 * M[i0] * etheta;
1371
+ OSMOT += M[i0] * M[i1] * (etheta + I * ethetap);
1372
+ }
1373
+ break;
1374
+ case TYPE_PSI:
1375
+ i2 = pitz_params[i]->ispec[2];
1376
+ if (IPRSNT[i2] == FALSE)
1377
+ continue;
1378
+ LGAMMA[i0] += M[i1] * M[i2] * param;
1379
+ LGAMMA[i1] += M[i0] * M[i2] * param;
1380
+ LGAMMA[i2] += M[i0] * M[i1] * param;
1381
+ OSMOT += M[i0] * M[i1] * M[i2] * param;
1382
+ break;
1383
+ case TYPE_LAMBDA:
1384
+ LGAMMA[i0] += M[i1] * param * pitz_params[i]->ln_coef[0];
1385
+ LGAMMA[i1] += M[i0] * param * pitz_params[i]->ln_coef[1];
1386
+ OSMOT += M[i0] * M[i1] * param * pitz_params[i]->os_coef;
1387
+ break;
1388
+ case TYPE_ZETA:
1389
+ i2 = pitz_params[i]->ispec[2];
1390
+ if (IPRSNT[i2] == FALSE)
1391
+ continue;
1392
+ LGAMMA[i0] += M[i1] * M[i2] * param;
1393
+ LGAMMA[i1] += M[i0] * M[i2] * param;
1394
+ LGAMMA[i2] += M[i0] * M[i1] * param;
1395
+ OSMOT += M[i0] * M[i1] * M[i2] * param;
1396
+ break;
1397
+ case TYPE_MU:
1398
+ i2 = pitz_params[i]->ispec[2];
1399
+ if (IPRSNT[i2] == FALSE)
1400
+ continue;
1401
+
1402
+ LGAMMA[i0] += M[i1] * M[i2] * param * pitz_params[i]->ln_coef[0];
1403
+ LGAMMA[i1] += M[i0] * M[i2] * param * pitz_params[i]->ln_coef[1];
1404
+ LGAMMA[i2] += M[i0] * M[i1] * param * pitz_params[i]->ln_coef[2];
1405
+ OSMOT += M[i0] * M[i1] * M[i2] * param * pitz_params[i]->os_coef;
1406
+ break;
1407
+ case TYPE_ETA:
1408
+ i2 = pitz_params[i]->ispec[2];
1409
+ if (IPRSNT[i2] == FALSE)
1410
+ continue;
1411
+ LGAMMA[i0] += M[i1] * M[i2] * param;
1412
+ LGAMMA[i1] += M[i0] * M[i2] * param;
1413
+ LGAMMA[i2] += M[i0] * M[i1] * param;
1414
+ OSMOT += M[i0] * M[i1] * M[i2] * param;
1415
+ break;
1416
+ case TYPE_ALPHAS:
1417
+ break;
1418
+ case TYPE_Other:
1419
+ default:
1420
+ error_msg("TYPE_Other in pitz_param list.", STOP);
1421
+ break;
1422
+ }
1423
+ F += F_var;
1424
+ F1 += F_var;
1425
+ F2 += F_var;
1426
+ }
1427
+
1428
+ /*
1429
+ * Add F and CSUM terms to LGAMMA
1430
+ */
1431
+ for (size_t j = 0; j < ion_list.size(); j++)
1432
+ {
1433
+ int i = ion_list[j];
1434
+ z0 = fabs(spec[i]->z);
1435
+ F_var = (z0 == 1 ? F1 : (z0 == 2.0 ? F2 : F));
1436
+ LGAMMA[i] += z0 * z0 * F_var + z0 * CSUM;
1437
+ }
1438
+ /*
1439
+ C
1440
+ C CONVERT TO MACINNES CONVENTION
1441
+ C
1442
+ */
1443
+ if (ICON == TRUE)
1444
+ {
1445
+ PHIMAC = LGAMMA[IC] - GAMCLM;
1446
+ /*
1447
+ C
1448
+ C CORRECTED ERROR IN PHIMAC, NOVEMBER, 1989
1449
+ C
1450
+ */
1451
+ for (size_t j = 0; j < s_list.size(); j++)
1452
+ {
1453
+ int i = s_list[j];
1454
+ LGAMMA[i] = LGAMMA[i] + spec[i]->z * PHIMAC;
1455
+ }
1456
+ }
1457
+
1458
+ COSMOT = 1.0 + 2.0 * OSMOT / OSUM;
1459
+ /*
1460
+ C
1461
+ C CALCULATE THE ACTIVITY OF WATER
1462
+ C
1463
+ */
1464
+ AW = exp(-OSUM * COSMOT / 55.50837);
1465
+ /*
1466
+ if (AW > 1.0)
1467
+ AW = 1.0;
1468
+ */
1469
+ /*s_h2o->la=log10(AW); */
1470
+ mu_x = I;
1471
+ for (size_t j = 0; j < s_list.size(); j++)
1472
+ {
1473
+ int i = s_list[j];
1474
+ spec[i]->lg_pitzer = LGAMMA[i] * CONV;
1475
+ }
1476
+ /*
1477
+ *I_X = I;
1478
+ *COSMOT_X = COSMOT;
1479
+ */
1480
+ return (OK);
1481
+ }
1482
+ #endif
1483
+ /* ---------------------------------------------------------------------- */
1484
+ LDBLE Phreeqc::
1485
+ G(LDBLE L_Y)
1486
+ /* ---------------------------------------------------------------------- */
1487
+ {
1488
+ LDBLE d=0.0;
1489
+ if (L_Y != 0.0)
1490
+ {
1491
+ d = 2.0e0 * (1.0e0 - (1.0e0 + L_Y) * exp(-L_Y)) / (L_Y * L_Y);
1492
+ }
1493
+
1494
+ return (d);
1495
+ }
1496
+
1497
+ /* ---------------------------------------------------------------------- */
1498
+ LDBLE Phreeqc::
1499
+ GP(LDBLE L_Y)
1500
+ /* ---------------------------------------------------------------------- */
1501
+ {
1502
+ LDBLE d=0.0;
1503
+ if (L_Y != 0.0)
1504
+ {
1505
+ d = -2.0e0 * (1.0e0 - (1.0e0 + L_Y + L_Y * L_Y / 2.0e0) * exp(-L_Y)) /
1506
+ (L_Y * L_Y);
1507
+ }
1508
+ return d;
1509
+ }
1510
+ /* ---------------------------------------------------------------------- */
1511
+ int Phreeqc::
1512
+ ETHETAS(LDBLE ZJ, LDBLE ZK, LDBLE I, LDBLE * etheta, LDBLE * ethetap)
1513
+ /* ---------------------------------------------------------------------- */
1514
+ {
1515
+ /* Revised ETHETAS code thanks to Wouter Falkena and the MoReS team, June, 2015 */
1516
+ *etheta = 0.0;
1517
+ *ethetap = 0.0;
1518
+
1519
+ if (ZJ == ZK)
1520
+ return (OK);
1521
+
1522
+ const LDBLE XCON = 6.0e0 * A0 * sqrt(I);
1523
+ const LDBLE ZZ = ZJ * ZK;
1524
+ /*
1525
+ C
1526
+ C NEXT 3 ARE EQUATION (A1)
1527
+ C
1528
+ */
1529
+ const LDBLE XJK = XCON * ZZ;
1530
+ const LDBLE XJJ = XCON * ZJ * ZJ;
1531
+ const LDBLE XKK = XCON * ZK * ZK;
1532
+
1533
+ /*
1534
+ C
1535
+ C EQUATION (A3)
1536
+ C
1537
+ */
1538
+ LDBLE JAY_XJK;
1539
+ LDBLE JPRIME_XJK;
1540
+ ETHETA_PARAMS( XJK, JAY_XJK, JPRIME_XJK );
1541
+
1542
+ LDBLE JAY_XJJ;
1543
+ LDBLE JPRIME_XJJ;
1544
+ ETHETA_PARAMS( XJJ, JAY_XJJ, JPRIME_XJJ );
1545
+
1546
+ LDBLE JAY_XKK;
1547
+ LDBLE JPRIME_XKK;
1548
+ ETHETA_PARAMS( XKK, JAY_XKK, JPRIME_XKK );
1549
+
1550
+ *etheta =
1551
+ ZZ * (JAY_XJK - JAY_XJJ / 2.0e0 - JAY_XKK / 2.0e0) / (4.0e0 * I);
1552
+ *ethetap =
1553
+ ZZ * (JPRIME_XJK - JPRIME_XJJ / 2.0e0 -
1554
+ JPRIME_XKK / 2.0e0) / (8.0e0 * I * I) - *etheta / I;
1555
+
1556
+ return (OK);
1557
+ }
1558
+
1559
+ /* ---------------------------------------------------------------------- */
1560
+ void Phreeqc::
1561
+ ETHETA_PARAMS(LDBLE X, LDBLE& JAY, LDBLE& JPRIME )
1562
+ /* ---------------------------------------------------------------------- */
1563
+ /*
1564
+ C
1565
+ C NUMERICAL APPROXIMATION TO THE INTEGRALS IN THE EXPRESSIONS FOR J0
1566
+ C AND J1. CHEBYSHEV APPROXIMATION IS USED. THE CONSTANTS 'AK' ARE
1567
+ C DEFINED IN BLOCK COMMON.
1568
+ C
1569
+ */
1570
+ /*
1571
+ C
1572
+ C AK IS USED TO CALCULATE HIGHER ORDER ELECTROSTATIC TERMS IN
1573
+ C SUBROUTINE PITZER
1574
+ C
1575
+ */
1576
+ {
1577
+ static const LDBLE AKX[42] = {
1578
+ 1.925154014814667e0, -.060076477753119e0, -.029779077456514e0,
1579
+ -.007299499690937e0, 0.000388260636404e0, 0.000636874599598e0,
1580
+ 0.000036583601823e0, -.000045036975204e0, -.000004537895710e0,
1581
+ 0.000002937706971e0, 0.000000396566462e0, -.000000202099617e0,
1582
+ -.000000025267769e0, 0.000000013522610e0, 0.000000001229405e0,
1583
+ -.000000000821969e0, -.000000000050847e0, 0.000000000046333e0,
1584
+ 0.000000000001943e0, -.000000000002563e0, -.000000000010991e0,
1585
+ 0.628023320520852e0, 0.462762985338493e0, 0.150044637187895e0,
1586
+ -.028796057604906e0, -.036552745910311e0, -.001668087945272e0,
1587
+ 0.006519840398744e0, 0.001130378079086e0, -.000887171310131e0,
1588
+ -.000242107641309e0, 0.000087294451594e0, 0.000034682122751e0,
1589
+ -.000004583768938e0, -.000003548684306e0, -.000000250453880e0,
1590
+ 0.000000216991779e0, 0.000000080779570e0, 0.000000004558555e0,
1591
+ -.000000006944757e0, -.000000002849257e0, 0.000000000237816e0
1592
+ };
1593
+ /*
1594
+ LDBLE PRECISION AK, BK, DK
1595
+ COMMON / MX8 / AK(0:20,2),BK(0:22),DK(0:22)
1596
+ */
1597
+ const LDBLE *AK;
1598
+ LDBLE L_Z = 0.0;
1599
+ LDBLE L_DZ = 0.0;
1600
+
1601
+ if ( X <= 1.0e0 )
1602
+ {
1603
+ const LDBLE powX0_2 = pow( X, 0.2 );
1604
+ L_Z = 4.0e0 * powX0_2 - 2.0e0;
1605
+ L_DZ = 0.8e0 * powX0_2 / 2.0e0;
1606
+ AK = &AKX[0];
1607
+ }
1608
+ else
1609
+ {
1610
+ const LDBLE powXmin0_1 = pow( X, -0.1 );
1611
+ L_Z = ( 40.0e0 * powXmin0_1 - 22.0e0 ) / 9.0e0;
1612
+ L_DZ = -4.0e0 * powXmin0_1 / 18.0e0;
1613
+ AK = &AKX[21];
1614
+ }
1615
+
1616
+ BK[20] = AK[20];
1617
+ BK[19] = L_Z * AK[20] + AK[19];
1618
+ DK[19] = AK[20];
1619
+ for ( int i = 18; i >= 0; i-- )
1620
+ {
1621
+ BK[i] = L_Z * BK[i + 1] - BK[i + 2] + AK[i];
1622
+ DK[i] = BK[i + 1] + L_Z * DK[i + 1] - DK[i + 2];
1623
+ }
1624
+
1625
+ JAY = X / 4.0e0 - 1.0e0 + 0.5e0 * (BK[0] - BK[2]);
1626
+ JPRIME = X * .25e0 + L_DZ * (DK[0] - DK[2]);
1627
+ }
1628
+
1629
+ /* ---------------------------------------------------------------------- */
1630
+ int Phreeqc::
1631
+ pitzer_clean_up(void)
1632
+ /* ---------------------------------------------------------------------- */
1633
+ {
1634
+ /*
1635
+ * Free all allocated memory, except strings
1636
+ */
1637
+ int i;
1638
+ for (i = 0; i < (int)pitz_params.size(); i++)
1639
+ {
1640
+ delete pitz_params[i];
1641
+ }
1642
+ pitz_param_map.clear();
1643
+ pitz_params.clear();
1644
+ for (i = 0; i < (int)theta_params.size(); i++)
1645
+ {
1646
+ delete theta_params[i];
1647
+ }
1648
+ theta_params.clear();
1649
+ LGAMMA.clear();
1650
+ IPRSNT.clear();
1651
+ spec.clear();
1652
+ if (aphi != NULL)
1653
+ {
1654
+ delete aphi;
1655
+ aphi = NULL;
1656
+ }
1657
+ M.clear();
1658
+
1659
+ return OK;
1660
+ }
1661
+
1662
+ /* ---------------------------------------------------------------------- */
1663
+ int Phreeqc::
1664
+ set_pz(int initial)
1665
+ /* ---------------------------------------------------------------------- */
1666
+ {
1667
+ /*
1668
+ * Sets initial guesses for unknowns if initial == TRUE
1669
+ * Revises guesses whether initial is true or not
1670
+ */
1671
+ int i;
1672
+ cxxSolution *solution_ptr;
1673
+ /*
1674
+ * Set initial log concentrations to zero
1675
+ */
1676
+ iterations = -1;
1677
+ solution_ptr = use.Get_solution_ptr();
1678
+ for (i = 0; i < (int)this->s_x.size(); i++)
1679
+ {
1680
+ s_x[i]->lm = LOG_ZERO_MOLALITY;
1681
+ s_x[i]->lg_pitzer = 0.0;
1682
+ }
1683
+ if (initial == TRUE || set_and_run_attempt > 0)
1684
+ {
1685
+ for (i = 0; i < (int)this->s_x.size(); i++)
1686
+ {
1687
+ s_x[i]->lg = 0.0;
1688
+ }
1689
+ }
1690
+ /*
1691
+ * Set master species activities
1692
+ */
1693
+
1694
+ tc_x = solution_ptr->Get_tc();
1695
+ tk_x = tc_x + 273.15;
1696
+
1697
+ patm_x = solution_ptr->Get_patm(); // done in calc_rho_0(tc, pa)
1698
+ potV_x = solution_ptr->Get_potV(); // added in DL_pitz
1699
+
1700
+ /*
1701
+ * H+, e-, H2O
1702
+ */
1703
+ mass_water_aq_x = solution_ptr->Get_mass_water();
1704
+ mu_x = solution_ptr->Get_mu();
1705
+ s_h2o->moles = mass_water_aq_x / gfw_water;
1706
+ s_h2o->la = log10(solution_ptr->Get_ah2o());
1707
+ AW = pow((LDBLE) 10.0, s_h2o->la);
1708
+ s_hplus->la = -solution_ptr->Get_ph();
1709
+ s_hplus->lm = s_hplus->la;
1710
+ s_hplus->moles = exp(s_hplus->lm * LOG_10) * mass_water_aq_x;
1711
+ s_eminus->la = -solution_ptr->Get_pe();
1712
+ if (initial == TRUE)
1713
+ pitzer_initial_guesses();
1714
+ if (dl_type_x != cxxSurface::NO_DL)
1715
+ initial_surface_water();
1716
+ pitzer_revise_guesses();
1717
+ return (OK);
1718
+ }
1719
+
1720
+ /* ---------------------------------------------------------------------- */
1721
+ int Phreeqc::
1722
+ pitzer_initial_guesses(void)
1723
+ /* ---------------------------------------------------------------------- */
1724
+ {
1725
+ /*
1726
+ * Make initial guesses for activities of master species and
1727
+ * ionic strength
1728
+ */
1729
+ int i;
1730
+ cxxSolution *solution_ptr;
1731
+
1732
+ solution_ptr = use.Get_solution_ptr();
1733
+ mu_x =
1734
+ s_hplus->moles +
1735
+ exp((solution_ptr->Get_ph() - 14.) * LOG_10) * mass_water_aq_x;
1736
+ mu_x /= mass_water_aq_x;
1737
+ s_h2o->la = 0.0;
1738
+ for (i = 0; i < count_unknowns; i++)
1739
+ {
1740
+ if (x[i] == ph_unknown || x[i] == pe_unknown)
1741
+ continue;
1742
+ if (x[i]->type < CB)
1743
+ {
1744
+ mu_x +=
1745
+ x[i]->moles / mass_water_aq_x * 0.5 * x[i]->master[0]->s->z *
1746
+ x[i]->master[0]->s->z;
1747
+ x[i]->master[0]->s->la = log10(x[i]->moles / mass_water_aq_x);
1748
+ }
1749
+ else if (x[i]->type == CB)
1750
+ {
1751
+ x[i]->master[0]->s->la =
1752
+ log10(0.001 * x[i]->moles / mass_water_aq_x);
1753
+ }
1754
+ else if (x[i]->type == SOLUTION_PHASE_BOUNDARY)
1755
+ {
1756
+ x[i]->master[0]->s->la =
1757
+ log10(0.001 * x[i]->moles / mass_water_aq_x);
1758
+ }
1759
+ else if (x[i]->type == EXCH)
1760
+ {
1761
+ if (x[i]->moles <= 0)
1762
+ {
1763
+ x[i]->master[0]->s->la = MIN_RELATED_LOG_ACTIVITY;
1764
+ }
1765
+ else
1766
+ {
1767
+ x[i]->master[0]->s->la = log10(x[i]->moles);
1768
+ }
1769
+ }
1770
+ else if (x[i]->type == SURFACE)
1771
+ {
1772
+ if (x[i]->moles <= 0)
1773
+ {
1774
+ x[i]->master[0]->s->la = MIN_RELATED_LOG_ACTIVITY;
1775
+ }
1776
+ else
1777
+ {
1778
+ x[i]->master[0]->s->la = log10(0.1 * x[i]->moles);
1779
+ }
1780
+ }
1781
+ else if (x[i]->type == SURFACE_CB)
1782
+ {
1783
+ x[i]->master[0]->s->la = 0.0;
1784
+ }
1785
+ }
1786
+ return (OK);
1787
+ }
1788
+
1789
+ /* ---------------------------------------------------------------------- */
1790
+ int Phreeqc::
1791
+ pitzer_revise_guesses(void)
1792
+ /* ---------------------------------------------------------------------- */
1793
+ {
1794
+ /*
1795
+ * Revise molalities species
1796
+ */
1797
+ int i;
1798
+ int l_iter, max_iter, repeat, fail;
1799
+ LDBLE weight, f;
1800
+
1801
+ max_iter = 100;
1802
+ if (iterations < 0 && (use.Get_surface_in() || use.Get_exchange_in()))
1803
+ gammas_pz(true); // DL_pitz : for SURF estimates
1804
+ l_iter = 0;
1805
+ repeat = TRUE;
1806
+ fail = FALSE;
1807
+ double d = 2;
1808
+ double logd = log10(d);
1809
+ while (repeat == TRUE && fail == FALSE)
1810
+ {
1811
+ l_iter++;
1812
+ if (debug_set == TRUE)
1813
+ {
1814
+ output_msg(sformatf( "\nBeginning set iteration %d.\n",
1815
+ l_iter));
1816
+ }
1817
+ if (l_iter == max_iter + 1)
1818
+ {
1819
+ log_msg(sformatf(
1820
+ "Did not converge in set, iteration %d.\n",
1821
+ iterations));
1822
+ fail = TRUE;
1823
+ }
1824
+ if (l_iter > 2 * max_iter)
1825
+ {
1826
+ log_msg(sformatf(
1827
+ "Did not converge with relaxed criteria in set.\n"));
1828
+ return (OK);
1829
+ }
1830
+ molalities(TRUE);
1831
+ /*pitzer(); */
1832
+ /*s_h2o->la = 0.0; */
1833
+ /*molalities(TRUE); */
1834
+ mb_sums();
1835
+ if (state < REACTION)
1836
+ {
1837
+ sum_species();
1838
+ }
1839
+ else
1840
+ {
1841
+ for (i = 0; i < count_unknowns; i++)
1842
+ {
1843
+ x[i]->sum = x[i]->f;
1844
+ }
1845
+ }
1846
+ /*n
1847
+ if (debug_set == TRUE) {
1848
+ pr.species = TRUE;
1849
+ pr.all = TRUE;
1850
+ print_species();
1851
+ }
1852
+ */
1853
+ repeat = FALSE;
1854
+ for (i = 0; i < count_unknowns; i++)
1855
+ {
1856
+ if (x[i] == ph_unknown || x[i] == pe_unknown)
1857
+ continue;
1858
+ if (x[i]->type == MB ||
1859
+ /* x[i]->type == ALK || */
1860
+ x[i]->type == CB ||
1861
+ x[i]->type == SOLUTION_PHASE_BOUNDARY ||
1862
+ x[i]->type == EXCH || x[i]->type == SURFACE)
1863
+ {
1864
+
1865
+ if (debug_set == TRUE)
1866
+ {
1867
+ output_msg(sformatf(
1868
+ "\n\t%5s at beginning of set %d: %e\t%e\t%e\n",
1869
+ x[i]->description, l_iter, (double) x[i]->sum,
1870
+ (double) x[i]->moles,
1871
+ (double) x[i]->master[0]->s->la));
1872
+ }
1873
+ if (fabs(x[i]->moles) < 1e-30)
1874
+ x[i]->moles = 0;
1875
+ f = fabs(x[i]->sum);
1876
+ if (f == 0 && x[i]->moles == 0)
1877
+ {
1878
+ x[i]->master[0]->s->la = MIN_RELATED_LOG_ACTIVITY;
1879
+ continue;
1880
+ }
1881
+ else if (f == 0)
1882
+ {
1883
+ repeat = TRUE;
1884
+ x[i]->master[0]->s->la += logd;
1885
+ if (x[i]->master[0]->s->la < -999.)
1886
+ x[i]->master[0]->s->la = MIN_RELATED_LOG_ACTIVITY;
1887
+ }
1888
+ else if (f > d * fabs(x[i]->moles)
1889
+ || f < 1.0/d * fabs(x[i]->moles))
1890
+ {
1891
+ weight = (f < 1.0/d * fabs(x[i]->moles)) ? 0.3 : 1.0;
1892
+ if (x[i]->moles <= 0)
1893
+ {
1894
+ x[i]->master[0]->s->la = MIN_RELATED_LOG_ACTIVITY;
1895
+ }
1896
+ else
1897
+ {
1898
+ repeat = TRUE;
1899
+ x[i]->master[0]->s->la +=
1900
+ weight * log10(fabs(x[i]->moles / x[i]->sum));
1901
+ }
1902
+ if (debug_set == TRUE)
1903
+ {
1904
+ output_msg(sformatf(
1905
+ "\t%5s not converged in set %d: %e\t%e\t%e\n",
1906
+ x[i]->description, l_iter,
1907
+ (double) x[i]->sum, (double) x[i]->moles,
1908
+ (double) x[i]->master[0]->s->la));
1909
+ }
1910
+ }
1911
+ }
1912
+ else if (x[i]->type == ALK)
1913
+ {
1914
+ f = total_co2;
1915
+ if (fail == TRUE && f < 1.5 * fabs(x[i]->moles))
1916
+ {
1917
+ continue;
1918
+ }
1919
+ if (f > 1.5 * fabs(x[i]->moles)
1920
+ || f < 1.0/d * fabs(x[i]->moles))
1921
+ {
1922
+ repeat = TRUE;
1923
+ weight = (f < 1.0/d * fabs(x[i]->moles)) ? 0.3 : 1.0;
1924
+ x[i]->master[0]->s->la += weight *
1925
+ log10(fabs(x[i]->moles / x[i]->sum));
1926
+ if (debug_set == TRUE)
1927
+ {
1928
+ output_msg(sformatf(
1929
+ "%s not converged in set. %e\t%e\t%e\n",
1930
+ x[i]->description, (double) x[i]->sum,
1931
+ (double) x[i]->moles,
1932
+ (double) x[i]->master[0]->s->la));
1933
+ }
1934
+ }
1935
+ }
1936
+ }
1937
+ }
1938
+ log_msg(sformatf( "Iterations in pitzer_revise_guesses: %d\n", l_iter));
1939
+ /*mu_x = mu_unknown->f * 0.5 / mass_water_aq_x; */
1940
+ if (mu_x <= 1e-8)
1941
+ {
1942
+ mu_x = 1e-8;
1943
+ }
1944
+ return (OK);
1945
+ }
1946
+
1947
+ /* ---------------------------------------------------------------------- */
1948
+ int Phreeqc::
1949
+ jacobian_pz(void)
1950
+ /* ---------------------------------------------------------------------- */
1951
+ { // calculate the derivatives numerically
1952
+ std::vector<double> base;
1953
+ std::vector<class phase*> phase_ptrs;
1954
+ std::vector<class phase> base_phases;
1955
+ cxxGasPhase base_gas_phase;
1956
+ cxxSurface base_surface;
1957
+ LDBLE d, d1, d2;
1958
+ int i, j;
1959
+ Restart:
1960
+ if (use.Get_surface_ptr() != NULL)
1961
+ {
1962
+ base_surface = *use.Get_surface_ptr();
1963
+ }
1964
+ if (use.Get_gas_phase_ptr() != NULL)
1965
+ {
1966
+ cxxGasPhase* gas_phase_ptr = use.Get_gas_phase_ptr();
1967
+ base_gas_phase = *gas_phase_ptr;
1968
+ base_phases.resize(gas_phase_ptr->Get_gas_comps().size());
1969
+ for (size_t i = 0; i < gas_phase_ptr->Get_gas_comps().size(); i++)
1970
+ {
1971
+ const cxxGasComp* gas_comp_ptr = &(gas_phase_ptr->Get_gas_comps()[i]);
1972
+ class phase* phase_ptr = phase_bsearch(gas_comp_ptr->Get_phase_name().c_str(), &j, FALSE);
1973
+ phase_ptrs.push_back(phase_ptr);
1974
+ base_phases[i] = *phase_ptr;
1975
+ }
1976
+ }
1977
+ calculating_deriv = 1;
1978
+ molalities(TRUE);
1979
+ if (full_pitzer == TRUE)
1980
+ {
1981
+ pitzer();
1982
+ }
1983
+ mb_sums();
1984
+ residuals();
1985
+
1986
+ size_t pz_max_unknowns = max_unknowns;
1987
+ base.resize(count_unknowns);
1988
+ for (i = 0; i < count_unknowns; i++)
1989
+ {
1990
+ base[i] = residual[i];
1991
+ }
1992
+ d = 0.0001;
1993
+ d1 = d * LOG_10;
1994
+ d2 = 0;
1995
+ for (i = 0; i < count_unknowns; i++)
1996
+ {
1997
+ switch (x[i]->type)
1998
+ {
1999
+ case MB:
2000
+ case ALK:
2001
+ case CB:
2002
+ case SOLUTION_PHASE_BOUNDARY:
2003
+ case EXCH:
2004
+ case SURFACE:
2005
+ case SURFACE_CB:
2006
+ case SURFACE_CB1:
2007
+ case SURFACE_CB2:
2008
+ x[i]->master[0]->s->la += d;
2009
+ //d2 = d1;
2010
+ d2 = d * LOG_10;
2011
+ break;
2012
+ case AH2O:
2013
+ x[i]->master[0]->s->la += d;
2014
+ //d2 = d1;
2015
+ d2 = d * LOG_10;
2016
+ break;
2017
+ case PITZER_GAMMA:
2018
+ if (!full_pitzer)
2019
+ continue;
2020
+ x[i]->s->lg += d;
2021
+ d2 = d;
2022
+ break;
2023
+ case MH2O:
2024
+ //mass_water_aq_x *= (1 + d);
2025
+ //x[i]->master[0]->s->moles = mass_water_aq_x / gfw_water;
2026
+ //d2 = log(1.0 + d);
2027
+ //break;
2028
+ // DL_pitz
2029
+ d1 = mass_water_aq_x * d;
2030
+ mass_water_aq_x += d1;
2031
+ if (use.Get_surface_in() && dl_type_x == cxxSurface::DONNAN_DL)
2032
+ mass_water_bulk_x += d1;
2033
+ x[i]->master[0]->s->moles = mass_water_aq_x / gfw_water;
2034
+ //d2 = log(1.0 + d);
2035
+ d2 = d1;
2036
+ break;
2037
+ case MH:
2038
+ if (pitzer_pe == TRUE)
2039
+ {
2040
+ s_eminus->la += d;
2041
+ //d2 = d1;
2042
+ d2 = d * LOG_10;
2043
+ break;
2044
+ }
2045
+ else
2046
+ {
2047
+ continue;
2048
+ }
2049
+ case GAS_MOLES:
2050
+ if (gas_in == FALSE)
2051
+ continue;
2052
+ d2 = (x[i]->moles > 1 ? 1 : 30);
2053
+ d2 *= d * x[i]->moles;
2054
+ d2 = (d2 < ineq_tol ? ineq_tol : d2);
2055
+ //if (d2 < 1e-14)
2056
+ // d2 = 1e-14;
2057
+ x[i]->moles += d2;
2058
+ break;
2059
+ case MU:
2060
+ //continue;
2061
+ d2 = d * mu_x;
2062
+ mu_x += d2;
2063
+ //k_temp(tc_x, patm_x);
2064
+ gammas_pz(false);
2065
+ break;
2066
+ case PP:
2067
+ continue;
2068
+ break;
2069
+ case SS_MOLES:
2070
+ //continue;
2071
+ //break;
2072
+ if (x[i]->ss_in == FALSE)
2073
+ continue;
2074
+ for (j = 0; j < count_unknowns; j++)
2075
+ {
2076
+ delta[j] = 0.0;
2077
+ }
2078
+ d2 = d * 10 * x[i]->moles;
2079
+ delta[i] = d2;
2080
+ reset();
2081
+ d2 = delta[i];
2082
+ break;
2083
+ }
2084
+ molalities(TRUE);
2085
+ if (max_unknowns > pz_max_unknowns)
2086
+ {
2087
+ base.clear();
2088
+ gammas_pz(false);
2089
+ jacobian_sums();
2090
+ goto Restart;
2091
+ }
2092
+ if (full_pitzer == TRUE)
2093
+ pitzer();
2094
+ mb_sums();
2095
+ residuals();
2096
+ for (j = 0; j < count_unknowns; j++)
2097
+ {
2098
+ my_array[(size_t)j * (count_unknowns + 1) + (size_t)i] = -(residual[j] - base[j]) / d2;
2099
+ if (x[i]->type == MH2O) // DL_pitz
2100
+ my_array[(size_t)j * (count_unknowns + 1) + (size_t)i] *= mass_water_aq_x;
2101
+ }
2102
+ switch (x[i]->type)
2103
+ {
2104
+ case MB:
2105
+ case ALK:
2106
+ case CB:
2107
+ case SOLUTION_PHASE_BOUNDARY:
2108
+ case EXCH:
2109
+ case SURFACE:
2110
+ case SURFACE_CB:
2111
+ case SURFACE_CB1:
2112
+ case SURFACE_CB2:
2113
+ case AH2O:
2114
+ x[i]->master[0]->s->la -= d;
2115
+ break;
2116
+ case MH:
2117
+ s_eminus->la -= d;
2118
+ if (my_array[(size_t)i * (count_unknowns + 1) + (size_t)i] == 0)
2119
+ {
2120
+ my_array[(size_t)i * (count_unknowns + 1) + (size_t)i] =
2121
+ exp(s_h2->lm * LOG_10) * 2;
2122
+ }
2123
+ break;
2124
+ case PITZER_GAMMA:
2125
+ x[i]->s->lg -= d;
2126
+ break;
2127
+ case MH2O:
2128
+ //mass_water_aq_x /= (1 + d);
2129
+ //x[i]->master[0]->s->moles = mass_water_aq_x / gfw_water;
2130
+ //break;
2131
+ //DL_pitz
2132
+ mass_water_aq_x -= d1;
2133
+ if (use.Get_surface_in() && dl_type_x == cxxSurface::DONNAN_DL)
2134
+ mass_water_bulk_x -= d1;
2135
+ x[i]->master[0]->s->moles = mass_water_aq_x / gfw_water;
2136
+ break;
2137
+ case MU:
2138
+ mu_x -= d2;
2139
+ //k_temp(tc_x, patm_x);
2140
+ gammas_pz(false);
2141
+ break;
2142
+ case GAS_MOLES:
2143
+ if (gas_in == FALSE)
2144
+ continue;
2145
+ x[i]->moles -= d2;
2146
+ break;
2147
+ case SS_MOLES:
2148
+ delta[i] = -d2;
2149
+ reset();
2150
+ break;
2151
+ }
2152
+ if (use.Get_surface_ptr() != NULL)
2153
+ {
2154
+ *use.Get_surface_ptr() = base_surface;
2155
+ }
2156
+ if (use.Get_gas_phase_ptr() != NULL)
2157
+ {
2158
+ *use.Get_gas_phase_ptr() = base_gas_phase;
2159
+ for (size_t g = 0; g < base_phases.size(); g++)
2160
+ {
2161
+ *phase_ptrs[g] = base_phases[g];
2162
+ }
2163
+ }
2164
+ //molalities(TRUE);
2165
+ //if (full_pitzer == TRUE)
2166
+ // pitzer();
2167
+ //mb_sums();
2168
+ //residuals();
2169
+ }
2170
+ molalities(TRUE);
2171
+ if (full_pitzer == TRUE)
2172
+ pitzer();
2173
+ mb_sums();
2174
+ residuals();
2175
+ //for (i = 0; i < count_unknowns; i++)
2176
+ //{
2177
+ // //Debugging
2178
+ // if (fabs(2.0 * (residual[i] - base[i]) / (residual[i] + base[i])) > 1e-2 &&
2179
+ // fabs(residual[i]) + fabs(base[i]) > 1e-6)
2180
+ // {
2181
+ // std::cerr << iterations << ": " << x[i]->description << " " << residual[i] << " " << base[i] << std::endl;
2182
+ // }
2183
+ //}
2184
+ base.clear();
2185
+ calculating_deriv = 0;
2186
+ return OK;
2187
+ }
2188
+
2189
+ /* ---------------------------------------------------------------------- */
2190
+ int Phreeqc::
2191
+ model_pz(void)
2192
+ /* ---------------------------------------------------------------------- */
2193
+ {
2194
+ /*
2195
+ * model is called after the equations have been set up by prep
2196
+ * and initial guesses have been made in set.
2197
+ *
2198
+ * Here is the outline of the calculation sequence:
2199
+ * residuals--residuals are calculated, if small we are done
2200
+ * sum_jacobian--jacobian is calculated
2201
+ * ineq--inequality solver is called
2202
+ * reset--estimates of unknowns revised, if changes are small solution
2203
+ * has been found, usually convergence is found in residuals.
2204
+ * gammas--new activity coefficients
2205
+ * molalities--calculate molalities
2206
+ * mb_sums--calculate mass-balance sums
2207
+ * mb_gases--decide if gas_phase exists
2208
+ * mb_ss--decide if solid_solutions exists
2209
+ * switch_bases--check to see if new basis species is needed
2210
+ * reprep--rewrite equations with new basis species if needed
2211
+ * pitzer_revise_guesses--revise unknowns to get initial mole balance
2212
+ * check_residuals--check convergence one last time
2213
+ * sum_species--calculate sums of elements from species concentrations
2214
+ *
2215
+ * An additional pass through may be needed if unstable phases still exist
2216
+ * in the phase assemblage.
2217
+ */
2218
+ int l_kode, return_kode;
2219
+ int r;
2220
+ int count_infeasible, count_basis_change;
2221
+ int debug_model_save;
2222
+ int mass_water_switch_save;
2223
+
2224
+ /* debug_model = TRUE; */
2225
+ /* debug_prep = TRUE; */
2226
+ /* debug_set = TRUE; */
2227
+ /* mass_water_switch == TRUE, mass of water is constant */
2228
+ mass_water_switch_save = mass_water_switch;
2229
+ if (mass_water_switch_save == FALSE && delay_mass_water == TRUE)
2230
+ {
2231
+ mass_water_switch = TRUE;
2232
+ }
2233
+ debug_model_save = debug_model;
2234
+ pe_step_size_now = pe_step_size;
2235
+ step_size_now = step_size;
2236
+ #ifdef NPP
2237
+ if (!use.Get_kinetics_in()) status(0, NULL);
2238
+ #else
2239
+ status(0, NULL);
2240
+ #endif
2241
+ iterations = 0;
2242
+ gamma_iterations = 0;
2243
+ count_basis_change = count_infeasible = 0;
2244
+ stop_program = FALSE;
2245
+ remove_unstable_phases = FALSE;
2246
+ if (always_full_pitzer == TRUE)
2247
+ {
2248
+ full_pitzer = TRUE;
2249
+ }
2250
+ else
2251
+ {
2252
+ full_pitzer = FALSE;
2253
+ }
2254
+ #if defined(PITZER_LISTS)
2255
+ //pitzer_make_lists();
2256
+ #endif
2257
+ for (;;)
2258
+ {
2259
+ mb_gases();
2260
+ mb_ss();
2261
+ l_kode = 1;
2262
+ while ((r = residuals()) != CONVERGED
2263
+ || remove_unstable_phases == TRUE)
2264
+ {
2265
+ #if defined(PHREEQCI_GUI)
2266
+ PhreeqcIWait(this);
2267
+ #endif
2268
+ iterations++;
2269
+ overall_iterations++;
2270
+ if (iterations > itmax - 1 && debug_model == FALSE
2271
+ && pr.logfile == TRUE)
2272
+ {
2273
+ set_forward_output_to_log(TRUE);
2274
+ debug_model = TRUE;
2275
+ }
2276
+ if (debug_model == TRUE)
2277
+ {
2278
+ output_msg(sformatf(
2279
+ "\nIteration %d\tStep_size = %f\n", iterations,
2280
+ (double) step_size_now));
2281
+ output_msg(sformatf( "\t\tPe_step_size = %f\n\n",
2282
+ (double) pe_step_size_now));
2283
+ }
2284
+ /*
2285
+ * Iterations exceeded
2286
+ */
2287
+ if (iterations > itmax)
2288
+ {
2289
+ error_string = sformatf( "Maximum iterations exceeded, %d\n",
2290
+ itmax);
2291
+ warning_msg(error_string);
2292
+ stop_program = TRUE;
2293
+ break;
2294
+ }
2295
+ /*
2296
+ * Calculate jacobian
2297
+ */
2298
+ gammas_pz(false); // appt: no gammas_a_f here
2299
+ jacobian_sums();
2300
+ jacobian_pz();
2301
+ /*
2302
+ * Full matrix with pure phases
2303
+ */
2304
+ if (r == OK || remove_unstable_phases == TRUE)
2305
+ {
2306
+ return_kode = ineq(l_kode);
2307
+ if (return_kode != OK)
2308
+ {
2309
+ if (debug_model == TRUE)
2310
+ {
2311
+ output_msg(sformatf(
2312
+ "Ineq had infeasible solution, "
2313
+ "kode %d, iteration %d\n", return_kode,
2314
+ iterations));
2315
+ }
2316
+ log_msg(sformatf( "Ineq had infeasible solution, "
2317
+ "kode %d, iteration %d\n", return_kode,
2318
+ iterations));
2319
+ count_infeasible++;
2320
+ }
2321
+ if (return_kode == 2)
2322
+ {
2323
+ ineq(0);
2324
+ }
2325
+ reset();
2326
+ }
2327
+ // appt calculate gammas_a_f here
2328
+ gammas_pz(true);
2329
+ if (full_pitzer == TRUE)
2330
+ pitzer();
2331
+ if (always_full_pitzer == TRUE)
2332
+ {
2333
+ full_pitzer = TRUE;
2334
+ }
2335
+ else
2336
+ {
2337
+ full_pitzer = FALSE;
2338
+ }
2339
+ if (molalities(FALSE) == ERROR)
2340
+ {
2341
+ pitzer_revise_guesses();
2342
+ }
2343
+ if (use.Get_surface_ptr() != NULL &&
2344
+ use.Get_surface_ptr()->Get_dl_type() != cxxSurface::NO_DL &&
2345
+ use.Get_surface_ptr()->Get_related_phases())
2346
+ initial_surface_water();
2347
+ mb_sums();
2348
+ mb_gases();
2349
+ mb_ss();
2350
+ /*
2351
+ * Switch bases if necessary
2352
+ */
2353
+ if (switch_bases() == TRUE)
2354
+ {
2355
+
2356
+ count_basis_change++;
2357
+ count_unknowns -= (int)this->s_x.size();
2358
+ reprep();
2359
+ full_pitzer = false;
2360
+ }
2361
+ //debug
2362
+ //species_list_sort();
2363
+ //sum_species();
2364
+ //print_species();
2365
+ //print_exchange();
2366
+ //print_surface();
2367
+
2368
+ if (stop_program == TRUE)
2369
+ {
2370
+ break;
2371
+ }
2372
+ }
2373
+ /*
2374
+ * Check for stop_program
2375
+ */
2376
+
2377
+ if (stop_program == TRUE)
2378
+ {
2379
+ break;
2380
+ }
2381
+ if (check_residuals() == ERROR)
2382
+ {
2383
+ stop_program = TRUE;
2384
+ break;
2385
+ }
2386
+ /* remove_unstable_phases is set in check_residuals */
2387
+ if (remove_unstable_phases == FALSE && mass_water_switch_save == FALSE
2388
+ && mass_water_switch == TRUE)
2389
+ {
2390
+ log_msg(sformatf(
2391
+ "\nChanging water switch to FALSE. Iteration %d.\n",
2392
+ iterations));
2393
+ mass_water_switch = FALSE;
2394
+ continue;
2395
+ }
2396
+ gamma_iterations++;
2397
+ if (gamma_iterations > itmax)
2398
+ {
2399
+ error_string = sformatf( "Maximum gamma iterations exceeded, %d\n",
2400
+ itmax);
2401
+ warning_msg(error_string);
2402
+ stop_program = TRUE;
2403
+ break;
2404
+ }
2405
+ if (check_gammas_pz() != TRUE)
2406
+ {
2407
+ full_pitzer = TRUE;
2408
+ continue;
2409
+ }
2410
+ if (remove_unstable_phases == FALSE)
2411
+ break;
2412
+ if (debug_model == TRUE)
2413
+ {
2414
+ output_msg(sformatf(
2415
+ "\nRemoving unstable phases. Iteration %d.\n",
2416
+ iterations));
2417
+ }
2418
+ log_msg(sformatf( "\nRemoving unstable phases. Iteration %d.\n",
2419
+ iterations));
2420
+ }
2421
+ log_msg(sformatf( "\nNumber of infeasible solutions: %d\n",
2422
+ count_infeasible));
2423
+ log_msg(sformatf( "Number of basis changes: %d\n\n",
2424
+ count_basis_change));
2425
+ log_msg(sformatf( "Number of iterations: %d\n", iterations));
2426
+ log_msg(sformatf( "Number of gamma iterations: %d\n\n", gamma_iterations));
2427
+ debug_model = debug_model_save;
2428
+ set_forward_output_to_log(FALSE);
2429
+ if (stop_program == TRUE)
2430
+ {
2431
+ return (ERROR);
2432
+ }
2433
+ return (OK);
2434
+ }
2435
+
2436
+ /* ---------------------------------------------------------------------- */
2437
+ int Phreeqc::
2438
+ check_gammas_pz(void)
2439
+ /* ---------------------------------------------------------------------- */
2440
+ {
2441
+ LDBLE /*old_aw,*/ old_mu, tol;
2442
+ int converge, i;
2443
+
2444
+ old_mu = mu_x;
2445
+ pitzer();
2446
+ molalities(TRUE);
2447
+ mb_sums();
2448
+ converge = TRUE;
2449
+ tol = convergence_tolerance * 10.;
2450
+ for (i = 0; i < count_unknowns; i++)
2451
+ {
2452
+ if (x[i]->type != PITZER_GAMMA)
2453
+ continue;
2454
+ if (fabs(x[i]->s->lg - x[i]->s->lg_pitzer) > tol)
2455
+ {
2456
+ converge = FALSE;
2457
+ }
2458
+ }
2459
+ if (fabs(old_mu - mu_x) > tol)
2460
+ converge = FALSE;
2461
+
2462
+ if ((pow((LDBLE) 10.0, s_h2o->la) - AW) > tol)
2463
+ converge = FALSE;
2464
+ return converge;
2465
+ }
2466
+
2467
+ /* ---------------------------------------------------------------------- */
2468
+ int Phreeqc::
2469
+ gammas_pz(bool exch_a_f)
2470
+ /* ---------------------------------------------------------------------- */
2471
+ {
2472
+ /*
2473
+ * Need exchange gammas for pitzer
2474
+ */
2475
+ int i, j;
2476
+ LDBLE coef, equiv;
2477
+ /* Initialize */
2478
+ k_temp(tc_x, patm_x);
2479
+ /*
2480
+ * Calculate activity coefficients
2481
+ */
2482
+ for (i = 0; i < (int)this->s_x.size(); i++)
2483
+ {
2484
+ switch (s_x[i]->gflag)
2485
+ {
2486
+ case 0: /* uncharged */
2487
+ case 1: /* Davies */
2488
+ case 2: /* Extended D-H, WATEQ D-H */
2489
+ case 3: /* Always 1.0 */
2490
+ break;
2491
+ case 4: /* Exchange */
2492
+ /* Now calculated in next loop */
2493
+ break;
2494
+ case 5: /* Always 1.0 */
2495
+ break;
2496
+ case 6: /* Surface */
2497
+ /*
2498
+ * Find moles of sites.
2499
+ * s_x[i]->equiv is stoichiometric coefficient of sites in species
2500
+ */
2501
+ for (j = 1; s_x[i]->rxn_x.token[j].s != NULL; j++)
2502
+ {
2503
+ if (s_x[i]->rxn_x.token[j].s->type == SURF)
2504
+ {
2505
+ s_x[i]->alk =
2506
+ s_x[i]->rxn_x.token[j].s->primary->unknown->moles;
2507
+ break;
2508
+ }
2509
+ }
2510
+ if (use.Get_surface_ptr()->Get_type() == cxxSurface::CD_MUSIC) // DL_pitz
2511
+ {
2512
+ /* mole fraction */
2513
+ equiv = 1.0;
2514
+ }
2515
+ else
2516
+ {
2517
+ equiv = s_x[i]->equiv;
2518
+ }
2519
+ if (s_x[i]->alk > 0)
2520
+ {
2521
+ s_x[i]->lg = log10(equiv / s_x[i]->alk);
2522
+ s_x[i]->dg = 0.0;
2523
+ }
2524
+ else
2525
+ {
2526
+ s_x[i]->lg = 0.0;
2527
+ s_x[i]->dg = 0.0;
2528
+ }
2529
+ break;
2530
+ case 7: /* LLNL */
2531
+ break;
2532
+ case 8: /* LLNL CO2 */
2533
+ break;
2534
+ case 9: /* activity water */
2535
+ s_x[i]->lg = log10(exp(s_h2o->la * LOG_10) * gfw_water);
2536
+ s_x[i]->dg = 0.0;
2537
+ break;
2538
+ }
2539
+ /*
2540
+ if (mu_unknown != NULL) {
2541
+ if (fabs(residual[mu_unknown->number]) > 0.1 &&
2542
+ fabs(residual[mu_unknown->number])/mu_x > 0.5) {
2543
+ s_x[i]->dg = 0.0;
2544
+ }
2545
+ }
2546
+ */
2547
+ }
2548
+ /*
2549
+ * calculate exchange gammas
2550
+ */
2551
+
2552
+ if (use.Get_exchange_ptr() != NULL && exch_a_f) // appt for gammas_a_f
2553
+ {
2554
+ for (i = 0; i < (int)this->s_x.size(); i++)
2555
+ {
2556
+ switch (s_x[i]->gflag)
2557
+ {
2558
+ case 0: /* uncharged */
2559
+ case 1: /* Davies */
2560
+ case 2: /* Extended D-H, WATEQ D-H */
2561
+ case 3: /* Always 1.0 */
2562
+ case 5: /* Always 1.0 */
2563
+ case 6: /* Surface */
2564
+ case 7: /* LLNL */
2565
+ case 8: /* LLNL CO2 */
2566
+ case 9: /* activity water */
2567
+ break;
2568
+ case 4: /* Exchange */
2569
+ /*
2570
+ * Find CEC
2571
+ * z contains valence of cation for exchange species, alk contains cec
2572
+ */
2573
+ for (j = 1; s_x[i]->rxn_x.token[j].s != NULL; j++)
2574
+ {
2575
+ if (s_x[i]->rxn_x.token[j].s->type == EX)
2576
+ {
2577
+ s_x[i]->alk = s_x[i]->rxn_x.token[j].s->primary->unknown->moles;
2578
+ break;
2579
+ }
2580
+ }
2581
+ /*
2582
+ * Master species is a dummy variable with meaningless activity and mass
2583
+ */
2584
+ s_x[i]->lg = 0.0;
2585
+ s_x[i]->dg = 0.0;
2586
+ if (s_x[i]->primary != NULL)
2587
+ {
2588
+ break;
2589
+ }
2590
+ /*
2591
+ * All other species
2592
+ */
2593
+ /* modific 29 july 2005... */
2594
+ if (s_x[i]->equiv != 0 && s_x[i]->alk > 0)
2595
+ {
2596
+ s_x[i]->lg = log10(fabs(s_x[i]->equiv) / s_x[i]->alk);
2597
+ }
2598
+ if (use.Get_exchange_ptr()->Get_pitzer_exchange_gammas())
2599
+ {
2600
+ /* Assume equal gamma's of solute and exchangeable species... */
2601
+ for (j = 1; s_x[i]->rxn_x.token[j].s != NULL; j++)
2602
+ {
2603
+ if (s_x[i]->rxn_x.token[j].s->type == EX)
2604
+ continue;
2605
+ coef = s_x[i]->rxn_x.token[j].coef;
2606
+ s_x[i]->lg += coef * s_x[i]->rxn_x.token[j].s->lg;
2607
+ }
2608
+ }
2609
+ if (s_x[i]->a_f && s_x[i]->primary == NULL && s_x[i]->moles)
2610
+ gammas_a_f(i); // appt
2611
+ }
2612
+ }
2613
+ }
2614
+ /* ...end modific 29 july 2005 */
2615
+
2616
+ return (OK);
2617
+ }
2618
+ /* ---------------------------------------------------------------------- */
2619
+ void Phreeqc::
2620
+ pitzer_make_lists(void)
2621
+ /* ---------------------------------------------------------------------- */
2622
+ {
2623
+ double log_min = log10(MIN_TOTAL);
2624
+ s_list.clear();
2625
+ cation_list.clear();
2626
+ neutral_list.clear();
2627
+ anion_list.clear();
2628
+ ion_list.clear();
2629
+ param_list.clear();
2630
+ OTEMP = -100.0;
2631
+ for (int j = 0; j < 3; j++)
2632
+ {
2633
+ int min, max;
2634
+ switch (j)
2635
+ {
2636
+ case 0:
2637
+ min = 0;
2638
+ max = count_cations;
2639
+ break;
2640
+ case 1:
2641
+ min = (int)s.size();
2642
+ max = (int)s.size() + count_neutrals;
2643
+ break;
2644
+ case 2:
2645
+ min = 2* (int)s.size();
2646
+ max = 2* (int)s.size() + count_anions;
2647
+ break;
2648
+ }
2649
+ for (int i = min; i < max; i++)
2650
+ {
2651
+ IPRSNT[i] = FALSE;
2652
+ M[i] = 0.0;
2653
+ if ((spec[i] != NULL && spec[i]->in == TRUE) ||
2654
+ (ICON == TRUE && i == IC))
2655
+ {
2656
+ if (spec[i]->type == EX ||
2657
+ spec[i]->type == SURF || spec[i]->type == SURF_PSI)
2658
+ continue;
2659
+ IPRSNT[i] = TRUE;
2660
+ s_list.push_back(i);
2661
+ if (i < (int)s.size())
2662
+ {
2663
+ cation_list.push_back(i);
2664
+ }
2665
+ if (i >= (int)s.size() && i < 2* (int)s.size())
2666
+ {
2667
+ neutral_list.push_back(i);
2668
+ }
2669
+ if (i >= 2* (int)s.size())
2670
+ {
2671
+ anion_list.push_back(i);
2672
+ }
2673
+ if (i < (int)s.size() || i >= 2* (int)s.size())
2674
+ {
2675
+ ion_list.push_back(i);
2676
+ }
2677
+ if (spec[i]->lm > log_min)
2678
+ {
2679
+ M[i] = under(spec[i]->lm);
2680
+ }
2681
+ }
2682
+ }
2683
+ }
2684
+ if (ICON == TRUE)
2685
+ {
2686
+ IPRSNT[IC] = TRUE;
2687
+ }
2688
+ for (int i = 0; i < (int)pitz_params.size(); i++)
2689
+ {
2690
+ /*
2691
+ TYPE_B0, TYPE_B1, TYPE_B2, TYPE_C0, TYPE_THETA, TYPE_LAMBDA, TYPE_ZETA,
2692
+ TYPE_PSI, TYPE_ETHETA, TYPE_ALPHAS, TYPE_MU, TYPE_ETA, TYPE_Other,
2693
+ TYPE_SIT_EPSILON, TYPE_SIT_EPSILON_MU
2694
+ */
2695
+ int i0 = pitz_params[i]->ispec[0];
2696
+ int i1 = pitz_params[i]->ispec[1];
2697
+ if (IPRSNT[i0] == FALSE || IPRSNT[i1] == FALSE) continue;
2698
+ int i2 = pitz_params[i]->ispec[2];
2699
+ if (pitz_params[i]->type == TYPE_PSI ||
2700
+ pitz_params[i]->type == TYPE_ZETA ||
2701
+ pitz_params[i]->type == TYPE_MU ||
2702
+ pitz_params[i]->type == TYPE_ETA)
2703
+ {
2704
+ if (IPRSNT[i2] == FALSE)
2705
+ continue;
2706
+ }
2707
+ param_list.push_back(i);
2708
+ }
2709
+ }