pyEQL 1.4.0rc9__cp311-cp311-win_amd64.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 (519) hide show
  1. pyEQL/__init__.py +50 -0
  2. pyEQL/_phreeqc.cp311-win_amd64.pyd +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/ALL_BUILD.vcxproj +185 -0
  46. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/ALL_BUILD.vcxproj.filters +8 -0
  47. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/generate.stamp +1 -0
  48. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CMakeFiles/generate.stamp.depend +79 -0
  49. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/CTestTestfile.cmake +6 -0
  50. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/Continuous.vcxproj +240 -0
  51. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/Continuous.vcxproj.filters +17 -0
  52. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/DartConfiguration.tcl +109 -0
  53. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/Experimental.vcxproj +240 -0
  54. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/Experimental.vcxproj.filters +17 -0
  55. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/INSTALL.vcxproj +209 -0
  56. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/INSTALL.vcxproj.filters +13 -0
  57. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/CSelectedOutput.obj +0 -0
  58. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Dictionary.obj +0 -0
  59. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/ExchComp.obj +0 -0
  60. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Exchange.obj +0 -0
  61. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/GasComp.obj +0 -0
  62. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/GasPhase.obj +0 -0
  63. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.lib.recipe +11 -0
  64. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.obj +0 -0
  65. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.tlog/CL.command.1.tlog +0 -0
  66. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.tlog/CL.read.1.tlog +0 -0
  67. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.tlog/CL.write.1.tlog +0 -0
  68. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.tlog/Cl.items.tlog +82 -0
  69. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.tlog/CustomBuild.command.1.tlog +10 -0
  70. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.tlog/CustomBuild.read.1.tlog +78 -0
  71. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.tlog/CustomBuild.write.1.tlog +2 -0
  72. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.tlog/IPhreeqc.lastbuildstate +2 -0
  73. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.tlog/Lib-link.read.1.tlog +0 -0
  74. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.tlog/Lib-link.write.1.tlog +0 -0
  75. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc.tlog/Lib.command.1.tlog +0 -0
  76. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqcLib.obj +0 -0
  77. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/IPhreeqc_interface_F.obj +0 -0
  78. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/ISolution.obj +0 -0
  79. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/ISolutionComp.obj +0 -0
  80. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Keywords.obj +0 -0
  81. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/KineticsComp.obj +0 -0
  82. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/NameDouble.obj +0 -0
  83. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/NumKeyword.obj +0 -0
  84. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/PBasic.obj +0 -0
  85. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/PHRQ_base.obj +0 -0
  86. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/PHRQ_io.obj +0 -0
  87. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/PHRQ_io_output.obj +0 -0
  88. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/PPassemblage.obj +0 -0
  89. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/PPassemblageComp.obj +0 -0
  90. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Parser.obj +0 -0
  91. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Phreeqc.obj +0 -0
  92. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Pressure.obj +0 -0
  93. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Reaction.obj +0 -0
  94. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/ReadClass.obj +0 -0
  95. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/SS.obj +0 -0
  96. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/SSassemblage.obj +0 -0
  97. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/SScomp.obj +0 -0
  98. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/SelectedOutput.obj +0 -0
  99. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Serializer.obj +0 -0
  100. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Solution.obj +0 -0
  101. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/SolutionIsotope.obj +0 -0
  102. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/StorageBin.obj +0 -0
  103. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/StorageBinList.obj +0 -0
  104. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Surface.obj +0 -0
  105. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/SurfaceCharge.obj +0 -0
  106. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/SurfaceComp.obj +0 -0
  107. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/System.obj +0 -0
  108. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Temperature.obj +0 -0
  109. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Use.obj +0 -0
  110. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/UserPunch.obj +0 -0
  111. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Utils.obj +0 -0
  112. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/Var.obj +0 -0
  113. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/advection.obj +0 -0
  114. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/basicsubs.obj +0 -0
  115. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/cl1.obj +0 -0
  116. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/cvdense.obj +0 -0
  117. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/cvode.obj +0 -0
  118. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/cxxKinetics.obj +0 -0
  119. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/cxxMix.obj +0 -0
  120. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/dense.obj +0 -0
  121. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/dumper.obj +0 -0
  122. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/gases.obj +0 -0
  123. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/input.obj +0 -0
  124. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/integrate.obj +0 -0
  125. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/inverse.obj +0 -0
  126. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/isotopes.obj +0 -0
  127. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/kinetics.obj +0 -0
  128. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/mainsubs.obj +0 -0
  129. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/model.obj +0 -0
  130. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/nvector.obj +0 -0
  131. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/nvector_serial.obj +0 -0
  132. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/parse.obj +0 -0
  133. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/phqalloc.obj +0 -0
  134. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/pitzer.obj +0 -0
  135. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/pitzer_structures.obj +0 -0
  136. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/prep.obj +0 -0
  137. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/print.obj +0 -0
  138. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/read.obj +0 -0
  139. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/readtr.obj +0 -0
  140. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/runner.obj +0 -0
  141. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/sit.obj +0 -0
  142. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/smalldense.obj +0 -0
  143. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/spread.obj +0 -0
  144. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/step.obj +0 -0
  145. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/structures.obj +0 -0
  146. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/sundialsmath.obj +0 -0
  147. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/tally.obj +0 -0
  148. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/tidy.obj +0 -0
  149. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/transport.obj +0 -0
  150. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.dir/Release/utilities.obj +0 -0
  151. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.sln +116 -0
  152. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.vcxproj +443 -0
  153. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/IPhreeqc.vcxproj.filters +456 -0
  154. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/Nightly.vcxproj +240 -0
  155. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/Nightly.vcxproj.filters +17 -0
  156. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/NightlyMemoryCheck.vcxproj +240 -0
  157. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/NightlyMemoryCheck.vcxproj.filters +17 -0
  158. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/Release/IPhreeqc.lib +0 -0
  159. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/build/cmake_install.cmake +40 -0
  160. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/ar-lib +270 -0
  161. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/compile +347 -0
  162. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/config.guess +1441 -0
  163. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/config.sub +1813 -0
  164. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/depcomp +791 -0
  165. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/install-sh +508 -0
  166. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/ltmain.sh +11156 -0
  167. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/missing +215 -0
  168. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/config/test-driver +148 -0
  169. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/configure +23867 -0
  170. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/configure.ac +136 -0
  171. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Amm.dat +1968 -0
  172. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/CMakeLists.txt +32 -0
  173. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/ColdChem.dat +267 -0
  174. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Concrete_PHR.dat +158 -0
  175. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Concrete_PZ.dat +195 -0
  176. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Kinec.v2.dat +12039 -0
  177. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Kinec_v3.dat +12159 -0
  178. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Makefile.am +28 -0
  179. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Makefile.in +530 -0
  180. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/PHREEQC_ThermoddemV1.10_15Dec2020.dat +12965 -0
  181. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/Tipping_Hurley.dat +4137 -0
  182. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/core10.dat +6824 -0
  183. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/frezchem.dat +634 -0
  184. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/iso.dat +7235 -0
  185. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/llnl.dat +19310 -0
  186. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/minteq.dat +5654 -0
  187. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/minteq.v4.dat +13212 -0
  188. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/phreeqc.dat +1972 -0
  189. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/phreeqc_rates.dat +3158 -0
  190. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/pitzer.dat +1044 -0
  191. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/sit.dat +14348 -0
  192. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/database/wateq4f.dat +4036 -0
  193. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/CMakeLists.txt +35 -0
  194. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/IPhreeqc.pdf +0 -0
  195. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/Makefile.am +24 -0
  196. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/Makefile.in +545 -0
  197. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/NOTICE +51 -0
  198. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/Phreeqc_2_1999_manual.pdf +0 -0
  199. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/Phreeqc_3_2013_manual.pdf +0 -0
  200. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/README +428 -0
  201. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/RELEASE +7294 -0
  202. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/IPhreeqc_8h.html +5096 -0
  203. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/IPhreeqc_8h_source.html +389 -0
  204. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/IPhreeqc_8hpp.html +83 -0
  205. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/IPhreeqc_8hpp_source.html +478 -0
  206. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/Var_8h.html +318 -0
  207. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/Var_8h_source.html +200 -0
  208. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/bc_s.png +0 -0
  209. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/bdwn.png +0 -0
  210. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/classIPhreeqc.html +2274 -0
  211. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/classIPhreeqc.png +0 -0
  212. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/classIPhreeqcStop.html +69 -0
  213. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/classIPhreeqcStop.png +0 -0
  214. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/closed.png +0 -0
  215. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html +68 -0
  216. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/doxygen.css +1440 -0
  217. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/doxygen.png +0 -0
  218. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/dynsections.js +97 -0
  219. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2blank.png +0 -0
  220. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2doc.png +0 -0
  221. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2folderclosed.png +0 -0
  222. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2folderopen.png +0 -0
  223. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2lastnode.png +0 -0
  224. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2link.png +0 -0
  225. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2mlastnode.png +0 -0
  226. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2mnode.png +0 -0
  227. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2node.png +0 -0
  228. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2plastnode.png +0 -0
  229. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2pnode.png +0 -0
  230. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2splitbar.png +0 -0
  231. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/ftv2vertline.png +0 -0
  232. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/index.html +58 -0
  233. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/jquery.js +31 -0
  234. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/nav_f.png +0 -0
  235. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/nav_g.png +0 -0
  236. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/nav_h.png +0 -0
  237. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/open.png +0 -0
  238. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/structVAR.html +143 -0
  239. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/sync_off.png +0 -0
  240. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/sync_on.png +0 -0
  241. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tab_a.png +0 -0
  242. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tab_b.png +0 -0
  243. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tab_h.png +0 -0
  244. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tab_s.png +0 -0
  245. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/html/tabs.css +60 -0
  246. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/doc/phreeqc3.chm +0 -0
  247. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/CMakeLists.txt +11 -0
  248. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/Makefile.am +88 -0
  249. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/Makefile.in +696 -0
  250. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/CMakeLists.txt +1 -0
  251. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/CMakeLists.txt +35 -0
  252. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/CMakeLists.txt.in +21 -0
  253. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/README.txt +44 -0
  254. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/advect.c +101 -0
  255. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/ic +17 -0
  256. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/c/advect/phreeqc.dat +1579 -0
  257. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/CMakeLists.txt +10 -0
  258. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/README.txt +3 -0
  259. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/excel/CMakeLists.txt +9 -0
  260. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/excel/phreeqc.dat +1582 -0
  261. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/excel/runphreeqc.xls +0 -0
  262. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/excel/withcallback.xls +0 -0
  263. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/CMakeLists.txt +11 -0
  264. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/Gypsum.py +52 -0
  265. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/parallel_advect.py +465 -0
  266. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/phreeqc.dat +1582 -0
  267. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/pitzer.dat +790 -0
  268. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/com/python/wateq4f.dat +3846 -0
  269. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/CMakeLists.txt +1 -0
  270. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/CMakeLists.txt +35 -0
  271. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/CMakeLists.txt.in +20 -0
  272. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/README.txt +45 -0
  273. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/advect.cpp +110 -0
  274. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/ic +17 -0
  275. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/cpp/advect/phreeqc.dat +1579 -0
  276. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/CMakeLists.txt +1 -0
  277. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/CMakeLists.txt +44 -0
  278. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/CMakeLists.txt.in +24 -0
  279. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/README.txt +45 -0
  280. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/advect.F90 +102 -0
  281. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/ic +17 -0
  282. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/fortran/advect/phreeqc.dat +1579 -0
  283. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/CMakeLists.txt +26 -0
  284. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/CMakeLists.txt.in +20 -0
  285. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/README.txt +37 -0
  286. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/ex2 +26 -0
  287. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/main.cpp +20 -0
  288. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/phreeqc.dat +1837 -0
  289. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/examples/using-cmake/post-install.cmake.in +7 -0
  290. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/CMakeLists.txt +185 -0
  291. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/FileTest.cpp +171 -0
  292. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/FileTest.h +34 -0
  293. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/Makefile.am +18 -0
  294. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/Makefile.in +466 -0
  295. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestCVar.cpp +9 -0
  296. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestIPhreeqc.cpp +4901 -0
  297. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestIPhreeqcLib.cpp +4644 -0
  298. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestSelectedOutput.cpp +669 -0
  299. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/TestVar.cpp +10 -0
  300. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/conv_fail.in +11 -0
  301. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/dump +42 -0
  302. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/iso.dat +7231 -0
  303. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/kinn20140218 +349 -0
  304. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/missing_e.dat +1556 -0
  305. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/multi_punch +105 -0
  306. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/multi_punch_no_set +102 -0
  307. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/phreeqc.dat.90a6449 +1935 -0
  308. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/gtest/phreeqc.dat.old +1556 -0
  309. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/libtool.m4 +8388 -0
  310. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/ltoptions.m4 +437 -0
  311. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/ltsugar.m4 +124 -0
  312. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/ltversion.m4 +23 -0
  313. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/m4/lt~obsolete.m4 +99 -0
  314. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/resource.h +14 -0
  315. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/CSelectedOutput.cpp +401 -0
  316. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/CSelectedOutput.hxx +77 -0
  317. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/CVar.hxx +162 -0
  318. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Debug.h +12 -0
  319. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/ErrorReporter.hxx +70 -0
  320. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.cpp +1889 -0
  321. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.f.inc +91 -0
  322. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.f90.inc +603 -0
  323. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.h +2182 -0
  324. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc.hpp +1027 -0
  325. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqcCallbacks.h +19 -0
  326. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqcF.f +653 -0
  327. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqcLib.cpp +1098 -0
  328. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc_interface.F90 +1283 -0
  329. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc_interface_F.cpp +535 -0
  330. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/IPhreeqc_interface_F.h +162 -0
  331. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Makefile.am +210 -0
  332. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Makefile.in +1294 -0
  333. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/README.Fortran +17 -0
  334. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Var.c +84 -0
  335. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Var.h +152 -0
  336. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/Version.h +36 -0
  337. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fimpl.h +282 -0
  338. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap.cpp +646 -0
  339. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap.h +163 -0
  340. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap1.cpp +24 -0
  341. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap2.cpp +24 -0
  342. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap3.cpp +24 -0
  343. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap4.cpp +24 -0
  344. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap5.cpp +24 -0
  345. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap6.cpp +25 -0
  346. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap7.cpp +25 -0
  347. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/fwrap8.cpp +24 -0
  348. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ChartHandler.cpp +225 -0
  349. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ChartHandler.h +59 -0
  350. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ChartObject.cpp +1382 -0
  351. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ChartObject.h +444 -0
  352. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/CurveObject.cpp +42 -0
  353. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/CurveObject.h +79 -0
  354. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Dictionary.cpp +41 -0
  355. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Dictionary.h +28 -0
  356. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ExchComp.cxx +398 -0
  357. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ExchComp.h +117 -0
  358. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Exchange.cxx +466 -0
  359. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Exchange.h +74 -0
  360. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Form1.h +1184 -0
  361. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Form1.resX +36 -0
  362. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/GasComp.cxx +265 -0
  363. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/GasComp.h +59 -0
  364. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/GasPhase.cxx +659 -0
  365. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/GasPhase.h +103 -0
  366. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ISolution.cxx +40 -0
  367. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ISolution.h +53 -0
  368. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ISolutionComp.cxx +202 -0
  369. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ISolutionComp.h +138 -0
  370. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/KineticsComp.cxx +318 -0
  371. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/KineticsComp.h +81 -0
  372. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NA.h +1 -0
  373. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NameDouble.cxx +537 -0
  374. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NameDouble.h +66 -0
  375. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NumKeyword.cxx +190 -0
  376. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/NumKeyword.h +67 -0
  377. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PBasic.cpp +8350 -0
  378. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PBasic.h +572 -0
  379. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PHRQ_io_output.cpp +411 -0
  380. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PPassemblage.cxx +375 -0
  381. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PPassemblage.h +70 -0
  382. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PPassemblageComp.cxx +441 -0
  383. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PPassemblageComp.h +83 -0
  384. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Phreeqc.cpp +2087 -0
  385. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Phreeqc.h +2164 -0
  386. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PhreeqcKeywords/Keywords.cpp +242 -0
  387. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/PhreeqcKeywords/Keywords.h +104 -0
  388. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Pressure.cxx +417 -0
  389. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Pressure.h +43 -0
  390. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Reaction.cxx +284 -0
  391. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Reaction.h +57 -0
  392. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ReadClass.cxx +1150 -0
  393. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SS.cxx +609 -0
  394. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SS.h +128 -0
  395. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SSassemblage.cxx +317 -0
  396. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SSassemblage.h +59 -0
  397. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SScomp.cxx +297 -0
  398. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SScomp.h +66 -0
  399. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SelectedOutput.cpp +115 -0
  400. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SelectedOutput.h +209 -0
  401. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Serializer.cxx +213 -0
  402. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Serializer.h +42 -0
  403. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Solution.cxx +1795 -0
  404. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Solution.h +154 -0
  405. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SolutionIsotope.cxx +333 -0
  406. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SolutionIsotope.h +85 -0
  407. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/StorageBin.cxx +1507 -0
  408. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/StorageBin.h +141 -0
  409. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/StorageBinList.cpp +358 -0
  410. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/StorageBinList.h +81 -0
  411. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Surface.cxx +837 -0
  412. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Surface.h +108 -0
  413. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SurfaceCharge.cxx +617 -0
  414. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SurfaceCharge.h +137 -0
  415. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SurfaceComp.cxx +509 -0
  416. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/SurfaceComp.h +70 -0
  417. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/System.cxx +103 -0
  418. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/System.h +89 -0
  419. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Temperature.cxx +423 -0
  420. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Temperature.h +42 -0
  421. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Use.cpp +78 -0
  422. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/Use.h +159 -0
  423. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/UserPunch.cpp +32 -0
  424. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/UserPunch.h +39 -0
  425. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/ZedGraph.dll +0 -0
  426. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/advection.cpp +140 -0
  427. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/basicsubs.cpp +4333 -0
  428. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cl1.cpp +881 -0
  429. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_base.cxx +117 -0
  430. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_base.h +48 -0
  431. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_exports.h +20 -0
  432. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_io.cpp +914 -0
  433. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/PHRQ_io.h +207 -0
  434. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/Parser.cxx +1331 -0
  435. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/Parser.h +310 -0
  436. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/Utils.cxx +263 -0
  437. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/Utils.h +29 -0
  438. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/common/phrqtype.h +18 -0
  439. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cvdense.cpp +566 -0
  440. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cvdense.h +267 -0
  441. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cvode.cpp +3939 -0
  442. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cvode.h +940 -0
  443. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cxxKinetics.cxx +617 -0
  444. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cxxKinetics.h +78 -0
  445. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cxxMix.cxx +154 -0
  446. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/cxxMix.h +58 -0
  447. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/dense.cpp +175 -0
  448. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/dense.h +341 -0
  449. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/dumper.cpp +277 -0
  450. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/dumper.h +60 -0
  451. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/gases.cpp +748 -0
  452. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/global_structures.h +1672 -0
  453. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/input.cpp +133 -0
  454. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/integrate.cpp +1219 -0
  455. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/inverse.cpp +5135 -0
  456. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/isotopes.cpp +1813 -0
  457. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/kinetics.cpp +3180 -0
  458. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/mainsubs.cpp +2320 -0
  459. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/model.cpp +5843 -0
  460. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/nvector.cpp +272 -0
  461. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/nvector.h +485 -0
  462. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/nvector_serial.cpp +1032 -0
  463. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/nvector_serial.h +369 -0
  464. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/parse.cpp +1044 -0
  465. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/phqalloc.cpp +316 -0
  466. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/phqalloc.h +47 -0
  467. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/pitzer.cpp +2709 -0
  468. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/pitzer_structures.cpp +225 -0
  469. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/prep.cpp +6267 -0
  470. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/print.cpp +3673 -0
  471. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/read.cpp +10245 -0
  472. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/readtr.cpp +1495 -0
  473. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/runner.cpp +158 -0
  474. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/runner.h +33 -0
  475. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/sit.cpp +1684 -0
  476. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/smalldense.cpp +324 -0
  477. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/smalldense.h +261 -0
  478. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/spread.cpp +1309 -0
  479. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/step.cpp +1566 -0
  480. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/structures.cpp +3381 -0
  481. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/sundialsmath.cpp +133 -0
  482. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/sundialsmath.h +162 -0
  483. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/sundialstypes.h +183 -0
  484. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/tally.cpp +1288 -0
  485. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/tidy.cpp +5600 -0
  486. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/transport.cpp +6403 -0
  487. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/phreeqcpp/utilities.cpp +1339 -0
  488. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/src/thread.h +64 -0
  489. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/CMakeLists.txt +133 -0
  490. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/Makefile.am +45 -0
  491. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/Makefile.in +1128 -0
  492. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/ex2.in +26 -0
  493. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/main.f90 +31 -0
  494. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/main77.f +6 -0
  495. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/main_fortran.cxx +8 -0
  496. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/phreeqc.dat.in +1556 -0
  497. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/test_c.c +148 -0
  498. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/test_cxx.cxx +152 -0
  499. pyEQL/phreeqc/ext/iphreeqc-3.8.6-17100/tests/test_f90.F90 +328 -0
  500. pyEQL/phreeqc/iphreeqc_wrapper.cpp +75 -0
  501. pyEQL/phreeqc/solution.py +74 -0
  502. pyEQL/phreeqc/var.py +50 -0
  503. pyEQL/presets/Ringers lactate.yaml +20 -0
  504. pyEQL/presets/__init__.py +17 -0
  505. pyEQL/presets/normal saline.yaml +17 -0
  506. pyEQL/presets/rainwater.yaml +17 -0
  507. pyEQL/presets/seawater.yaml +29 -0
  508. pyEQL/presets/urine.yaml +26 -0
  509. pyEQL/presets/wastewater.yaml +21 -0
  510. pyEQL/py.typed +0 -0
  511. pyEQL/salt_ion_match.py +112 -0
  512. pyEQL/solute.py +163 -0
  513. pyEQL/solution.py +2714 -0
  514. pyEQL/utils.py +237 -0
  515. pyeql-1.4.0rc9.dist-info/METADATA +130 -0
  516. pyeql-1.4.0rc9.dist-info/RECORD +519 -0
  517. pyeql-1.4.0rc9.dist-info/WHEEL +5 -0
  518. pyeql-1.4.0rc9.dist-info/licenses/AUTHORS.md +21 -0
  519. pyeql-1.4.0rc9.dist-info/licenses/LICENSE.txt +20 -0
@@ -0,0 +1,1219 @@
1
+ #include "Phreeqc.h"
2
+ #include "phqalloc.h"
3
+ #include "Utils.h"
4
+ #include "Solution.h"
5
+
6
+ #define MAX_QUAD 20
7
+ #define K_POLY 5
8
+
9
+ #if defined(PHREEQCI_GUI)
10
+ #ifdef _DEBUG
11
+ #define new DEBUG_NEW
12
+ #undef THIS_FILE
13
+ static char THIS_FILE[] = __FILE__;
14
+ #endif
15
+ #endif
16
+
17
+ /* ---------------------------------------------------------------------- */
18
+ int Phreeqc::
19
+ calc_all_g(void)
20
+ /* ---------------------------------------------------------------------- */
21
+ {
22
+ int converge, converge1;
23
+ LDBLE new_g, xd1;
24
+ LDBLE epsilon;
25
+
26
+ if (use.Get_surface_ptr() == NULL)
27
+ return (OK);
28
+ /*
29
+ * calculate g for each surface
30
+ */
31
+ epsilon = convergence_tolerance;
32
+ if (convergence_tolerance >= 1e-8)
33
+ {
34
+ G_TOL = 1e-9;
35
+ }
36
+ else
37
+ {
38
+ G_TOL = 1e-10;
39
+ }
40
+
41
+ converge = TRUE;
42
+
43
+ for (int j = 0; j < count_unknowns; j++)
44
+ {
45
+ if (x[j]->type != SURFACE_CB)
46
+ continue;
47
+ if (debug_diffuse_layer == TRUE)
48
+ output_msg(sformatf("Calc_all_g, X[%d]\n", j));
49
+ cxxSurfaceCharge *charge_ptr = use.Get_surface_ptr()->Find_charge(x[j]->surface_charge);
50
+ std::map<LDBLE, cxxSurfDL> temp_g_map;
51
+ cxxSurfDL temp_g;
52
+ charge_ptr->Get_g_map()[0] = temp_g;
53
+ temp_g_map[0] = temp_g;
54
+ xd_global = exp(-2 * x[j]->master[0]->s->la * LOG_10);
55
+ /* alpha = 0.02935 @ 25; (ee0RT/2)**1/2, (L/mol)**1/2 C / m**2 */
56
+ /* 1000 J/kJ and 1000 L/m**3 */
57
+ //alpha_global = sqrt(EPSILON * EPSILON_ZERO * (R_KJ_DEG_MOL * 1000.0) * 1000.0 *
58
+ // tk_x * 0.5);
59
+ alpha_global = sqrt(eps_r * EPSILON_ZERO * (R_KJ_DEG_MOL * 1000.0) * 1000.0 *
60
+ tk_x * 0.5);
61
+ /*
62
+ * calculate g for given surface for each species
63
+ */
64
+ for (int i = 0; i < (int)this->s_x.size(); i++)
65
+ {
66
+ if (s_x[i]->type > HPLUS)
67
+ continue;
68
+ if (temp_g_map.find(s_x[i]->z) != temp_g_map.end())
69
+ continue;
70
+ z_global = s_x[i]->z;
71
+ if (charge_ptr->Get_grams() > 0.0)
72
+ {
73
+
74
+ if ((use.Get_surface_ptr()->Get_only_counter_ions() == false) ||
75
+ (((x[j]->master[0]->s->la > 0) && (z_global < 0))
76
+ || ((x[j]->master[0]->s->la < 0) && (z_global > 0))))
77
+ {
78
+ if (xd_global > 0.1)
79
+ {
80
+ new_g = qromb_midpnt(charge_ptr, 1.0, xd_global);
81
+ }
82
+ else if (xd_global > 0.01)
83
+ {
84
+ new_g = qromb_midpnt(charge_ptr, 1.0, 0.1);
85
+ new_g += qromb_midpnt(charge_ptr, 0.1, xd_global);
86
+ }
87
+ else if (xd_global > 0.001)
88
+ {
89
+ new_g = qromb_midpnt(charge_ptr, 1.0, 0.1);
90
+ new_g += qromb_midpnt(charge_ptr, 0.1, 0.01);
91
+ new_g += qromb_midpnt(charge_ptr, 0.01, xd_global);
92
+ }
93
+ else if (xd_global > 0.0001)
94
+ {
95
+ new_g = qromb_midpnt(charge_ptr, 1.0, 0.1);
96
+ new_g += qromb_midpnt(charge_ptr, 0.1, 0.01);
97
+ new_g += qromb_midpnt(charge_ptr, 0.01, .001);
98
+ new_g += qromb_midpnt(charge_ptr, 0.001, xd_global);
99
+ }
100
+ else if (xd_global > 0.00001)
101
+ {
102
+ new_g = qromb_midpnt(charge_ptr, 1.0, 0.1);
103
+ new_g += qromb_midpnt(charge_ptr, 0.1, 0.01);
104
+ new_g += qromb_midpnt(charge_ptr, 0.01, .001);
105
+ new_g += qromb_midpnt(charge_ptr, 0.001, .0001);
106
+ new_g += qromb_midpnt(charge_ptr, 0.0001, xd_global);
107
+ }
108
+ else if (xd_global > 0.000001)
109
+ {
110
+ new_g = qromb_midpnt(charge_ptr, 1.0, 0.1);
111
+ new_g += qromb_midpnt(charge_ptr, 0.1, 0.01);
112
+ new_g += qromb_midpnt(charge_ptr, 0.01, .001);
113
+ new_g += qromb_midpnt(charge_ptr, 0.001, .0001);
114
+ new_g += qromb_midpnt(charge_ptr, 0.0001, .00001);
115
+ new_g += qromb_midpnt(charge_ptr, 0.00001, xd_global);
116
+ }
117
+ else if (xd_global > 0.0000001)
118
+ {
119
+ new_g = qromb_midpnt(charge_ptr, 1.0, 0.1);
120
+ new_g += qromb_midpnt(charge_ptr, 0.1, 0.01);
121
+ new_g += qromb_midpnt(charge_ptr, 0.01, .001);
122
+ new_g += qromb_midpnt(charge_ptr, 0.001, .0001);
123
+ new_g += qromb_midpnt(charge_ptr, 0.0001, .00001);
124
+ new_g += qromb_midpnt(charge_ptr, 0.00001, .000001);
125
+ new_g += qromb_midpnt(charge_ptr, 0.000001, xd_global);
126
+ }
127
+ else if (xd_global > 0.00000001)
128
+ {
129
+ new_g = qromb_midpnt(charge_ptr, 1.0, 0.1);
130
+ new_g += qromb_midpnt(charge_ptr, 0.1, 0.01);
131
+ new_g += qromb_midpnt(charge_ptr, 0.01, .001);
132
+ new_g += qromb_midpnt(charge_ptr, 0.001, .0001);
133
+ new_g += qromb_midpnt(charge_ptr, 0.0001, .00001);
134
+ new_g += qromb_midpnt(charge_ptr, 0.00001, .000001);
135
+ new_g += qromb_midpnt(charge_ptr, 0.000001, .0000001);
136
+ new_g += qromb_midpnt(charge_ptr, 0.0000001, xd_global);
137
+ }
138
+ else
139
+ {
140
+ new_g = qromb_midpnt(charge_ptr, 1.0, 0.1);
141
+ new_g += qromb_midpnt(charge_ptr, 0.1, 0.01);
142
+ new_g += qromb_midpnt(charge_ptr, 0.01, .001);
143
+ new_g += qromb_midpnt(charge_ptr, 0.001, .0001);
144
+ new_g += qromb_midpnt(charge_ptr, 0.0001, .00001);
145
+ new_g += qromb_midpnt(charge_ptr, 0.00001, .000001);
146
+ new_g += qromb_midpnt(charge_ptr, 0.000001, .0000001);
147
+ new_g += qromb_midpnt(charge_ptr, 0.0000001, .00000001);
148
+ new_g += qromb_midpnt(charge_ptr, 0.00000001, xd_global);
149
+ }
150
+ }
151
+ else
152
+ {
153
+ new_g = 0;
154
+ }
155
+ }
156
+ else
157
+ {
158
+ new_g = 0.0;
159
+ }
160
+ if ((use.Get_surface_ptr()->Get_only_counter_ions()) && new_g < 0)
161
+ new_g = 0;
162
+ converge1 = TRUE;
163
+ if (fabs(new_g) >= 1.)
164
+ {
165
+ if (fabs((new_g - charge_ptr->Get_g_map()[z_global].Get_g()) / new_g) > epsilon)
166
+ {
167
+ converge1 = FALSE;
168
+ }
169
+ }
170
+ else
171
+ {
172
+ if (fabs(new_g - charge_ptr->Get_g_map()[z_global].Get_g()) > epsilon)
173
+ {
174
+ converge1 = FALSE;
175
+ }
176
+ }
177
+ if (converge1 == FALSE)
178
+ {
179
+ converge = FALSE;
180
+ if (debug_diffuse_layer == TRUE)
181
+ {
182
+ output_msg(sformatf(
183
+ "\t%12f\t%12.4e\t%12.4e\t%12.4e\n",
184
+ (double)z_global,
185
+ (double)charge_ptr->Get_g_map()[z_global].Get_g(),
186
+ (double)new_g,
187
+ (double)(new_g - charge_ptr->Get_g_map()[z_global].Get_g())));
188
+ }
189
+ }
190
+ charge_ptr->Get_g_map()[z_global].Set_g(new_g);
191
+ if (new_g == 0)
192
+ {
193
+ charge_ptr->Get_g_map()[z_global].Set_dg(0.);
194
+ }
195
+ else
196
+ {
197
+ if (charge_ptr->Get_grams() > 0.0)
198
+ {
199
+ LDBLE dg = charge_ptr->Get_grams() *
200
+ charge_ptr->Get_specific_area() * alpha_global *
201
+ g_function(xd_global) / F_C_MOL;
202
+ dg *=
203
+ -2. / (exp(x[j]->master[0]->s->la * LOG_10) *
204
+ exp(x[j]->master[0]->s->la * LOG_10));
205
+ if ((xd_global - 1) < 0.0)
206
+ {
207
+ dg *= -1.0;
208
+ }
209
+
210
+ if (fabs(dg) < 1e-8)
211
+ {
212
+ xd1 = exp(-2 * 1e-3 * LOG_10);
213
+ new_g = qromb_midpnt(charge_ptr, 1.0, xd1);
214
+ dg = new_g / .001;
215
+ }
216
+ charge_ptr->Get_g_map()[z_global].Set_dg(dg);
217
+ }
218
+ else
219
+ {
220
+ charge_ptr->Get_g_map()[z_global].Set_dg(0.0);
221
+ }
222
+ }
223
+ temp_g_map[z_global] = charge_ptr->Get_g_map()[z_global];
224
+ }
225
+ if (debug_diffuse_layer == TRUE)
226
+ {
227
+ output_msg(sformatf("\nSurface component %d: charge,\tg,\tdg/dlny,\txd\n",
228
+ (int)charge_ptr->Get_g_map().size()));
229
+ std::map<LDBLE, cxxSurfDL>::iterator it;
230
+ for (it = charge_ptr->Get_g_map().begin(); it != charge_ptr->Get_g_map().end(); it++)
231
+ {
232
+ output_msg(sformatf(
233
+ "\t%12f\t%12.4e\t%12.4e\t%12.4e\n",
234
+ (double)it->first,
235
+ (double)it->second.Get_g(),
236
+ (double)it->second.Get_dg(),
237
+ (double)xd_global));
238
+ }
239
+ }
240
+ }
241
+ return (converge);
242
+ }
243
+ /* ---------------------------------------------------------------------- */
244
+ LDBLE Phreeqc::
245
+ g_function(LDBLE x_value)
246
+ /* ---------------------------------------------------------------------- */
247
+ {
248
+ LDBLE sum, return_value, sum1;
249
+ int i;
250
+ LDBLE ln_x_value;
251
+
252
+ if (equal(x_value, 1.0, G_TOL * 100) == TRUE)
253
+ return (0.0);
254
+ sum = 0.0;
255
+ ln_x_value = log(x_value);
256
+
257
+ cxxSurfaceCharge *charge_ptr = &(use.Get_surface_ptr()->Get_surface_charges()[0]);
258
+ std::map<LDBLE, cxxSurfDL>::iterator it = charge_ptr->Get_g_map().begin();
259
+ for (; it != charge_ptr->Get_g_map().end(); it++)
260
+ {
261
+ it->second.Set_psi_to_z(exp(ln_x_value * it->first) - 1.0);
262
+ }
263
+ for (i = 0; i < (int)this->s_x.size(); i++)
264
+ {
265
+ if (s_x[i]->type < H2O && s_x[i]->z != 0.0)
266
+ {
267
+ sum += s_x[i]->moles * charge_ptr->Get_g_map()[s_x[i]->z].Get_psi_to_z();
268
+ }
269
+ }
270
+ if (sum < 0.0)
271
+ {
272
+ sum = 0.0;
273
+ sum1 = 0.0;
274
+ output_msg(sformatf(
275
+ "Species\tmoles\tX**z-1\tsum\tsum charge\n"));
276
+ for (i = 0; i < (int)this->s_x.size(); i++)
277
+ {
278
+ if (s_x[i]->type < H2O && s_x[i]->z != 0.0)
279
+ {
280
+ sum += s_x[i]->moles * (pow(x_value, s_x[i]->z) - 1.0);
281
+ sum1 += s_x[i]->moles * s_x[i]->z;
282
+ output_msg(sformatf("%s\t%e\t%e\t%e\t%e\n",
283
+ s_x[i]->name, (double)s_x[i]->moles,
284
+ (double)(pow((LDBLE)x_value, (LDBLE)s_x[i]->z) -
285
+ 1.0), (double)sum, (double)sum1));
286
+ }
287
+ }
288
+ error_string = sformatf("Negative sum in g_function, %e\t%e.",
289
+ (double)sum, (double)x_value);
290
+ error_msg(error_string, CONTINUE);
291
+ error_string = sformatf(
292
+ "Solutions must be charge balanced, charge imbalance is %e\n",
293
+ (double)sum1);
294
+ error_msg(error_string, STOP);
295
+ }
296
+
297
+ return_value =
298
+ (exp(ln_x_value * z_global) -
299
+ 1) / sqrt((x_value * x_value * mass_water_aq_x * sum));
300
+ return (return_value);
301
+ }
302
+ /* ---------------------------------------------------------------------- */
303
+ void Phreeqc::
304
+ polint(LDBLE * xa, LDBLE * ya, int n, LDBLE xv, LDBLE * yv, LDBLE * dy)
305
+ /* ---------------------------------------------------------------------- */
306
+ {
307
+ int i, m, ns;
308
+ LDBLE den, dif, dift, ho, hp, w;
309
+
310
+ ns = 1;
311
+ dif = fabs(xv - xa[1]);
312
+ /*
313
+ * Malloc work space
314
+ */
315
+ std::vector<double> c, d;
316
+ c.resize((size_t)n + 1);
317
+ d.resize((size_t)n + 1);
318
+
319
+ for (i = 1; i <= n; i++)
320
+ {
321
+ dift = fabs(xv - xa[i]);
322
+ if (dift < dif)
323
+ {
324
+ ns = i;
325
+ dif = dift;
326
+ }
327
+ c[i] = ya[i];
328
+ d[i] = ya[i];
329
+ }
330
+
331
+ *yv = ya[ns--];
332
+ for (m = 1; m < n; m++)
333
+ {
334
+ for (size_t i = 1; i <= n - m; i++)
335
+ {
336
+ ho = xa[i] - xv;
337
+ hp = xa[i + m] - xv;
338
+ w = c[i + 1] - d[i];
339
+ if ((den = ho - hp) == 0.0)
340
+ {
341
+ error_msg("In subroutine polint.", STOP);
342
+ }
343
+ den = w / den;
344
+ d[i] = hp * den;
345
+ c[i] = ho * den;
346
+ }
347
+ if (2 * ns < (n - m))
348
+ {
349
+ *dy = c[(size_t)ns + 1];
350
+ }
351
+ else
352
+ {
353
+ *dy = d[ns--];
354
+ }
355
+ *yv += *dy;
356
+
357
+ /* *yv += (*dy = (2 * ns < (n-m) ? c[ns+1] : d[ns--])); */
358
+ }
359
+ return;
360
+ }
361
+
362
+ /* ---------------------------------------------------------------------- */
363
+ LDBLE Phreeqc::
364
+ midpnt(LDBLE x1, LDBLE x2, int n)
365
+ /* ---------------------------------------------------------------------- */
366
+ {
367
+ LDBLE xv, tnm, sum, del, ddel;
368
+ int it, j;
369
+
370
+ if (n == 1)
371
+ {
372
+ midpoint_sv = (x2 - x1) * g_function(0.5 * (x1 + x2));
373
+ return (midpoint_sv);
374
+ }
375
+ else
376
+ {
377
+ for (it = 1, j = 1; j < n - 1; j++)
378
+ it *= 3;
379
+ tnm = (LDBLE)it;
380
+ del = (x2 - x1) / (3 * tnm);
381
+ ddel = del + del;
382
+ xv = x1 + 0.5 * del;
383
+ sum = 0.0;
384
+ for (j = 1; j <= it; j++)
385
+ {
386
+ #if defined(PHREEQCI_GUI)
387
+ PhreeqcIWait(this);
388
+ #endif
389
+ sum += g_function(xv);
390
+ xv += ddel;
391
+ sum += g_function(xv);
392
+ xv += del;
393
+ }
394
+ midpoint_sv = (midpoint_sv + (x2 - x1) * sum / tnm) / 3.0;
395
+ return midpoint_sv;
396
+ }
397
+ }
398
+
399
+ /* ---------------------------------------------------------------------- */
400
+ LDBLE Phreeqc::
401
+ qromb_midpnt(cxxSurfaceCharge *charge_ptr, LDBLE x1, LDBLE x2)
402
+ /* ---------------------------------------------------------------------- */
403
+ {
404
+ LDBLE ss, dss;
405
+ LDBLE sv[MAX_QUAD + 2], h[MAX_QUAD + 2];
406
+ int j;
407
+
408
+ h[0] = 1.0;
409
+ sv[0] = midpnt(x1, x2, 1);
410
+ for (j = 1; j < MAX_QUAD; j++)
411
+ {
412
+ sv[j] = midpnt(x1, x2, j + 1);
413
+ h[j] = h[j - 1] / 9.0;
414
+
415
+ if (fabs(sv[j] - sv[j - 1]) <= G_TOL * fabs(sv[j]))
416
+ {
417
+ sv[j] *= charge_ptr->Get_grams() * charge_ptr->Get_specific_area() * alpha_global / F_C_MOL; /* (ee0RT/2)**1/2, (L/mol)**1/2 C / m**2 */
418
+ if ((x2 - 1) < 0.0)
419
+ sv[j] *= -1.0;
420
+ if (debug_diffuse_layer == TRUE)
421
+ {
422
+ output_msg(sformatf(
423
+ "Iterations in qromb_midpnt: %d\n", j));
424
+ }
425
+ return (sv[j]);
426
+ }
427
+
428
+ if (j >= K_POLY - 1)
429
+ {
430
+ polint(&h[j - K_POLY], &sv[j - K_POLY], K_POLY, 0.0, &ss, &dss);
431
+ if (fabs(dss) <= G_TOL * fabs(ss) || fabs(dss) < G_TOL)
432
+ {
433
+ ss *= charge_ptr->Get_grams() * charge_ptr->Get_specific_area() * alpha_global / F_C_MOL; /* (ee0RT/2)**1/2, (L/mol)**1/2 C / m**2 */
434
+ if ((x2 - 1) < 0.0)
435
+ ss *= -1.0;
436
+ if (debug_diffuse_layer == TRUE)
437
+ {
438
+ output_msg(sformatf(
439
+ "Iterations in qromb_midpnt: %d\n", j));
440
+ }
441
+ return (ss);
442
+ }
443
+ }
444
+
445
+ }
446
+ error_string = sformatf(
447
+ "\nToo many iterations integrating diffuse layer.\n");
448
+ error_msg(error_string, STOP);
449
+ return (-999.9);
450
+ }
451
+ /* ---------------------------------------------------------------------- */
452
+ int Phreeqc::
453
+ calc_init_g(void)
454
+ /* ---------------------------------------------------------------------- */
455
+ {
456
+ if (use.Get_surface_ptr() == NULL)
457
+ return (OK);
458
+ /*
459
+ * calculate g for each surface
460
+ */
461
+ for (int j = 0; j < count_unknowns; j++)
462
+ {
463
+ if (x[j]->type != SURFACE_CB)
464
+ continue;
465
+ cxxSurfaceCharge *charge_ptr = use.Get_surface_ptr()->Find_charge(x[j]->surface_charge);
466
+ xd_global = exp(-2 * x[j]->master[0]->s->la * LOG_10);
467
+ /* alpha = 0.02935 @ 25; (ee0RT/2)**1/2, (L/mol)**1/2 C / m**2 */
468
+ /* second 1000 is liters/m**3 */
469
+ //alpha_global = sqrt(EPSILON * EPSILON_ZERO * (R_KJ_DEG_MOL * 1000.0) *
470
+ // 1000.0 * tk_x * 0.5);
471
+ alpha_global = sqrt(eps_r * EPSILON_ZERO * (R_KJ_DEG_MOL * 1000.0) *
472
+ 1000.0 * tk_x * 0.5);
473
+
474
+ if (charge_ptr->Get_g_map().size() == 0)
475
+ {
476
+ cxxSurfDL temp_g;
477
+ charge_ptr->Get_g_map()[0.0] = temp_g;
478
+ }
479
+ /*
480
+ * calculate g for given surface for each species
481
+ */
482
+ for (int i = 0; i < (int)this->s_x.size(); i++)
483
+ {
484
+ if (s_x[i]->type > HPLUS)
485
+ continue;
486
+
487
+ if (charge_ptr->Get_g_map().find(s_x[i]->z) == charge_ptr->Get_g_map().end())
488
+ {
489
+ cxxSurfDL temp_g;
490
+ /* save g for charge */
491
+ if (charge_ptr->Get_grams() > 0.0)
492
+ {
493
+ temp_g.Set_g(2 * alpha_global * sqrt(mu_x) * (pow(xd_global, s_x[i]->z / 2.0) - 1) *
494
+ charge_ptr->Get_grams() *
495
+ charge_ptr->Get_specific_area() / F_C_MOL);
496
+ temp_g.Set_dg(-s_x[i]->z);
497
+ if (use.Get_surface_ptr()->Get_only_counter_ions() &&
498
+ temp_g.Get_g() < 0)
499
+ {
500
+ temp_g.Set_g(0);
501
+ temp_g.Set_dg(0);
502
+ }
503
+ }
504
+ else
505
+ {
506
+ temp_g.Set_g(0);
507
+ temp_g.Set_dg(-s_x[i]->z);
508
+ }
509
+ charge_ptr->Get_g_map()[s_x[i]->z] = temp_g;
510
+ }
511
+
512
+ {
513
+ int is = s_x[i]->number;
514
+ assert(is < (int)s_diff_layer.size());
515
+ // species found in diff_layer
516
+ s_diff_layer[is][charge_ptr->Get_name()].Set_g_moles(0);
517
+ s_diff_layer[is][charge_ptr->Get_name()].Set_dg_g_moles(0);
518
+ }
519
+ }
520
+ if (debug_diffuse_layer == TRUE)
521
+ {
522
+ output_msg(sformatf(
523
+ "\nSurface component %d: charge,\tg,\tdg\n",
524
+ (int)charge_ptr->Get_g_map().size()));
525
+ std::map<LDBLE, cxxSurfDL>::iterator it;
526
+ for (it = charge_ptr->Get_g_map().begin(); it != charge_ptr->Get_g_map().end(); it++)
527
+ {
528
+ output_msg(sformatf("\t%12f\t%12.4e\t%12.4e\n",
529
+ (double)it->first,
530
+ (double)it->second.Get_g(),
531
+ (double)it->second.Get_dg()));
532
+ }
533
+ }
534
+ }
535
+ return (OK);
536
+ }
537
+ /* ---------------------------------------------------------------------- */
538
+ int Phreeqc::
539
+ initial_surface_water(void)
540
+ /* ---------------------------------------------------------------------- */
541
+ {
542
+ /*
543
+ * In initial surface calculation, need to calculate
544
+ * mass of water in diffuse layer.
545
+ * diffuse layer water + aqueous solution water = bulk water.
546
+ * Ionic strength is fixed, so diffuse-layer water will not change
547
+ */
548
+ LDBLE debye_length, b, r, rd, ddl_limit, rd_limit, fraction, sum_surfs, l_s;
549
+ LDBLE damp_aq;
550
+ /*
551
+ * Debye length = 1/k = sqrt[eta*eta_zero*R*T/(2*F**2*mu_x*1000)], Dzombak and Morel, p 36
552
+ *
553
+ * 1000 converts kJ to J; 1000 converts Liters to meter**3; debye_length is in meters.
554
+ */
555
+ //debye_length = (EPSILON * EPSILON_ZERO * R_KJ_DEG_MOL * 1000.0 * tk_x)
556
+ // / (2. * F_C_MOL * F_C_MOL * mu_x * 1000.);
557
+ debye_length = (eps_r * EPSILON_ZERO * R_KJ_DEG_MOL * 1000.0 * tk_x)
558
+ / (2. * F_C_MOL * F_C_MOL * mu_x * 1000.);
559
+ debye_length = sqrt(debye_length);
560
+
561
+ /* ddl is at most the fraction ddl_limit of bulk water */
562
+ ddl_limit = use.Get_surface_ptr()->Get_DDL_limit();
563
+
564
+ /*
565
+ * Loop through all surface components, calculate each H2O surface (diffuse layer),
566
+ * H2O aq, and H2O bulk (diffuse layers plus aqueous).
567
+ */
568
+
569
+ if (use.Get_surface_ptr()->Get_debye_lengths() > 0)
570
+ {
571
+ sum_surfs = 0.0;
572
+ for (int i = 0; i < count_unknowns; i++)
573
+ {
574
+ if (x[i]->type != SURFACE_CB)
575
+ continue;
576
+ cxxSurfaceCharge *charge_ptr = use.Get_surface_ptr()->Find_charge(x[i]->surface_charge);
577
+ sum_surfs +=
578
+ charge_ptr->Get_specific_area() *
579
+ charge_ptr->Get_grams();
580
+ }
581
+ rd = debye_length * use.Get_surface_ptr()->Get_debye_lengths();
582
+ use.Get_surface_ptr()->Set_thickness(rd);
583
+
584
+ if (!sum_surfs)
585
+ {
586
+ for (int i = 0; i < count_unknowns; i++)
587
+ {
588
+ if (x[i]->type != SURFACE_CB)
589
+ continue;
590
+ cxxSurfaceCharge *charge_ptr = use.Get_surface_ptr()->Find_charge(x[i]->surface_charge);
591
+ charge_ptr->Set_mass_water(0);
592
+ }
593
+ }
594
+ else if (state == INITIAL_SURFACE)
595
+ {
596
+ /* distribute water over DDL (rd) and free pore (r - rd) */
597
+ /* find r: free pore (m3) = pi * (r - rd)^2 * L, where L = A / (2*pi*r),
598
+ A = sum_surfs = sum of the surface areas */
599
+ b = -2 * (rd + use.Get_solution_ptr()->Get_mass_water() / (1000 * sum_surfs));
600
+ r = 0.5 * (-b + sqrt(b * b - 4 * rd * rd));
601
+ /* DDL (m3) = pi * (r^2 - (r - rd)^2) * L */
602
+ rd_limit = (1 - sqrt(1 - ddl_limit)) * r;
603
+ /* rd should be smaller than r and the ddl limit */
604
+ if (rd > rd_limit)
605
+ {
606
+ mass_water_surfaces_x =
607
+ use.Get_solution_ptr()->Get_mass_water() * ddl_limit / (1 - ddl_limit);
608
+ r = 0.002 * (mass_water_surfaces_x +
609
+ use.Get_solution_ptr()->Get_mass_water()) / sum_surfs;
610
+ rd_limit = (1 - sqrt(1 - ddl_limit)) * r;
611
+ rd = rd_limit;
612
+ use.Get_surface_ptr()->Set_thickness(rd);
613
+ }
614
+ else
615
+ mass_water_surfaces_x =
616
+ (r * r / pow(r - rd, 2) - 1) * use.Get_solution_ptr()->Get_mass_water();
617
+ for (int i = 0; i < count_unknowns; i++)
618
+ {
619
+ if (x[i]->type != SURFACE_CB)
620
+ continue;
621
+ cxxSurfaceCharge *charge_ptr = use.Get_surface_ptr()->Find_charge(x[i]->surface_charge);
622
+ l_s = charge_ptr->Get_specific_area() * charge_ptr->Get_grams();
623
+ charge_ptr->Set_mass_water(mass_water_surfaces_x * l_s / sum_surfs);
624
+ }
625
+ }
626
+ else
627
+ {
628
+ r = 0.002 * mass_water_bulk_x / sum_surfs;
629
+ rd_limit = (1 - sqrt(1 - ddl_limit)) * r;
630
+ if (rd > rd_limit)
631
+ {
632
+ rd = rd_limit;
633
+ use.Get_surface_ptr()->Set_thickness(rd);
634
+ fraction = ddl_limit;
635
+ }
636
+ else
637
+ fraction = 1 - pow(r - rd, 2) / (r * r);
638
+ damp_aq = 1.0;
639
+ if (g_iterations > 10)
640
+ damp_aq = 0.2;
641
+ else if (g_iterations > 5)
642
+ damp_aq = 0.5;
643
+ mass_water_surfaces_x = damp_aq * fraction * mass_water_bulk_x +
644
+ (1 - damp_aq) * mass_water_surfaces_x;
645
+ for (int i = 0; i < count_unknowns; i++)
646
+ {
647
+ if (x[i]->type != SURFACE_CB)
648
+ continue;
649
+ cxxSurfaceCharge *charge_ptr = use.Get_surface_ptr()->Find_charge(x[i]->surface_charge);
650
+ l_s = charge_ptr->Get_specific_area() *
651
+ charge_ptr->Get_grams();
652
+ charge_ptr->Set_mass_water(mass_water_surfaces_x * l_s / sum_surfs);
653
+ }
654
+ }
655
+ }
656
+ else
657
+ {
658
+ /* take constant thickness of, default 1e-8 m (100 Angstroms) */
659
+ mass_water_surfaces_x = 0.0;
660
+ for (int i = 0; i < count_unknowns; i++)
661
+ {
662
+ if (x[i]->type != SURFACE_CB)
663
+ continue;
664
+ cxxSurfaceCharge *charge_ptr = use.Get_surface_ptr()->Find_charge(x[i]->surface_charge);
665
+ charge_ptr->Set_mass_water(charge_ptr->Get_specific_area() *
666
+ charge_ptr->Get_grams() * use.Get_surface_ptr()->Get_thickness() *
667
+ 1000);
668
+ mass_water_surfaces_x += charge_ptr->Get_mass_water();
669
+ }
670
+ }
671
+
672
+ if (use.Get_surface_ptr()->Get_type() == cxxSurface::CD_MUSIC)
673
+ mass_water_bulk_x = mass_water_aq_x + mass_water_surfaces_x;
674
+ else
675
+ {
676
+ /* for variable distribution of water over DDL and bulk... */
677
+ if (state > INITIAL_SURFACE)
678
+ mass_water_aq_x = mass_water_bulk_x - mass_water_surfaces_x;
679
+ else
680
+ mass_water_bulk_x = mass_water_aq_x + mass_water_surfaces_x;
681
+ }
682
+
683
+ return (OK);
684
+ }
685
+ /* ---------------------------------------------------------------------- */
686
+ int Phreeqc::
687
+ sum_diffuse_layer(cxxSurfaceCharge *charge_ptr)
688
+ /* ---------------------------------------------------------------------- */
689
+ {
690
+ LDBLE mass_water_surface;
691
+ LDBLE molality, moles_excess, moles_surface;
692
+
693
+ if (use.Get_surface_ptr() == NULL)
694
+ return (OK);
695
+ /*
696
+ * Find position of component in list of components
697
+ */
698
+
699
+ /*
700
+ * Loop through all surface components, calculate each H2O surface (diffuse layer),
701
+ * H2O aq, and H2O bulk (diffuse layers plus aqueous).
702
+ */
703
+ count_elts = 0;
704
+ paren_count = 0;
705
+ mass_water_surface = charge_ptr->Get_mass_water();
706
+ for (int j = 0; j < (int)this->s_x.size(); j++)
707
+ {
708
+ if (s_x[j]->type > HPLUS)
709
+ continue;
710
+ molality = under(s_x[j]->lm);
711
+ LDBLE g = charge_ptr->Get_g_map()[s_x[j]->z].Get_g();
712
+ if (s_x[j]->erm_ddl != 1)
713
+ {
714
+ LDBLE ratio_aq = mass_water_surface / mass_water_aq_x;
715
+ LDBLE g2 = g / ratio_aq + 1;
716
+ g = ratio_aq * (g2 * s_x[j]->erm_ddl - 1);
717
+ }
718
+ moles_excess = mass_water_aq_x * molality * g;
719
+ moles_surface = mass_water_surface * molality + moles_excess;
720
+ /*
721
+ * Accumulate elements in diffuse layer
722
+ */
723
+ add_elt_list(s_x[j]->next_elt, moles_surface);
724
+ }
725
+ add_elt_list(s_h2o->next_elt, mass_water_surface / gfw_water);
726
+ elt_list_combine();
727
+ return (OK);
728
+ }
729
+ /* ---------------------------------------------------------------------- */
730
+ int Phreeqc::
731
+ calc_all_donnan(void)
732
+ /* ---------------------------------------------------------------------- */
733
+ {
734
+ bool converge;
735
+ int cd_m;
736
+ LDBLE new_g, f_psi, surf_chrg_eq, psi_avg, f_sinh, A_surf, ratio_aq, ratio_surf_aq, co_ion;
737
+ LDBLE new_g2, f_psi2, surf_chrg_eq2, psi_avg2, dif, var1, viscos;
738
+ cxxSurface *surf_ptr = use.Get_surface_ptr();
739
+
740
+ if (surf_ptr == NULL)
741
+ return (OK);
742
+ f_sinh = sqrt(8000.0 * eps_r * EPSILON_ZERO * (R_KJ_DEG_MOL * 1000.0) *
743
+ tk_x * mu_x);
744
+ bool only_count = surf_ptr->Get_only_counter_ions();
745
+ bool correct_D = surf_ptr->Get_correct_D();
746
+ /* calculate g for each surface...
747
+ */
748
+ if (!calculating_deriv || surf_ptr->Get_debye_lengths() ||
749
+ correct_D) // DL_pitz && correct_D
750
+ initial_surface_water();
751
+ // z1, z2, fr_cat2 are the counter-ions, z_1, z_2, fr_ani2 are for co-ions.
752
+ LDBLE nDbl = 1, db_lim = 2, f_free, fr_cat2, fr_ani2;
753
+ LDBLE z1, z2, z_1, z_2;
754
+ z1 = z2 = z_1 = z_2 = f_free = fr_cat2 = fr_ani2 = 0;
755
+ /*
756
+ * sum eq of each charge number in solution...
757
+ */
758
+ std::map<LDBLE, LDBLE>::iterator it;
759
+ for (it = charge_group_map.begin(); it != charge_group_map.end(); it++)
760
+ {
761
+ it->second = 0.0;
762
+ }
763
+ charge_group_map.clear();
764
+ for (int i = 0; i < (int)this->s_x.size(); i++)
765
+ {
766
+ if (s_x[i]->type > HPLUS)
767
+ continue;
768
+ charge_group_map[s_x[i]->z] += s_x[i]->z * s_x[i]->moles * s_x[i]->erm_ddl;
769
+ }
770
+ for (it = charge_group_map.begin(); it != charge_group_map.end(); it++)
771
+ {
772
+ if (it->first < -1.5) { z_2 += it->second; continue; }
773
+ else if (it->first < 0) { z_1 += it->second; continue; }
774
+ else if (it->first < 1.5) { z1 += it->second; continue; }
775
+ else { z2 += it->second; continue; }
776
+ }
777
+ if (correct_D)
778
+ {
779
+ if ((nDbl = surf_ptr->Get_debye_lengths()) == 0)
780
+ {
781
+ LDBLE debye_length = f_sinh / (F_C_MOL * mu_x * 4e3);
782
+ nDbl = surf_ptr->Get_thickness() / debye_length;
783
+ }
784
+ fr_ani2 = z_2 / (z_1 + z_2);
785
+ fr_cat2 = z2 / (z1 + z2);
786
+ db_lim = 2 - 0.5 * (fr_cat2 + fr_ani2);
787
+ if (nDbl > db_lim)
788
+ {
789
+ f_free = 1 - db_lim / nDbl;
790
+ if (f_free < 0) f_free = 0;
791
+ }
792
+ }
793
+
794
+ converge = TRUE;
795
+ viscos = 0;
796
+ for (int j = 0; j < count_unknowns; j++)
797
+ {
798
+ if (x[j]->type != SURFACE_CB)
799
+ continue;
800
+ cxxSurfaceCharge *charge_ptr = surf_ptr->Find_charge(x[j]->surface_charge);
801
+
802
+ if (debug_diffuse_layer == TRUE)
803
+ output_msg(sformatf("Calc_all_g, X[%d]\n", j));
804
+
805
+ /* find surface charge from potential... */
806
+ A_surf = charge_ptr->Get_specific_area() * charge_ptr->Get_grams();
807
+ if (surf_ptr->Get_type() == cxxSurface::CD_MUSIC)
808
+ {
809
+ f_psi = x[(size_t)j + 2]->master[0]->s->la * LOG_10; /* -FPsi/RT */
810
+ f_psi = f_psi / 2;
811
+ cd_m = 1;
812
+ }
813
+ else
814
+ {
815
+ f_psi = x[j]->master[0]->s->la * LOG_10;
816
+ cd_m = -1;
817
+ }
818
+ surf_chrg_eq = A_surf * f_sinh * sinh(f_psi) / F_C_MOL;
819
+ LDBLE lim_seq = 5e3;
820
+ if (correct_D) lim_seq = 5e3;
821
+ if (fabs(surf_chrg_eq) > lim_seq)
822
+ {
823
+ surf_chrg_eq = (surf_chrg_eq < 0 ? -lim_seq : lim_seq);
824
+ var1 = surf_chrg_eq / (A_surf * f_sinh / F_C_MOL);
825
+ var1 = (var1 + sqrt(var1 * var1 + 1));
826
+ f_psi = (var1 > 1e-8 ? log(var1) : -18.4);
827
+ surf_chrg_eq = A_surf * f_sinh * sinh(f_psi) / F_C_MOL;
828
+ x[j]->master[0]->s->la = f_psi / LOG_10;
829
+ }
830
+ /* also for the derivative... */
831
+ dif = 1e-5;
832
+ f_psi2 = f_psi + dif;
833
+ surf_chrg_eq2 = A_surf * f_sinh * sinh(f_psi2) / F_C_MOL;
834
+
835
+ /* find psi_avg that matches surface charge... */
836
+ std::vector<LDBLE> zcorr(charge_group_map.size());
837
+ std::vector<LDBLE> zcorr2(charge_group_map.size());
838
+ //LDBLE fD = 0;
839
+ psi_avg = calc_psi_avg(charge_ptr, surf_chrg_eq, nDbl, f_free, zcorr);
840
+ psi_avg2 = calc_psi_avg(charge_ptr, surf_chrg_eq2, nDbl, f_free, zcorr2);
841
+
842
+ /*output_msg(sformatf( "psi's %e %e %e\n", f_psi, psi_avg, surf_chrg_eq)); */
843
+
844
+ /* fill in g's */
845
+ ratio_aq = charge_ptr->Get_mass_water() / mass_water_aq_x;
846
+ ratio_surf_aq = charge_ptr->Get_mass_water() / mass_water_surfaces_x;
847
+ //ratio_surf_aq = charge_ptr->Get_mass_water() / mass_water_bulk_x;
848
+ if (correct_D)
849
+ ratio_aq *= (1 - f_free);
850
+ int z_iter = 0;
851
+ for (it = charge_group_map.begin(); it != charge_group_map.end(); it++)
852
+ {
853
+ LDBLE z = it->first, z1 = z;
854
+ co_ion = surf_chrg_eq * z;
855
+ if (correct_D)
856
+ z1 = zcorr[z_iter];
857
+
858
+ if (!ratio_aq)
859
+ {
860
+ charge_ptr->Get_g_map()[z].Set_g(0);
861
+ charge_ptr->Get_g_map()[z].Set_dg(0);
862
+ charge_ptr->Get_z_gMCD_map()[z] = 0;
863
+ converge = true;
864
+ continue;
865
+ }
866
+ new_g = ratio_aq * (exp(cd_m * z1 * psi_avg) - 1);
867
+ if (only_count && co_ion > 0)
868
+ new_g = -ratio_aq;
869
+ if (new_g <= -ratio_aq)
870
+ new_g = -ratio_aq + G_TOL * 1e-3;
871
+ new_g2 = ratio_aq * (exp(cd_m * z1 * psi_avg2) - 1);
872
+ if (only_count && co_ion > 0)
873
+ new_g2 = -ratio_aq;
874
+ if (new_g2 <= -ratio_aq)
875
+ new_g2 = -ratio_aq + G_TOL * 1e-3;
876
+ if (fabs(new_g) >= 1)
877
+ {
878
+ if (fabs((new_g - charge_ptr->Get_g_map()[z].Get_g()) / new_g) > convergence_tolerance)
879
+ {
880
+ converge = FALSE;
881
+ }
882
+ }
883
+ else
884
+ {
885
+ if (fabs(new_g - charge_ptr->Get_g_map()[z].Get_g()) > convergence_tolerance)
886
+ {
887
+ converge = FALSE;
888
+ }
889
+ }
890
+ charge_ptr->Get_g_map()[z].Set_g(new_g);
891
+ if (new_g != 0)
892
+ {
893
+ charge_ptr->Get_g_map()[z].Set_dg((new_g2 - new_g) / dif);
894
+ }
895
+ else
896
+ {
897
+ charge_ptr->Get_g_map()[z].Set_dg(-z);
898
+ }
899
+ /* save Boltzmann factor * water fraction for MCD calc's in transport */
900
+ if (converge)
901
+ {
902
+ if (only_count && co_ion > 0) // co-ions are not in the DL
903
+ charge_ptr->Get_z_gMCD_map()[z] = 0;
904
+ else
905
+ {
906
+ charge_ptr->Get_z_gMCD_map()[z] = (exp(cd_m * z1 * psi_avg) * (1 - f_free) + f_free) *
907
+ ratio_surf_aq;// * s_x[]->moles == mol_DL in charge_ptr
908
+ }
909
+ }
910
+ z_iter++;
911
+ }
912
+
913
+ charge_ptr->Set_f_free(f_free);
914
+ if (debug_diffuse_layer == TRUE)
915
+ {
916
+ std::string name = x[j]->master[0]->elt->name;
917
+ Utilities::replace("_psi", "", name);
918
+ output_msg(sformatf(
919
+ "\nDonnan all on %s (%d): charge, \tg, \tdg, \tzcorr, \tPsi_surface = %8f V, \tDebye lengths = %8f. \n",
920
+ name.c_str(), (int)charge_ptr->Get_g_map().size(),
921
+ x[j]->master[0]->s->la * 2 * LOG_10 * R_KJ_DEG_MOL * tk_x / F_KJ_V_EQ,
922
+ nDbl));
923
+ int i = 0;
924
+ for (std::map<LDBLE, cxxSurfDL>::iterator i_it = charge_ptr->Get_g_map().begin();
925
+ i_it != charge_ptr->Get_g_map().end(); i_it++)
926
+ {
927
+ output_msg(sformatf("\t%12f\t%12.4e\t%12.4e\t%12.4e\n",
928
+ (double)i_it->first,
929
+ (double)i_it->second.Get_g(),
930
+ (double)i_it->second.Get_dg(),
931
+ (double)zcorr[i]));
932
+ i++;
933
+ }
934
+ }
935
+ }
936
+ return (converge);
937
+ }
938
+ /* ---------------------------------------------------------------------- */
939
+ int Phreeqc::
940
+ calc_init_donnan(void)
941
+ /* ---------------------------------------------------------------------- */
942
+ {
943
+ LDBLE f_psi, surf_chrg_eq, psi_avg, f_sinh, A_surf, ratio_aq;
944
+ cxxSurface *surf_ptr = use.Get_surface_ptr();
945
+
946
+ if (surf_ptr == NULL)
947
+ return (OK);
948
+ f_sinh =
949
+ //sqrt(8000.0 * EPSILON * EPSILON_ZERO * (R_KJ_DEG_MOL * 1000.0) *
950
+ // tk_x * mu_x);
951
+ sqrt(8000.0 * eps_r * EPSILON_ZERO * (R_KJ_DEG_MOL * 1000.0) *
952
+ tk_x * mu_x);
953
+ if (convergence_tolerance >= 1e-8)
954
+ {
955
+ G_TOL = 1e-9;
956
+ }
957
+ else
958
+ {
959
+ G_TOL = 1e-13;
960
+ }
961
+ /*
962
+ * sum eq of each charge number in solution...
963
+ */
964
+ charge_group_map.clear();
965
+ charge_group_map[0.0] = 0.0;
966
+
967
+ for (int i = 0; i < (int)this->s_x.size(); i++)
968
+ {
969
+ if (s_x[i]->type > HPLUS)
970
+ continue;
971
+ if (charge_group_map.find(s_x[i]->z) != charge_group_map.end())
972
+ {
973
+ charge_group_map.find(s_x[i]->z)->second += s_x[i]->z * s_x[i]->moles * s_x[i]->erm_ddl;
974
+ }
975
+ else
976
+ {
977
+ charge_group_map[s_x[i]->z] = s_x[i]->z * s_x[i]->moles * s_x[i]->erm_ddl;
978
+ }
979
+ }
980
+ std::vector<LDBLE> zcorr(charge_group_map.size());
981
+ /*
982
+ * calculate g for each surface...
983
+ */
984
+ for (int j = 0; j < count_unknowns; j++)
985
+ {
986
+ if (x[j]->type != SURFACE_CB)
987
+ continue;
988
+ cxxSurfaceCharge *charge_ptr = surf_ptr->Find_charge(x[j]->surface_charge);
989
+ charge_ptr->Get_g_map().clear();
990
+
991
+ /* find surface charge from potential... */
992
+ A_surf = charge_ptr->Get_specific_area() * charge_ptr->Get_grams();
993
+ if (surf_ptr->Get_type() == cxxSurface::CD_MUSIC)
994
+ {
995
+ f_psi = x[(size_t)j + 2]->master[0]->s->la * LOG_10; /* -FPsi/RT */
996
+ f_psi = f_psi / 2;
997
+ }
998
+ else
999
+ f_psi = x[j]->master[0]->s->la * LOG_10;
1000
+ surf_chrg_eq = A_surf * f_sinh * sinh(f_psi) / F_C_MOL;
1001
+
1002
+ /* find psi_avg that matches surface charge... */
1003
+ psi_avg = calc_psi_avg(charge_ptr, 0 * surf_chrg_eq, 0, 0, zcorr);
1004
+
1005
+ /* fill in g's */
1006
+ ratio_aq = charge_ptr->Get_mass_water() / mass_water_aq_x;
1007
+
1008
+ std::map<LDBLE, LDBLE>::iterator kit;
1009
+ for (kit = charge_group_map.begin(); kit != charge_group_map.end(); kit++)
1010
+ {
1011
+ LDBLE z = kit->first;
1012
+ LDBLE eq = kit->second;
1013
+
1014
+ charge_ptr->Get_g_map()[z].Set_g(ratio_aq * (exp(-z * psi_avg) - 1));
1015
+
1016
+ if (surf_ptr->Get_only_counter_ions()
1017
+ && ((surf_chrg_eq < 0 && z < 0)
1018
+ || (surf_chrg_eq > 0 && z > 0)))
1019
+ charge_ptr->Get_g_map()[z].Set_g(-ratio_aq);
1020
+
1021
+ if (charge_ptr->Get_g_map()[z].Get_g() != 0)
1022
+ {
1023
+ charge_ptr->Get_g_map()[z].Set_dg(-A_surf * f_sinh * cosh(f_psi) /
1024
+ (eq * F_C_MOL));
1025
+ }
1026
+ else
1027
+ {
1028
+ charge_ptr->Get_g_map()[z].Set_dg(-z);
1029
+ }
1030
+ /* save g for species */
1031
+ for (int i = 0; i < (int)this->s_x.size(); i++)
1032
+ {
1033
+ int is = s_x[i]->number;
1034
+ assert(is < (int)s_diff_layer.size());
1035
+
1036
+ s_diff_layer[is][charge_ptr->Get_name()].Set_g_moles(0.0);
1037
+ s_diff_layer[is][charge_ptr->Get_name()].Set_dg_g_moles(0.0);
1038
+ }
1039
+ }
1040
+ if (debug_diffuse_layer == TRUE)
1041
+ {
1042
+ std::string name = x[j]->master[0]->elt->name;
1043
+ Utilities::replace("_psi", "", name);
1044
+ output_msg(sformatf(
1045
+ "\nDonnan init on %s : charge, \tg, \tdg, \tzcorr, Psi_surface = %8f V. \n",
1046
+ name.c_str(),
1047
+ x[j]->master[0]->s->la * 2 * LOG_10 * R_KJ_DEG_MOL *
1048
+ tk_x / F_KJ_V_EQ));
1049
+ for (std::map<LDBLE, cxxSurfDL>::iterator i_it = charge_ptr->Get_g_map().begin();
1050
+ i_it != charge_ptr->Get_g_map().end(); i_it++)
1051
+ {
1052
+ output_msg(sformatf("\t%12f\t%12.4e\t%12.4e\t%12.4e\n",
1053
+ (double)i_it->first,
1054
+ (double)i_it->second.Get_g(),
1055
+ (double)i_it->second.Get_dg()));
1056
+ }
1057
+ }
1058
+ }
1059
+ return (OK);
1060
+ }
1061
+ /* ---------------------------------------------------------------------- */
1062
+ LDBLE Phreeqc::
1063
+ calc_psi_avg(cxxSurfaceCharge *charge_ptr, LDBLE surf_chrg_eq, LDBLE nDbl, LDBLE f_free, std::vector<LDBLE> &zcorr)
1064
+ /* ---------------------------------------------------------------------- */
1065
+ {
1066
+ /*
1067
+ * calculate the average (F * Psi / RT) that lets the DL charge counter the surface charge
1068
+ */
1069
+ LDBLE fd, fd1, p, /*psi_DL, */p_psi = R_KJ_DEG_MOL * tk_x / F_KJ_V_EQ, temp, ratio_aq, z, Z1, Z1_c, eq, co_ion, sum_counter, sum_co;
1070
+ LDBLE z1, z2, z_1, z_2;
1071
+ ratio_aq = charge_ptr->Get_mass_water() / mass_water_aq_x;
1072
+ p = 0;
1073
+ if (surf_chrg_eq == 0 || ratio_aq == 0)
1074
+ return (0.0);
1075
+ else if (surf_chrg_eq < 0)
1076
+ p = -0.5 * log(-surf_chrg_eq * ratio_aq * (1 - f_free) / mu_x + 1);
1077
+ else if (surf_chrg_eq > 0)
1078
+ p = 0.5 * log(surf_chrg_eq * ratio_aq * (1 - f_free) / mu_x + 1);
1079
+ /*
1080
+ * Optimize p in SS{s_x[i]->moles * z_i * g(p)} = -surf_chrg_eq
1081
+ * g(p) = exp(-p * z_i) * ratio_aq * (1 - f_free)
1082
+ * Elsewhere in PHREEQC, g is the excess, after subtraction of conc's for p = 0:
1083
+ * g(p) = (exp(-p *z_i) - 1) * ratio_aq
1084
+ * with correct_D true and f_free > 0:
1085
+ c_edl = c_free * (f_free + (1 - f_free) * exp(-p * z_i))
1086
+ * with correct_D true and f_free == 0:
1087
+ * correct ions to better match the integrated PB concentrations:
1088
+ Gamma = abs(surf_chrg_eq / A_surf / 1e-6)
1089
+ a = cgc[1] * nDbl**cgc[2]
1090
+ b = Gamma**cgc[3] / abs(log10(I))
1091
+ counter_ions...
1092
+ z == 1? z1 = cgc[0] * I**(a * b)
1093
+ z == 2? z2 = 2 * cgc[4] * I**(cgc[5] * a * b)
1094
+ co_ions...
1095
+ c = cgc[7] * nDbl**cgc[8] * Gamma**cgc[9]
1096
+ z == -1? z_1 = -cgc[6] * I**(c)
1097
+ z == -2? z_2 = -2 * cgc[10] * I**(c * cgc[11])
1098
+ c_edl = c_free * exp(-p * z_i)
1099
+ */
1100
+
1101
+ cxxSurface *surf_ptr = use.Get_surface_ptr();
1102
+ bool correct_D = surf_ptr->Get_correct_D(), local_correct_D = correct_D;
1103
+ bool only_count = surf_ptr->Get_only_counter_ions();
1104
+ LDBLE Gamma, cgc[12] = { 0.3805, -0.0106, 1.96, 0.812,
1105
+ 0.395, 2.13,
1106
+ 0.380, 0.0408, 0.799, 0.594,
1107
+ 0.373, 1.181 };
1108
+ if (correct_D)
1109
+ {
1110
+ if (f_free)
1111
+ {
1112
+ z1 = z2 = z_1 = z_2 = 1;
1113
+ }
1114
+ else
1115
+ {
1116
+ if (!surf_ptr->Donnan_factors.empty())
1117
+ {
1118
+ std::copy(surf_ptr->Donnan_factors.begin(), surf_ptr->Donnan_factors.end(), cgc);
1119
+ z1 = cgc[0];
1120
+ z2 = cgc[1];
1121
+ z_1 = cgc[2];
1122
+ z_2 = cgc[3];
1123
+ }
1124
+ else
1125
+ {
1126
+ Gamma = fabs(surf_chrg_eq) / (charge_ptr->Get_specific_area() * charge_ptr->Get_grams()) / 1e-6;
1127
+ LDBLE a = cgc[1] * pow(nDbl, cgc[2]),
1128
+ b = pow(Gamma, cgc[3]) / abs(log10(mu_x));
1129
+ // counter_ions...
1130
+ z1 = cgc[0] * pow(mu_x, (a * b));
1131
+ z2 = cgc[4] * pow(mu_x, (cgc[5] * a * b));
1132
+ if (z1 > 1) z1 = 1;
1133
+ if (z2 > 1) z2 = 1;
1134
+ // co_ions...
1135
+ LDBLE c = cgc[7] * pow(nDbl, cgc[8]) * pow(Gamma, cgc[9]);
1136
+ z_1 = cgc[6] * pow(mu_x, c);
1137
+ z_2 = cgc[10] * pow(mu_x, (c * cgc[11]));
1138
+ }
1139
+ }
1140
+ }
1141
+
1142
+ int l_iter = 0, z_iter;
1143
+ sum_co = sum_counter = 0;
1144
+ do
1145
+ {
1146
+ fd = surf_chrg_eq;
1147
+ fd1 = 0.0;
1148
+ z_iter = 0;
1149
+ if (l_iter == 1 && local_correct_D && fabs(sum_counter) < fabs(sum_co))
1150
+ {
1151
+ local_correct_D = false;
1152
+ l_iter = 0;
1153
+ }
1154
+ std::map<LDBLE, LDBLE>::iterator it;
1155
+ for (it = charge_group_map.begin(); it != charge_group_map.end(); it++)
1156
+ {
1157
+ z = it->first;
1158
+ Z1 = z;
1159
+ if (l_iter == 0) zcorr[z_iter] = z;
1160
+ co_ion = surf_chrg_eq * z;
1161
+ if (!z || (only_count && co_ion > 0))
1162
+ {
1163
+ z_iter++;
1164
+ continue;
1165
+ }
1166
+ if (nDbl && local_correct_D)
1167
+ {
1168
+ /*psi_DL = fabs(p * p_psi);*/
1169
+ if (co_ion < 0)
1170
+ {//counter-ion
1171
+ if (fabs(z) > 1.5) temp = z2;
1172
+ else temp = z1;
1173
+ sum_counter += z * temp;
1174
+ }
1175
+ else
1176
+ {// co-ion
1177
+ if (fabs(z) > 1.5) temp = z_2;
1178
+ else temp = z_1;
1179
+ sum_co += z * temp;
1180
+ }
1181
+ zcorr[z_iter] = z * temp;
1182
+ }
1183
+ Z1 = zcorr[z_iter];
1184
+ eq = it->second;
1185
+ temp = exp(-Z1 * p) * ratio_aq * (1 - f_free);
1186
+
1187
+ fd += eq * temp;
1188
+ fd1 -= Z1 * eq * temp;
1189
+ if (z == 1) Z1_c = Z1;
1190
+ z_iter++;
1191
+ }
1192
+ fd /= -fd1;
1193
+ p += (fd > 1) ? 1 : ((fd < -1) ? -1 : fd);
1194
+ if (fabs(p) < G_TOL)
1195
+ p = 0.0;
1196
+ l_iter++;
1197
+ if (l_iter > 50)
1198
+ {
1199
+ pr.all = TRUE;
1200
+ pr.exchange = TRUE;
1201
+ pr.headings = TRUE;
1202
+ pr.pp_assemblage = TRUE;
1203
+ pr.species = TRUE;
1204
+ pr.surface = TRUE;
1205
+ pr.totals = TRUE;
1206
+ print_all();
1207
+ error_string = sformatf(
1208
+ "\nToo many iterations in subroutine calc_psi_avg; surface charge = %12.4e; surface water = %12.4e.\n",
1209
+ (double)surf_chrg_eq, (double)charge_ptr->Get_mass_water());
1210
+ error_msg(error_string, STOP);
1211
+ }
1212
+ } while (fabs(fd) > 1e-12 && p != 0.0);
1213
+ if (debug_diffuse_layer == TRUE)
1214
+ output_msg(sformatf(
1215
+ "iter in calc_psi_avg = %d. g(+1) = %8f, surface charge = %12.4e, psi_DL = %12.3e V.\n",
1216
+ l_iter, (double)(exp(-p) - 1), (double)surf_chrg_eq, (double)(p * Z1_c * p_psi)));
1217
+
1218
+ return (p);
1219
+ }