pyEQL 1.4.0rc9__cp310-cp310-macosx_10_9_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-310-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,2320 @@
1
+ #include <time.h>
2
+ #include <assert.h>
3
+ #include "Utils.h"
4
+ #include "Phreeqc.h"
5
+ #include "phqalloc.h"
6
+ #include "PBasic.h"
7
+ #include "Temperature.h"
8
+ #include "Exchange.h"
9
+ #include "GasPhase.h"
10
+ #include "Reaction.h"
11
+ #include "PPassemblage.h"
12
+ #include "SSassemblage.h"
13
+ #include "cxxKinetics.h"
14
+ #include "Solution.h"
15
+
16
+ #if defined(WINDOWS) || defined(_WINDOWS)
17
+ #include <windows.h>
18
+ #endif
19
+
20
+ #if defined(PHREEQCI_GUI)
21
+ #ifdef _DEBUG
22
+ #define new DEBUG_NEW
23
+ #undef THIS_FILE
24
+ static char THIS_FILE[] = __FILE__;
25
+ #endif
26
+ #endif
27
+
28
+ /* ---------------------------------------------------------------------- */
29
+ void Phreeqc::
30
+ initialize(void)
31
+ /* ---------------------------------------------------------------------- */
32
+ {
33
+ /*
34
+ * Initialize global variables
35
+ */
36
+ moles_per_kilogram_string = "Mol/kgw";
37
+ /*
38
+ * Allocate space
39
+ */
40
+ cell_data.resize((size_t)count_cells + 2); // initialized by global_structures.h
41
+
42
+ count_inverse = 0;
43
+ space((void **) ((void *) &line), INIT, &max_line, sizeof(char));
44
+
45
+ space((void **) ((void *) &line_save), INIT, &max_line, sizeof(char));
46
+
47
+ // one stag_data in phreeqc.h, initialized in global_structures
48
+
49
+ // user_print
50
+ user_print = new class rate;
51
+ user_print->name = string_hsave("User_print");
52
+ user_print->commands.clear();
53
+ user_print->linebase = NULL;
54
+ user_print->varbase = NULL;
55
+ user_print->loopbase = NULL;
56
+ /*
57
+ Initialize llnl aqueous model parameters
58
+ */
59
+ a_llnl = b_llnl = 0.0;
60
+ // new PBasic
61
+ if (basic_interpreter != NULL)
62
+ {
63
+ basic_free();
64
+ }
65
+ basic_interpreter = new PBasic(this, phrq_io);
66
+ // allocate one change_surf
67
+ change_surf =
68
+ (struct Change_Surf *)
69
+ PHRQ_malloc((size_t) (2 * sizeof(struct Change_Surf)));
70
+ if (change_surf == NULL)
71
+ malloc_error();
72
+ change_surf[0].cell_no = -99;
73
+ change_surf[0].next = TRUE;
74
+ change_surf[1].cell_no = -99;
75
+ change_surf[1].next = FALSE;
76
+ /*
77
+ * define constant named log_k
78
+ */
79
+ class logk* logk_ptr = logk_store("XconstantX", TRUE);
80
+ read_log_k_only("1.0", &logk_ptr->log_k[0]);
81
+
82
+ #ifdef PHREEQCI_GUI
83
+ g_spread_sheet.heading = NULL;
84
+ g_spread_sheet.units = NULL;
85
+ g_spread_sheet.defaults.units = NULL;
86
+ g_spread_sheet.defaults.redox = NULL;
87
+ assert(g_spread_sheet.rows.empty());
88
+ assert(g_spread_sheet.defaults.iso.empty());
89
+ #endif
90
+
91
+ // Initialize cvode
92
+ cvode_init();
93
+
94
+ // Allocate space for pitzer
95
+ pitzer_init();
96
+
97
+ // Allocate space for sit
98
+ sit_init();
99
+
100
+ use_kinetics_limiter = false;
101
+
102
+ return;
103
+ }
104
+ /* ---------------------------------------------------------------------- */
105
+ int Phreeqc::
106
+ set_use(void)
107
+ /* ---------------------------------------------------------------------- */
108
+ {
109
+ /*
110
+ * Structure "use" has list of solution, ex, surf, pp_assemblage,
111
+ * gas_phase and solid solution to use in current calculations,
112
+ * also mix, irrev, and temp.
113
+ * This routine searches for the user numbers in each list
114
+ * (solution, ex, ...) and sets a pointer in structure use
115
+ */
116
+
117
+ /*
118
+ * Initial solution case
119
+ */
120
+ use.Set_pp_assemblage_ptr(NULL);
121
+ use.Set_mix_ptr(NULL);
122
+ use.Set_reaction_ptr(NULL);
123
+ use.Set_exchange_ptr(NULL);
124
+ use.Set_kinetics_ptr(NULL);
125
+ use.Set_surface_ptr(NULL);
126
+ use.Set_temperature_ptr(NULL);
127
+ use.Set_pressure_ptr(NULL);
128
+ use.Set_gas_phase_ptr(NULL);
129
+ use.Set_ss_assemblage_ptr(NULL);
130
+
131
+ if (state < REACTION)
132
+ {
133
+ return (OK);
134
+ }
135
+ /*
136
+ * Reaction case
137
+ */
138
+ if (use.Get_pp_assemblage_in() == FALSE &&
139
+ use.Get_reaction_in() == FALSE &&
140
+ use.Get_mix_in() == FALSE &&
141
+ use.Get_exchange_in() == FALSE &&
142
+ use.Get_kinetics_in() == FALSE &&
143
+ use.Get_surface_in() == FALSE &&
144
+ use.Get_temperature_in() == FALSE &&
145
+ use.Get_pressure_in() == FALSE &&
146
+ use.Get_gas_phase_in() == FALSE && use.Get_ss_assemblage_in() == FALSE)
147
+ {
148
+ return (FALSE);
149
+ }
150
+ if (use.Get_solution_in() == FALSE && use.Get_mix_in() == FALSE)
151
+ return (FALSE);
152
+ /*
153
+ * Find solution
154
+ */
155
+ if (use.Get_solution_in())
156
+ {
157
+ use.Set_solution_ptr(Utilities::Rxn_find(Rxn_solution_map, use.Get_n_solution_user()));
158
+ if (use.Get_solution_ptr() == NULL)
159
+ {
160
+ error_string = sformatf( "Solution %d not found.",
161
+ use.Get_n_solution_user());
162
+ error_msg(error_string, STOP);
163
+ }
164
+ }
165
+ /*
166
+ * Find mixture
167
+ */
168
+ if (use.Get_mix_in() == TRUE)
169
+ {
170
+ use.Set_mix_ptr(Utilities::Rxn_find(Rxn_mix_map, use.Get_n_mix_user()));
171
+ use.Set_n_mix_user_orig(use.Get_n_mix_user());
172
+ if (use.Get_mix_ptr() == NULL)
173
+ {
174
+ error_string = sformatf( "Mix %d not found.",
175
+ use.Get_n_mix_user());
176
+ error_msg(error_string, STOP);
177
+ }
178
+ }
179
+ else
180
+ {
181
+ use.Set_mix_ptr(NULL);
182
+ }
183
+ /*
184
+ * Find pure phase assemblage
185
+ */
186
+ if (use.Get_pp_assemblage_in() == TRUE)
187
+ {
188
+ use.Set_pp_assemblage_ptr(Utilities::Rxn_find(Rxn_pp_assemblage_map, use.Get_n_pp_assemblage_user()));
189
+ if (use.Get_pp_assemblage_ptr() == NULL)
190
+ {
191
+ error_string = sformatf( "Pure phase assemblage %d not found.",
192
+ use.Get_n_pp_assemblage_user());
193
+ error_msg(error_string, STOP);
194
+ }
195
+ }
196
+ else
197
+ {
198
+ use.Set_pp_assemblage_ptr(NULL);
199
+ }
200
+ /*
201
+ * Find irrev reaction
202
+ */
203
+ if (use.Get_reaction_in() == TRUE)
204
+ {
205
+ use.Set_reaction_ptr(Utilities::Rxn_find(Rxn_reaction_map, use.Get_n_reaction_user()));
206
+ if (use.Get_reaction_ptr() == NULL)
207
+ {
208
+ error_string = sformatf( "Reaction %d not found.",
209
+ use.Get_n_reaction_user());
210
+ error_msg(error_string, STOP);
211
+ }
212
+ }
213
+ else
214
+ {
215
+ use.Set_reaction_ptr(NULL);
216
+ }
217
+ /*
218
+ * Find exchange
219
+ */
220
+ if (use.Get_exchange_in() == TRUE)
221
+ {
222
+ use.Set_exchange_ptr(Utilities::Rxn_find(Rxn_exchange_map, use.Get_n_exchange_user()));
223
+ if (use.Get_exchange_ptr() == NULL)
224
+ {
225
+ error_string = sformatf( "Exchange %d not found.",
226
+ use.Get_n_exchange_user());
227
+ error_msg(error_string, STOP);
228
+ }
229
+ }
230
+ else
231
+ {
232
+ use.Set_exchange_ptr(NULL);
233
+ }
234
+ /*
235
+ * Find kinetics
236
+ */
237
+ if (use.Get_kinetics_in() == TRUE)
238
+ {
239
+ use.Set_kinetics_ptr(Utilities::Rxn_find(Rxn_kinetics_map, use.Get_n_kinetics_user()));
240
+ if (use.Get_kinetics_ptr() == NULL)
241
+ {
242
+ error_string = sformatf( "Kinetics %d not found.",
243
+ use.Get_n_kinetics_user());
244
+ error_msg(error_string, STOP);
245
+ }
246
+ }
247
+ else
248
+ {
249
+ use.Set_kinetics_ptr(NULL);
250
+ }
251
+ /*
252
+ * Find surface
253
+ */
254
+ dl_type_x = cxxSurface::NO_DL;
255
+ if (use.Get_surface_in() == TRUE)
256
+ {
257
+ use.Set_surface_ptr(Utilities::Rxn_find(Rxn_surface_map, use.Get_n_surface_user()));
258
+ if (use.Get_surface_ptr() == NULL)
259
+ {
260
+ error_string = sformatf( "Surface %d not found.",
261
+ use.Get_n_surface_user());
262
+ error_msg(error_string, STOP);
263
+ }
264
+ }
265
+ else
266
+ {
267
+ use.Set_surface_ptr(NULL);
268
+ }
269
+ /*
270
+ * Find temperature
271
+ */
272
+ if (use.Get_temperature_in() == TRUE)
273
+ {
274
+ use.Set_temperature_ptr(Utilities::Rxn_find(Rxn_temperature_map, use.Get_n_temperature_user()));
275
+ if (use.Get_temperature_ptr() == NULL)
276
+ {
277
+ error_string = sformatf( "Temperature %d not found.",
278
+ use.Get_n_temperature_user());
279
+ error_msg(error_string, STOP);
280
+ }
281
+ }
282
+ else
283
+ {
284
+ use.Set_temperature_ptr(NULL);
285
+ }
286
+ /*
287
+ * Find pressure
288
+ */
289
+ if (use.Get_pressure_in() == TRUE)
290
+ {
291
+ use.Set_pressure_ptr(Utilities::Rxn_find(Rxn_pressure_map, use.Get_n_pressure_user()));
292
+ if (use.Get_pressure_ptr() == NULL)
293
+ {
294
+ error_string = sformatf( "Pressure %d not found.", use.Get_n_pressure_user());
295
+ error_msg(error_string, STOP);
296
+ }
297
+ }
298
+ else
299
+ {
300
+ use.Set_pressure_ptr(NULL);
301
+ }
302
+ /*
303
+ * Find gas
304
+ */
305
+ if (use.Get_gas_phase_in() == TRUE)
306
+ {
307
+ use.Set_gas_phase_ptr(Utilities::Rxn_find(Rxn_gas_phase_map, use.Get_n_gas_phase_user()));
308
+ if (use.Get_gas_phase_ptr() == NULL)
309
+ {
310
+ error_string = sformatf( "Gas_phase %d not found.",
311
+ use.Get_n_gas_phase_user());
312
+ error_msg(error_string, STOP);
313
+ }
314
+ }
315
+ else
316
+ {
317
+ use.Set_gas_phase_ptr(NULL);
318
+ }
319
+ /*
320
+ * Find ss_assemblage
321
+ */
322
+ if (use.Get_ss_assemblage_in() == TRUE)
323
+ {
324
+ use.Set_ss_assemblage_ptr(Utilities::Rxn_find(Rxn_ss_assemblage_map, use.Get_n_ss_assemblage_user()));
325
+ if (use.Get_ss_assemblage_ptr() == NULL)
326
+ {
327
+ error_string = sformatf( "ss_assemblage %d not found.",
328
+ use.Get_n_ss_assemblage_user());
329
+ error_msg(error_string, STOP);
330
+ }
331
+ }
332
+ else
333
+ {
334
+ use.Set_ss_assemblage_ptr(NULL);
335
+ }
336
+ /*
337
+ if (use.irrev_ptr != NULL && use.Get_kinetics_ptr() != NULL)
338
+ {
339
+ warning_msg("Should not use REACTION in same simulation with KINETICS.");
340
+ }
341
+ */
342
+ return (OK);
343
+ }
344
+ /* ---------------------------------------------------------------------- */
345
+ int Phreeqc::
346
+ initial_solutions(int print)
347
+ /* ---------------------------------------------------------------------- */
348
+ {
349
+ /*
350
+ * Go through list of solutions, make initial solution calculations
351
+ * for any marked "new".
352
+ */
353
+ int converge, converge1;
354
+ int last, n_user, print1;
355
+ char token[2 * MAX_LENGTH];
356
+
357
+ state = INITIAL_SOLUTION;
358
+ set_use();
359
+ print1 = TRUE;
360
+ dl_type_x = cxxSurface::NO_DL;
361
+ //std::map<int, cxxSolution>::iterator it = Rxn_solution_map.begin();
362
+ //for ( ; it != Rxn_solution_map.end(); it++)
363
+ //{
364
+ //for (size_t nn = 0; nn < Rxn_new_solution.size(); nn++)
365
+ for (std::set<int>::const_iterator nit = Rxn_new_solution.begin(); nit != Rxn_new_solution.end(); nit++)
366
+ {
367
+ std::map<int, cxxSolution>::iterator it = Rxn_solution_map.find(*nit);
368
+ if (it == Rxn_solution_map.end())
369
+ {
370
+ assert(false);
371
+ }
372
+ cxxSolution &solution_ref = it->second;
373
+ initial_solution_isotopes = FALSE;
374
+ if (solution_ref.Get_new_def())
375
+ {
376
+ if (print1 == TRUE && print == TRUE)
377
+ {
378
+ dup_print("Beginning of initial solution calculations.",
379
+ TRUE);
380
+ print1 = FALSE;
381
+ }
382
+ if (print == TRUE)
383
+ {
384
+ snprintf(token, sizeof(token), "Initial solution %d.\t%.350s",
385
+ solution_ref.Get_n_user(), solution_ref.Get_description().c_str());
386
+ dup_print(token, FALSE);
387
+ }
388
+ use.Set_solution_ptr(&solution_ref);
389
+ LDBLE d0 = solution_ref.Get_density();
390
+ //LDBLE d1 = 0;
391
+ bool diag = (diagonal_scale == TRUE) ? true : false;
392
+ int count_iterations = 0;
393
+ std::string input_units = solution_ref.Get_initial_data()->Get_units();
394
+ cxxISolution *initial_data_ptr = solution_ref.Get_initial_data();
395
+ density_iterations = 0;
396
+ for (;;)
397
+ {
398
+ prep();
399
+ k_temp(solution_ref.Get_tc(), solution_ref.Get_patm());
400
+ set(TRUE);
401
+ always_full_pitzer = FALSE;
402
+
403
+ diagonal_scale = TRUE;
404
+ converge = model();
405
+ if (converge == ERROR /*&& diagonal_scale == FALSE*/)
406
+ {
407
+ diagonal_scale = TRUE;
408
+ always_full_pitzer = TRUE;
409
+ set(TRUE);
410
+ converge = model();
411
+ }
412
+ calc_dens();
413
+ kgw_kgs = mass_water_aq_x / solution_mass_x;
414
+ density_iterations++;
415
+ if (solution_ref.Get_initial_data()->Get_calc_density())
416
+ {
417
+ solution_ref.Set_density(calc_dens());
418
+ if (!equal(d0, solution_ref.Get_density(), 1e-8))
419
+ {
420
+ initial_data_ptr->Set_units(input_units);
421
+ d0 = solution_ref.Get_density();
422
+ if (count_iterations++ < 20)
423
+ {
424
+ diag = (diagonal_scale == TRUE) ? true : false;
425
+ continue;
426
+ }
427
+ else
428
+ {
429
+ error_msg(sformatf("%s %d.", "Density calculation failed for initial solution ", solution_ref.Get_n_user()),
430
+ STOP);
431
+ }
432
+ }
433
+ }
434
+ break;
435
+ }
436
+ diagonal_scale = (diag) ? TRUE : FALSE;
437
+ converge1 = check_residuals();
438
+ sum_species();
439
+ viscos = viscosity(NULL);
440
+ use.Get_solution_ptr()->Set_viscosity(viscos);
441
+ use.Get_solution_ptr()->Set_viscos_0(viscos_0);
442
+ if (use.Get_surface_ptr() != NULL && dl_type_x != cxxSurface::NO_DL)
443
+ use.Get_surface_ptr()->Set_DDL_viscosity(viscosity(use.Get_surface_ptr()));
444
+ add_isotopes(solution_ref);
445
+ punch_all();
446
+ print_all();
447
+ density_iterations = 0;
448
+ /* free_model_allocs(); */
449
+ // remove pr_in
450
+ for (size_t i = 0; i < count_unknowns; i++)
451
+ {
452
+ if (x[i]->type == SOLUTION_PHASE_BOUNDARY)
453
+ x[i]->phase->pr_in = false;
454
+ }
455
+
456
+ if (converge == ERROR || converge1 == ERROR)
457
+ {
458
+ error_msg(sformatf("%s %d.", "Model failed to converge for initial solution ", solution_ref.Get_n_user()),
459
+ STOP);
460
+ }
461
+ n_user = solution_ref.Get_n_user();
462
+ last = solution_ref.Get_n_user_end();
463
+ /* copy isotope data */
464
+ if (solution_ref.Get_isotopes().size() > 0)
465
+ {
466
+ isotopes_x = solution_ref.Get_isotopes();
467
+ }
468
+ else
469
+ {
470
+ isotopes_x.clear();
471
+ }
472
+ xsolution_save(n_user);
473
+ Utilities::Rxn_copies(Rxn_solution_map, n_user, last);
474
+ }
475
+ }
476
+ initial_solution_isotopes = FALSE;
477
+ return (OK);
478
+ }
479
+ /* ---------------------------------------------------------------------- */
480
+ int Phreeqc::
481
+ initial_exchangers(int print)
482
+ /* ---------------------------------------------------------------------- */
483
+ {
484
+ /*
485
+ * Go through list of exchangers, make initial calculations
486
+ * for any marked "new" that are defined to be in equilibrium with a
487
+ * solution.
488
+ */
489
+ int i, converge, converge1;
490
+ int last, n_user, print1;
491
+ char token[2 * MAX_LENGTH];
492
+
493
+ state = INITIAL_EXCHANGE;
494
+ set_use();
495
+ print1 = TRUE;
496
+ dl_type_x = cxxSurface::NO_DL;
497
+ //std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.begin();
498
+ //for ( ; it != Rxn_exchange_map.end(); it++)
499
+ //{
500
+ //for (size_t nn = 0; nn < Rxn_new_exchange.size(); nn++)
501
+ //{
502
+ //std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.find(Rxn_new_exchange[nn]);
503
+ for (std::set<int>::const_iterator nit = Rxn_new_exchange.begin(); nit != Rxn_new_exchange.end(); nit++)
504
+ {
505
+ std::map<int, cxxExchange>::iterator it = Rxn_exchange_map.find(*nit);
506
+ if (it == Rxn_exchange_map.end())
507
+ {
508
+ assert(false);
509
+ }
510
+ if (!it->second.Get_new_def())
511
+ continue;
512
+ cxxExchange *exchange_ptr = &(it->second);
513
+ n_user = exchange_ptr->Get_n_user();
514
+ last = exchange_ptr->Get_n_user_end();
515
+ exchange_ptr->Set_n_user_end(n_user);
516
+ exchange_ptr->Set_new_def(false);
517
+ if (exchange_ptr->Get_solution_equilibria())
518
+ {
519
+ if (print1 == TRUE && print == TRUE)
520
+ {
521
+ dup_print("Beginning of initial exchange"
522
+ "-composition calculations.", TRUE);
523
+ print1 = FALSE;
524
+ }
525
+ if (print == TRUE)
526
+ {
527
+ snprintf(token, sizeof(token), "Exchange %d.\t%.350s",
528
+ exchange_ptr->Get_n_user(), exchange_ptr->Get_description().c_str());
529
+ dup_print(token, FALSE);
530
+ }
531
+ use.Set_exchange_ptr(exchange_ptr);
532
+ use.Set_solution_ptr(Utilities::Rxn_find(Rxn_solution_map, exchange_ptr->Get_n_solution()));
533
+ if (use.Get_solution_ptr() == NULL)
534
+ {
535
+ error_msg
536
+ ("Solution not found for initial exchange calculation",
537
+ STOP);
538
+ }
539
+
540
+ prep();
541
+ k_temp(use.Get_solution_ptr()->Get_tc(), use.Get_solution_ptr()->Get_patm());
542
+ set(TRUE);
543
+ converge = model();
544
+ converge1 = check_residuals();
545
+ sum_species();
546
+ species_list_sort();
547
+ print_exchange();
548
+ if (pr.user_print)
549
+ print_user_print();
550
+ xexchange_save(n_user);
551
+ punch_all();
552
+ /* free_model_allocs(); */
553
+ if (converge == ERROR || converge1 == ERROR)
554
+ {
555
+ error_msg
556
+ ("Model failed to converge for initial exchange calculation.",
557
+ STOP);
558
+ }
559
+ }
560
+ for (i = n_user + 1; i <= last; i++)
561
+ {
562
+ Utilities::Rxn_copy(Rxn_exchange_map, n_user, i);
563
+ }
564
+ }
565
+ return (OK);
566
+ }
567
+ /* ---------------------------------------------------------------------- */
568
+ int Phreeqc::
569
+ initial_gas_phases(int print)
570
+ /* ---------------------------------------------------------------------- */
571
+ {
572
+ /*
573
+ * Go through list of gas_phases, make initial calculations
574
+ * for any marked "new" that are defined to be in equilibrium with a
575
+ * solution.
576
+ */
577
+ int converge, converge1;
578
+ int last, n_user, print1;
579
+ char token[2 * MAX_LENGTH];
580
+ class phase *phase_ptr;
581
+ class rxn_token *rxn_ptr;
582
+ LDBLE lp;
583
+ bool PR = false;
584
+
585
+ state = INITIAL_GAS_PHASE;
586
+ set_use();
587
+ print1 = TRUE;
588
+ dl_type_x = cxxSurface::NO_DL;
589
+ //std::map<int, cxxGasPhase>::iterator it = Rxn_gas_phase_map.begin();
590
+ //for ( ; it != Rxn_gas_phase_map.end(); it++)
591
+ //{
592
+ //for (size_t nn = 0; nn < Rxn_new_gas_phase.size(); nn++)
593
+ //{
594
+ //std::map<int, cxxGasPhase>::iterator it = Rxn_gas_phase_map.find(Rxn_new_gas_phase[nn]);
595
+ for (std::set<int>::const_iterator nit = Rxn_new_gas_phase.begin(); nit != Rxn_new_gas_phase.end(); nit++)
596
+ {
597
+ std::map<int, cxxGasPhase>::iterator it = Rxn_gas_phase_map.find(*nit);
598
+ if (it == Rxn_gas_phase_map.end())
599
+ {
600
+ assert(false);
601
+ }
602
+ cxxGasPhase *gas_phase_ptr = &it->second;
603
+ if (!gas_phase_ptr->Get_new_def())
604
+ continue;
605
+ n_user = gas_phase_ptr->Get_n_user();
606
+ last = gas_phase_ptr->Get_n_user_end();
607
+ gas_phase_ptr->Set_n_user_end(n_user);
608
+ gas_phase_ptr->Set_new_def(false);
609
+ if (gas_phase_ptr->Get_solution_equilibria())
610
+ {
611
+ if (print1 == TRUE && print == TRUE)
612
+ {
613
+ dup_print("Beginning of initial gas_phase"
614
+ "-composition calculations.", TRUE);
615
+ print1 = FALSE;
616
+ }
617
+ if (print == TRUE)
618
+ {
619
+ snprintf(token, sizeof(token), "Gas_Phase %d.\t%.350s",
620
+ gas_phase_ptr->Get_n_user(), gas_phase_ptr->Get_description().c_str());
621
+ dup_print(token, FALSE);
622
+ }
623
+
624
+ /* Try to obtain a solution pointer */
625
+ use.Set_solution_ptr(Utilities::Rxn_find(Rxn_solution_map, gas_phase_ptr->Get_n_solution()));
626
+ prep();
627
+ k_temp(use.Get_solution_ptr()->Get_tc(), use.Get_solution_ptr()->Get_patm());
628
+ set(TRUE);
629
+ converge = model();
630
+ converge1 = check_residuals();
631
+ if (converge == ERROR || converge1 == ERROR)
632
+ {
633
+ /* free_model_allocs(); */
634
+ error_msg
635
+ ("Model failed to converge for initial gas phase calculation.",
636
+ STOP);
637
+ }
638
+ use.Set_gas_phase_ptr(gas_phase_ptr);
639
+ gas_phase_ptr->Set_total_p(0);
640
+ gas_phase_ptr->Set_total_moles(0);
641
+ for (size_t i = 0; i < gas_phase_ptr->Get_gas_comps().size(); i++)
642
+ {
643
+ cxxGasComp * gc_ptr = &(gas_phase_ptr->Get_gas_comps()[i]);
644
+ int k;
645
+ phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE);
646
+ if (phase_ptr->in == TRUE)
647
+ {
648
+ lp = -phase_ptr->lk;
649
+ for (rxn_ptr = &phase_ptr->rxn_x.token[0] + 1;
650
+ rxn_ptr->s != NULL; rxn_ptr++)
651
+ {
652
+ lp += rxn_ptr->s->la * rxn_ptr->coef;
653
+ }
654
+ phase_ptr->p_soln_x = exp(lp * LOG_10);
655
+ gas_phase_ptr->Set_total_p(gas_phase_ptr->Get_total_p() + phase_ptr->p_soln_x);
656
+ phase_ptr->moles_x = phase_ptr->p_soln_x *
657
+ gas_phase_ptr->Get_volume() / (R_LITER_ATM * tk_x);
658
+ gc_ptr->Set_moles(phase_ptr->moles_x);
659
+ gas_phase_ptr->Set_total_moles(gas_phase_ptr->Get_total_moles() + phase_ptr->moles_x);
660
+ if (phase_ptr->p_c || phase_ptr->t_c)
661
+ PR = true;
662
+ }
663
+ else
664
+ {
665
+ phase_ptr->moles_x = 0;
666
+ }
667
+ }
668
+ if (fabs(gas_phase_ptr->Get_total_p() - use.Get_solution_ptr()->Get_patm()) > 5)
669
+ {
670
+ snprintf(token, sizeof(token),
671
+ "WARNING: While initializing gas phase composition by equilibrating:\n%s (%.2f atm) %s (%.2f atm).\n%s.",
672
+ " Gas phase pressure",
673
+ (double) gas_phase_ptr->Get_total_p(),
674
+ "is not equal to solution-pressure",
675
+ (double) use.Get_solution_ptr()->Get_patm(),
676
+ " Pressure effects on solubility may be incorrect");
677
+ dup_print(token, FALSE);
678
+ }
679
+
680
+ print_gas_phase();
681
+ if (pr.user_print)
682
+ print_user_print();
683
+ if (PR /*&& use.Get_gas_phase_ptr()->total_p > 1.0*/)
684
+ {
685
+ std::ostringstream msg;
686
+ msg << "\nWhile initializing gas phase composition by equilibrating:\n";
687
+ msg << " Found definitions of gas critical temperature and pressure.\n";
688
+ msg << " Going to use Peng-Robinson in subsequent calculations.\n";
689
+ screen_msg(msg.str().c_str());
690
+ output_msg(msg.str().c_str());
691
+ log_msg(msg.str().c_str());
692
+ }
693
+ xgas_save(n_user);
694
+ punch_all();
695
+ /* free_model_allocs(); */
696
+ }
697
+ Utilities::Rxn_copies(Rxn_gas_phase_map, n_user, last);
698
+ }
699
+ return (OK);
700
+ }
701
+ /* ---------------------------------------------------------------------- */
702
+ int Phreeqc::
703
+ initial_surfaces(int print)
704
+ /* ---------------------------------------------------------------------- */
705
+ {
706
+ /*
707
+ * Go through list of surfaces, make initial calculations
708
+ * for any marked "new" that are defined to be in equilibrium with a
709
+ * solution.
710
+ */
711
+ int last, n_user, print1;
712
+
713
+ state = INITIAL_SURFACE;
714
+ set_use();
715
+ print1 = TRUE;
716
+
717
+ //std::map<int, cxxSurface>::iterator it = Rxn_surface_map.begin();
718
+ //for ( ; it != Rxn_surface_map.end(); it++)
719
+ //{
720
+ //for (size_t nn = 0; nn < Rxn_new_surface.size(); nn++)
721
+ //{
722
+ //std::map<int, cxxSurface>::iterator it = Rxn_surface_map.find(Rxn_new_surface[nn]);
723
+ for (std::set<int>::const_iterator nit = Rxn_new_surface.begin(); nit != Rxn_new_surface.end(); nit++)
724
+ {
725
+ std::map<int, cxxSurface>::iterator it = Rxn_surface_map.find(*nit);
726
+ if (it == Rxn_surface_map.end())
727
+ {
728
+ assert(false);
729
+ }
730
+ cxxSurface * surface_ptr = &it->second;
731
+ if (!surface_ptr->Get_new_def())
732
+ continue;
733
+ n_user = surface_ptr->Get_n_user();
734
+ last = surface_ptr->Get_n_user_end();
735
+ surface_ptr->Set_n_user_end(n_user);
736
+ if (surface_ptr->Get_solution_equilibria())
737
+ {
738
+ if (print1 == TRUE && print == TRUE)
739
+ {
740
+ dup_print
741
+ ("Beginning of initial surface-composition calculations.",
742
+ TRUE);
743
+ print1 = FALSE;
744
+ }
745
+ if (print == TRUE)
746
+ {
747
+ std::ostringstream msg;
748
+ msg << "Surface " << n_user << ".\t" << surface_ptr->Get_description().c_str();
749
+ dup_print(msg.str().c_str(), FALSE);
750
+ }
751
+ use.Set_surface_ptr(surface_ptr);
752
+ dl_type_x = use.Get_surface_ptr()->Get_dl_type();
753
+ use.Set_solution_ptr(Utilities::Rxn_find(Rxn_solution_map, surface_ptr->Get_n_solution()));
754
+ if (use.Get_solution_ptr() == NULL)
755
+ {
756
+ error_msg
757
+ ("Solution not found for initial surface calculation",
758
+ STOP);
759
+ }
760
+ set_and_run_wrapper(-1, FALSE, FALSE, -1, 0.0);
761
+ species_list_sort();
762
+ print_surface();
763
+ if (pr.user_print)
764
+ print_user_print();
765
+ punch_all();
766
+ xsurface_save(n_user);
767
+ /* free_model_allocs(); */
768
+ }
769
+ Utilities::Rxn_copies(Rxn_surface_map, n_user, last);
770
+ }
771
+ return (OK);
772
+ }
773
+ /* ---------------------------------------------------------------------- */
774
+ int Phreeqc::
775
+ reactions(void)
776
+ /* ---------------------------------------------------------------------- */
777
+ {
778
+ /*
779
+ * Make all reaction calculation which could include:
780
+ * equilibrium with a pure-phase assemblage,
781
+ * equilibrium with an exchanger,
782
+ * equilibrium with an surface,
783
+ * equilibrium with a gas phase,
784
+ * equilibrium with a solid solution assemblage,
785
+ * kinetics,
786
+ * change of temperature,
787
+ * mixture,
788
+ * or irreversible reaction.
789
+ */
790
+ int count_steps, use_mix;
791
+ char token[2 * MAX_LENGTH];
792
+ class save save_data;
793
+ LDBLE kin_time;
794
+ cxxKinetics *kinetics_ptr;
795
+
796
+ state = REACTION;
797
+ /* last_model.force_prep = TRUE; */
798
+ if (set_use() == FALSE)
799
+ return (OK);
800
+ /*
801
+ * Find maximum number of steps
802
+ */
803
+ dup_print("Beginning of batch-reaction calculations.", TRUE);
804
+ count_steps = 1;
805
+ if (use.Get_reaction_in() == TRUE && use.Get_reaction_ptr() != NULL)
806
+ {
807
+ cxxReaction *reaction_ptr = use.Get_reaction_ptr();
808
+ if (reaction_ptr->Get_reaction_steps() > count_steps)
809
+ count_steps = reaction_ptr->Get_reaction_steps();
810
+ }
811
+ if (use.Get_kinetics_in() == TRUE && use.Get_kinetics_ptr() != NULL)
812
+ {
813
+ if (use.Get_kinetics_ptr()->Get_reaction_steps() > count_steps)
814
+ count_steps = use.Get_kinetics_ptr()->Get_reaction_steps();
815
+ }
816
+ if (use.Get_temperature_in() == TRUE && use.Get_temperature_ptr() != NULL)
817
+ {
818
+ int count = use.Get_temperature_ptr()->Get_countTemps();
819
+ if (count > count_steps)
820
+ {
821
+ count_steps = count;
822
+ }
823
+ }
824
+ if (use.Get_pressure_in() == TRUE && use.Get_pressure_ptr() != NULL)
825
+ {
826
+ int count = use.Get_pressure_ptr()->Get_count();
827
+ if (count > count_steps)
828
+ {
829
+ count_steps = count;
830
+ }
831
+ }
832
+ count_total_steps = count_steps;
833
+ /*
834
+ * save data for saving solutions
835
+ */
836
+ // memcpy(&save_data, &save, sizeof(class save));
837
+ save_data = save;
838
+ /*
839
+ *Copy everything to -2
840
+ */
841
+ copy_use(-2);
842
+ rate_sim_time_start = 0;
843
+ rate_sim_time = 0;
844
+ for (reaction_step = 1; reaction_step <= count_steps; reaction_step++)
845
+ {
846
+ overall_iterations = 0;
847
+ snprintf(token, sizeof(token), "Reaction step %d.", reaction_step);
848
+ if (reaction_step > 1 && incremental_reactions == FALSE)
849
+ {
850
+ copy_use(-2);
851
+ }
852
+ set_initial_moles(-2);
853
+ dup_print(token, FALSE);
854
+ /*
855
+ * Determine time step for kinetics
856
+ */
857
+ kin_time = 0.0;
858
+
859
+ if (use.Get_kinetics_in() == TRUE)
860
+ {
861
+ kinetics_ptr = Utilities::Rxn_find(Rxn_kinetics_map, -2);
862
+ kin_time = kinetics_ptr->Current_step((incremental_reactions==TRUE), reaction_step);
863
+ }
864
+ if (incremental_reactions == FALSE ||
865
+ (incremental_reactions == TRUE && reaction_step == 1))
866
+ {
867
+ use_mix = TRUE;
868
+ }
869
+ else
870
+ {
871
+ use_mix = FALSE;
872
+ }
873
+ /*
874
+ * Run reaction step
875
+ */
876
+ run_reactions(-2, kin_time, use_mix, 1.0);
877
+ if (incremental_reactions == TRUE)
878
+ {
879
+ rate_sim_time_start += kin_time;
880
+ rate_sim_time = rate_sim_time_start;
881
+ }
882
+ else
883
+ {
884
+ rate_sim_time = kin_time;
885
+ }
886
+ if (state != ADVECTION)
887
+ {
888
+ punch_all();
889
+ print_all();
890
+ }
891
+ /* saves back into -2 */
892
+ if (reaction_step < count_steps)
893
+ {
894
+ saver();
895
+ }
896
+ }
897
+ /*
898
+ * save end of reaction
899
+ */
900
+ // memcpy(&save, &save_data, sizeof(class save));
901
+ save = save_data;
902
+ if (use.Get_kinetics_in() == TRUE)
903
+ {
904
+ Utilities::Rxn_copy(Rxn_kinetics_map, -2, use.Get_n_kinetics_user());
905
+ }
906
+ saver();
907
+
908
+ /* free_model_allocs(); */
909
+ //// set pr_in to false for following steps...
910
+ // if (use.Get_pp_assemblage_in())
911
+ // {
912
+ // for (int i = 0; i < count_unknowns; i++)
913
+ // {
914
+ // if (x[i]->type == PP)
915
+ // x[i]->phase->pr_in = false;
916
+ // }
917
+ // }
918
+ // if (use.Get_gas_phase_in())
919
+ // {
920
+ // cxxGasPhase *gas_phase_ptr = use.Get_gas_phase_ptr();
921
+ // for (size_t i = 0; i < gas_phase_ptr->Get_gas_comps().size(); i++)
922
+ // {
923
+ // cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[i]);
924
+ // int k;
925
+ // class phase *phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE);
926
+ // assert(phase_ptr);
927
+ // phase_ptr->pr_in = false;
928
+ // }
929
+ // }
930
+ /* last_model.force_prep = TRUE; */
931
+ rate_sim_time = 0;
932
+ return (OK);
933
+ }
934
+
935
+ /* ---------------------------------------------------------------------- */
936
+ int Phreeqc::
937
+ saver(void)
938
+ /* ---------------------------------------------------------------------- */
939
+ {
940
+ /*
941
+ * Save results of calculations (data in variables with _x,
942
+ * in unknown structure x, in master, or s) into structure
943
+ * arrays. Structure "save" has info on whether to save
944
+ * data for each entity (solution, ex, surf, pp, gas, or s_s).
945
+ * Initial calculation may be saved into multiple "n_user"
946
+ * slots.
947
+ */
948
+ int i, n;
949
+ char token[MAX_LENGTH];
950
+
951
+ if (save.solution == TRUE)
952
+ {
953
+ snprintf(token, sizeof(token), "Solution after simulation %d.", simulation);
954
+ description_x = token;
955
+ n = save.n_solution_user;
956
+ xsolution_save(n);
957
+ for (i = save.n_solution_user + 1; i <= save.n_solution_user_end; i++)
958
+ {
959
+ Utilities::Rxn_copy(Rxn_solution_map, n, i);
960
+ }
961
+ }
962
+ if (save.pp_assemblage == TRUE)
963
+ {
964
+ n = save.n_pp_assemblage_user;
965
+ xpp_assemblage_save(n);
966
+ Utilities::Rxn_copies(Rxn_pp_assemblage_map, save.n_pp_assemblage_user, save.n_pp_assemblage_user_end);
967
+ }
968
+ if (save.exchange == TRUE)
969
+ {
970
+ n = save.n_exchange_user;
971
+ xexchange_save(n);
972
+ for (i = save.n_exchange_user + 1; i <= save.n_exchange_user_end; i++)
973
+ {
974
+ Utilities::Rxn_copy(Rxn_exchange_map, n, i);
975
+ }
976
+ }
977
+ if (save.surface == TRUE)
978
+ {
979
+ n = save.n_surface_user;
980
+ xsurface_save(n);
981
+ Utilities::Rxn_copies(Rxn_surface_map, n, save.n_surface_user_end);
982
+ }
983
+ if (save.gas_phase == TRUE)
984
+ {
985
+ n = save.n_gas_phase_user;
986
+ xgas_save(n);
987
+ for (i = save.n_gas_phase_user + 1; i <= save.n_gas_phase_user_end;
988
+ i++)
989
+ {
990
+ Utilities::Rxn_copy(Rxn_gas_phase_map, n, i);
991
+ }
992
+ }
993
+ if (save.ss_assemblage == TRUE)
994
+ {
995
+ n = save.n_ss_assemblage_user;
996
+ xss_assemblage_save(n);
997
+ Utilities::Rxn_copies(Rxn_ss_assemblage_map, save.n_ss_assemblage_user, save.n_ss_assemblage_user_end);
998
+ }
999
+ if (save.kinetics == TRUE && use.Get_kinetics_in() == TRUE
1000
+ /*&& use.Get_kinetics_ptr() != NULL */)
1001
+ {
1002
+ if (state == TRANSPORT || state == PHAST || state == ADVECTION)
1003
+ {
1004
+ use.Set_kinetics_ptr(Utilities::Rxn_find(Rxn_kinetics_map, use.Get_n_kinetics_user()));
1005
+ }
1006
+ else if (use.Get_kinetics_in() != FALSE)
1007
+ {
1008
+ use.Set_kinetics_ptr(Utilities::Rxn_find(Rxn_kinetics_map, -2));
1009
+ }
1010
+ if (use.Get_kinetics_ptr() != NULL)
1011
+ {
1012
+ n = use.Get_kinetics_ptr()->Get_n_user();
1013
+ for (i = save.n_kinetics_user; i <= save.n_kinetics_user_end; i++)
1014
+ {
1015
+ Utilities::Rxn_copy(Rxn_kinetics_map, n, i);
1016
+ }
1017
+ }
1018
+ }
1019
+ return (OK);
1020
+ }
1021
+ /* ---------------------------------------------------------------------- */
1022
+ int Phreeqc::
1023
+ xexchange_save(int n_user)
1024
+ /* ---------------------------------------------------------------------- */
1025
+ {
1026
+ /*
1027
+ * Save exchanger assemblage into structure exchange with user
1028
+ * number n_user.
1029
+ */
1030
+ size_t i, j;
1031
+ char token[MAX_LENGTH];
1032
+
1033
+ LDBLE charge;
1034
+ if (use.Get_exchange_ptr() == NULL)
1035
+ return (OK);
1036
+
1037
+ cxxExchange temp_exchange = *use.Get_exchange_ptr();
1038
+ /*
1039
+ * Store data for structure exchange
1040
+ */
1041
+ temp_exchange.Set_n_user(n_user);
1042
+ temp_exchange.Set_n_user_end(n_user);
1043
+ temp_exchange.Set_new_def(false);
1044
+ snprintf(token, sizeof(token), "Exchange assemblage after simulation %d.", simulation);
1045
+ temp_exchange.Set_description(token);
1046
+ temp_exchange.Set_solution_equilibria(false);
1047
+ temp_exchange.Set_n_solution(-999);
1048
+ temp_exchange.Get_exchange_comps().clear();
1049
+
1050
+ /*
1051
+ * Write exch_comp structure for each exchange component
1052
+ */
1053
+ for (i = 0; i < count_unknowns; i++)
1054
+ {
1055
+ if (x[i]->type == EXCH)
1056
+ {
1057
+ const cxxExchComp *comp_ptr = use.Get_exchange_ptr()->Find_comp(x[i]->exch_comp);
1058
+ if (!comp_ptr)
1059
+ {
1060
+ assert(false);
1061
+ }
1062
+ cxxExchComp xcomp = *comp_ptr;
1063
+ xcomp.Set_la(x[i]->master[0]->s->la);
1064
+ /*
1065
+ * Save element concentrations on exchanger
1066
+ */
1067
+ count_elts = 0;
1068
+ paren_count = 0;
1069
+ charge = 0.0;
1070
+ for (j = 0; j < species_list.size(); j++)
1071
+ {
1072
+ if (species_list[j].master_s == x[i]->master[0]->s)
1073
+ {
1074
+ add_elt_list(species_list[j].s->next_elt,
1075
+ species_list[j].s->moles);
1076
+ charge += species_list[j].s->moles * species_list[j].s->z;
1077
+ }
1078
+ }
1079
+ /*
1080
+ * Keep exchanger related to phase even if none currently in solution
1081
+ */
1082
+ if (xcomp.Get_phase_name().size() != 0 && count_elts == 0)
1083
+ {
1084
+ add_elt_list(x[i]->master[0]->s->next_elt, 1e-20);
1085
+ }
1086
+ /*
1087
+ * Store list
1088
+ */
1089
+ xcomp.Set_charge_balance(charge);
1090
+
1091
+ xcomp.Set_totals(elt_list_NameDouble());
1092
+ /* debug
1093
+ output_msg(sformatf( "Exchange charge_balance: %e\n", charge));
1094
+ */
1095
+ /* update unknown pointer */
1096
+ temp_exchange.Get_exchange_comps().push_back(xcomp);
1097
+ }
1098
+ }
1099
+ /*
1100
+ * Finish up
1101
+ */
1102
+ Rxn_exchange_map[n_user] = temp_exchange;
1103
+
1104
+ use.Set_exchange_ptr(NULL);
1105
+ return (OK);
1106
+ }
1107
+ /* ---------------------------------------------------------------------- */
1108
+ int Phreeqc::
1109
+ xgas_save(int n_user)
1110
+ /* ---------------------------------------------------------------------- */
1111
+ {
1112
+ /*
1113
+ * Save gas composition into structure gas_phase with user
1114
+ * number n_user.
1115
+ */
1116
+ char token[MAX_LENGTH];
1117
+
1118
+ if (use.Get_gas_phase_ptr() == NULL)
1119
+ return (OK);
1120
+ cxxGasPhase* gas_phase_ptr = use.Get_gas_phase_ptr();
1121
+ cxxGasPhase temp_gas_phase(*gas_phase_ptr);
1122
+ /*
1123
+ * Store in gas_phase
1124
+ */
1125
+ temp_gas_phase.Set_n_user(n_user);
1126
+ temp_gas_phase.Set_n_user_end(n_user);
1127
+ snprintf(token, sizeof(token), "Gas phase after simulation %d.", simulation);
1128
+ temp_gas_phase.Set_description(token);
1129
+ temp_gas_phase.Set_new_def(false);
1130
+ temp_gas_phase.Set_solution_equilibria(false);
1131
+ temp_gas_phase.Set_n_solution(-99);
1132
+ /*
1133
+ * Update amounts
1134
+ */
1135
+ bool PR = false;
1136
+ if (gas_phase_ptr->Get_v_m() >= 0.01) PR = true;
1137
+ for (size_t i = 0; i < temp_gas_phase.Get_gas_comps().size(); i++)
1138
+ {
1139
+ cxxGasComp* gc_ptr = &(temp_gas_phase.Get_gas_comps()[i]);
1140
+ int k;
1141
+ class phase* phase_ptr = phase_bsearch(gc_ptr->Get_phase_name().c_str(), &k, FALSE);
1142
+ assert(phase_ptr);
1143
+ if (PR)
1144
+ {
1145
+ gc_ptr->Set_moles(phase_ptr->moles_x);
1146
+ gc_ptr->Set_p(phase_ptr->p_soln_x);
1147
+ gc_ptr->Set_phi(phase_ptr->pr_phi);
1148
+ gc_ptr->Set_f(phase_ptr->p_soln_x * phase_ptr->pr_phi);
1149
+ }
1150
+ else
1151
+ {
1152
+ gc_ptr->Set_moles(phase_ptr->moles_x);
1153
+ gc_ptr->Set_p(phase_ptr->p_soln_x);
1154
+ gc_ptr->Set_phi(1.0);
1155
+ gc_ptr->Set_f(phase_ptr->p_soln_x);
1156
+ }
1157
+ }
1158
+ Rxn_gas_phase_map[n_user] = temp_gas_phase;
1159
+
1160
+ use.Set_gas_phase_ptr(NULL);
1161
+ return (OK);
1162
+ }
1163
+
1164
+ /* ---------------------------------------------------------------------- */
1165
+ int Phreeqc::
1166
+ xss_assemblage_save(int n_user)
1167
+ /* ---------------------------------------------------------------------- */
1168
+ {
1169
+ /*
1170
+ * Save ss_assemblage composition into structure ss_assemblage with user
1171
+ * number n_user.
1172
+ */
1173
+ cxxSSassemblage temp_ss_assemblage(this->phrq_io);
1174
+
1175
+ if (use.Get_ss_assemblage_ptr() == NULL)
1176
+ return (OK);
1177
+ /*
1178
+ * Set ss_assemblage
1179
+ */
1180
+ temp_ss_assemblage.Set_n_user(n_user);
1181
+ temp_ss_assemblage.Set_n_user_end(n_user);
1182
+ std::ostringstream msg;
1183
+ msg << "Solid solution assemblage after simulation " << simulation;
1184
+ temp_ss_assemblage.Set_description(msg.str().c_str());
1185
+ temp_ss_assemblage.Set_new_def(false);
1186
+ temp_ss_assemblage.Set_SSs(use.Get_ss_assemblage_ptr()->Get_SSs());
1187
+
1188
+ std::vector<cxxSS *> ss_ptrs = temp_ss_assemblage.Vectorize();
1189
+ for (size_t i = 0; i < ss_ptrs.size(); i++)
1190
+ {
1191
+ cxxSS *ss_ptr = ss_ptrs[i];
1192
+ /* set initial moles for quick setup */
1193
+ for (size_t j = 0; j < ss_ptr->Get_ss_comps().size(); j++)
1194
+ {
1195
+ cxxSScomp *comp_ptr = &(ss_ptr->Get_ss_comps()[j]);
1196
+ comp_ptr->Set_initial_moles(comp_ptr->Get_moles());
1197
+ }
1198
+ }
1199
+ /*
1200
+ * Finish up
1201
+ */
1202
+ Rxn_ss_assemblage_map[n_user] = temp_ss_assemblage;
1203
+
1204
+ use.Set_ss_assemblage_ptr(NULL);
1205
+ return (OK);
1206
+ }
1207
+ /* ---------------------------------------------------------------------- */
1208
+ int Phreeqc::
1209
+ xpp_assemblage_save(int n_user)
1210
+ /* ---------------------------------------------------------------------- */
1211
+ {
1212
+ /*
1213
+ * Save pure_phase assemblage into instance of cxxPPassemblage with user
1214
+ * number n_user.
1215
+ */
1216
+ std::string token;
1217
+ cxxPPassemblage * pp_assemblage_ptr = use.Get_pp_assemblage_ptr();
1218
+ if (use.Get_pp_assemblage_ptr() == NULL)
1219
+ return (OK);
1220
+
1221
+ cxxPPassemblage temp_pp_assemblage(*pp_assemblage_ptr);
1222
+
1223
+ temp_pp_assemblage.Set_n_user(n_user);
1224
+ temp_pp_assemblage.Set_n_user_end(n_user);
1225
+ std::ostringstream desc;
1226
+ desc << "Pure-phase assemblage after simulation " << simulation << ".";
1227
+ temp_pp_assemblage.Set_description(desc.str().c_str());
1228
+ temp_pp_assemblage.Set_new_def(false);
1229
+ /*
1230
+ * Update amounts
1231
+ */
1232
+ for (int j = 0; j < count_unknowns; j++)
1233
+ {
1234
+ if (x[j]->type != PP)
1235
+ continue;
1236
+ cxxPPassemblageComp *comp = temp_pp_assemblage.Find(x[j]->pp_assemblage_comp_name);
1237
+ comp->Set_moles(x[j]->moles);
1238
+ comp->Set_delta(0.0);
1239
+ }
1240
+ /*
1241
+ * Finish up
1242
+ */
1243
+
1244
+ Rxn_pp_assemblage_map[n_user] = temp_pp_assemblage;
1245
+ use.Set_pp_assemblage_ptr(NULL);
1246
+ return (OK);
1247
+ }
1248
+ /* ---------------------------------------------------------------------- */
1249
+ int Phreeqc::
1250
+ xsolution_save(int n_user)
1251
+ /* ---------------------------------------------------------------------- */
1252
+ {
1253
+ /*
1254
+ * Save solution composition into structure solution with user number
1255
+ * n_user.
1256
+ *
1257
+ * input: n_user is user solution number of target
1258
+ */
1259
+ class master *master_i_ptr, *master_ptr;
1260
+ /*
1261
+ * Malloc space for solution data
1262
+ */
1263
+ cxxSolution temp_solution;
1264
+ temp_solution.Set_n_user_both(n_user);
1265
+ temp_solution.Set_new_def(false);
1266
+ temp_solution.Set_description(description_x);
1267
+ temp_solution.Set_tc(tc_x);
1268
+ temp_solution.Set_patm(patm_x);
1269
+ temp_solution.Set_potV(potV_x);
1270
+ temp_solution.Set_ph(ph_x);
1271
+ temp_solution.Set_pe(solution_pe_x);
1272
+ temp_solution.Set_mu(mu_x);
1273
+ temp_solution.Set_ah2o(ah2o_x);
1274
+ // the subroutine is called at the start of a new simulation, and the following 2 go wrong since s_x is not updated
1275
+ temp_solution.Set_density(density_x);
1276
+ temp_solution.Set_viscosity(viscos);
1277
+ temp_solution.Set_viscos_0(viscos_0);
1278
+ temp_solution.Set_total_h(total_h_x);
1279
+ temp_solution.Set_total_o(total_o_x);
1280
+ temp_solution.Set_cb(cb_x); /* cb_x does not include surface charge after sum_species */
1281
+ /* does include surface charge after step */
1282
+ temp_solution.Set_mass_water(mass_water_aq_x);
1283
+ temp_solution.Set_total_alkalinity(total_alkalinity);
1284
+ temp_solution.Set_soln_vol(this->calc_solution_volume());
1285
+ /*
1286
+ * Copy pe data
1287
+ */
1288
+ /*
1289
+ * Add in minor isotopes if initial solution calculation
1290
+ */
1291
+ if (initial_solution_isotopes == TRUE)
1292
+ {
1293
+ for (int i = 0; i < (int)master_isotope.size(); i++)
1294
+ {
1295
+ if (master_isotope[i]->moles > 0)
1296
+ {
1297
+ master_i_ptr = master_bsearch(master_isotope[i]->name);
1298
+ master_ptr = master_isotope[i]->elt->master;
1299
+ if (master_isotope[i]->minor_isotope == TRUE)
1300
+ {
1301
+ master_i_ptr->total = master_isotope[i]->moles;
1302
+ if (master_ptr->total > 0)
1303
+ {
1304
+ master_i_ptr->s->la =
1305
+ master_ptr->s->la +
1306
+ log10(master_i_ptr->total / master_ptr->total);
1307
+ }
1308
+ else
1309
+ {
1310
+ master_i_ptr->s->la = master_ptr->s->la;
1311
+ }
1312
+ }
1313
+ else if (master_isotope[i]->minor_isotope == FALSE
1314
+ && master_ptr->s != s_hplus
1315
+ && master_ptr->s != s_h2o)
1316
+ {
1317
+ if (master_ptr->s->secondary != NULL)
1318
+ {
1319
+ master_ptr->s->secondary->total =
1320
+ master_isotope[i]->moles;
1321
+ }
1322
+ else
1323
+ {
1324
+ master_ptr->s->primary->total =
1325
+ master_isotope[i]->moles;
1326
+ }
1327
+ }
1328
+ }
1329
+ }
1330
+ }
1331
+ /*
1332
+ * Copy totals data
1333
+ */
1334
+ for (int i = 0; i < (int)master.size(); i++)
1335
+ {
1336
+ if (master[i]->s->type == EX ||
1337
+ master[i]->s->type == SURF || master[i]->s->type == SURF_PSI)
1338
+ continue;
1339
+ if (master[i]->s == s_hplus)
1340
+ continue;
1341
+ if (master[i]->s == s_h2o)
1342
+ continue;
1343
+ /*
1344
+ * Save list of log activities
1345
+ */
1346
+ if (master[i]->in != FALSE)
1347
+ {
1348
+ temp_solution.Get_master_activity()[master[i]->elt->name] = master[i]->s->la;
1349
+ }
1350
+ if (master[i]->total <= MIN_TOTAL)
1351
+ {
1352
+ master[i]->total = 0.0;
1353
+ master[i]->total_primary = 0.0;
1354
+ continue;
1355
+ }
1356
+ /*
1357
+ * Save list of concentrations
1358
+ */
1359
+ temp_solution.Get_totals()[master[i]->elt->name] = master[i]->total;
1360
+ }
1361
+ if (pitzer_model == TRUE || sit_model == TRUE)
1362
+ {
1363
+ for (int j = 0; j < (int)this->s_x.size(); j++)
1364
+ {
1365
+ if (s_x[j]->lg != 0.0)
1366
+ {
1367
+ temp_solution.Get_species_gamma()[s_x[j]->name] = s_x[j]->lg;
1368
+ }
1369
+ }
1370
+ }
1371
+ /*
1372
+ * Save isotope data
1373
+ */
1374
+ temp_solution.Set_isotopes(isotopes_x);
1375
+ std::map< std::string, cxxSolutionIsotope >::iterator it;
1376
+ for (it = temp_solution.Get_isotopes().begin(); it != temp_solution.Get_isotopes().end(); it++)
1377
+ {
1378
+ class master *iso_master_ptr = master_bsearch(it->second.Get_elt_name().c_str());
1379
+ if (iso_master_ptr != NULL)
1380
+ {
1381
+ it->second.Set_total(iso_master_ptr->total);
1382
+ if (iso_master_ptr == s_hplus->secondary)
1383
+ {
1384
+ it->second.Set_total(2 * mass_water_aq_x / gfw_water);
1385
+ }
1386
+ if (iso_master_ptr == s_h2o->secondary)
1387
+ {
1388
+ it->second.Set_total(mass_water_aq_x / gfw_water);
1389
+ }
1390
+ }
1391
+ else
1392
+ {
1393
+ error_string = sformatf("Ignoring failed attempt to interpret %s as an isotope of element %s.",
1394
+ it->second.Get_isotope_name().c_str(), it->second.Get_elt_name().c_str());
1395
+ warning_msg(error_string);
1396
+ }
1397
+ }
1398
+ if (this->save_species)
1399
+ {
1400
+ // saves mol/L
1401
+ temp_solution.Get_species_map().clear();
1402
+ for (int i = 0; i < (int)this->s_x.size(); i++)
1403
+ {
1404
+ if (s_x[i]->type <= H2O)
1405
+ {
1406
+ temp_solution.Get_species_map()[s_x[i]->number] = s_x[i]->moles / temp_solution.Get_soln_vol();
1407
+ }
1408
+ }
1409
+ // saves gamma
1410
+ temp_solution.Get_log_gamma_map().clear();
1411
+ for (int i = 0; i < (int)this->s_x.size(); i++)
1412
+ {
1413
+ if (s_x[i]->type <= H2O)
1414
+ {
1415
+ temp_solution.Get_log_gamma_map()[s_x[i]->number] = s_x[i]->lg;
1416
+ }
1417
+ }
1418
+ // saves molalities
1419
+ temp_solution.Get_log_molalities_map().clear();
1420
+ for (int i = 0; i < (int)this->s_x.size(); i++)
1421
+ {
1422
+ if (s_x[i]->type <= H2O)
1423
+ {
1424
+ temp_solution.Get_log_molalities_map()[s_x[i]->number] = s_x[i]->lm;
1425
+ }
1426
+ }
1427
+ }
1428
+ /*
1429
+ * Save solution
1430
+ */
1431
+ Rxn_solution_map[n_user] = temp_solution;
1432
+ return (OK);
1433
+ }
1434
+ /* ---------------------------------------------------------------------- */
1435
+ int Phreeqc::
1436
+ xsurface_save(int n_user)
1437
+ /* ---------------------------------------------------------------------- */
1438
+ {
1439
+ /*
1440
+ * Save surface data into structure surface with user
1441
+ * number n_user.
1442
+ */
1443
+ LDBLE charge;
1444
+ if (use.Get_surface_ptr() == NULL)
1445
+ return (OK);
1446
+ /*
1447
+ * Store data for structure surface
1448
+ */
1449
+ cxxSurface temp_surface = *use.Get_surface_ptr();
1450
+ temp_surface.Set_n_user(n_user);
1451
+ temp_surface.Set_n_user_end(n_user);
1452
+ temp_surface.Set_new_def(false);
1453
+ //temp_surface.Set_dl_type(dl_type_x);
1454
+ temp_surface.Set_dl_type(use.Get_surface_ptr()->Get_dl_type());
1455
+ temp_surface.Set_solution_equilibria(false);
1456
+ temp_surface.Set_n_solution(-999);
1457
+
1458
+ if (temp_surface.Get_type() == cxxSurface::NO_EDL)
1459
+ {
1460
+ temp_surface.Get_surface_charges().clear();
1461
+ }
1462
+ /*
1463
+ * Write surface_comp structure for each surf component into comps_ptr
1464
+ */
1465
+ /*
1466
+ * Initial entry of surface sites is random
1467
+ * Charge balance numbering follows the initial entry
1468
+ * Surface sites are then sorted alphabetically
1469
+ * Now when we save, the site order differs from the charge order
1470
+ * last_charge sets up logic to renumber charge balance equations.
1471
+ */
1472
+ for (int i = 0; i < count_unknowns; i++)
1473
+ {
1474
+ if (x[i]->type == SURFACE)
1475
+ {
1476
+ cxxSurfaceComp *comp_ptr = temp_surface.Find_comp(x[i]->surface_comp);
1477
+ if (comp_ptr == NULL)
1478
+ continue; // appt in transport with different mobile and stagnant surfaces
1479
+ assert(comp_ptr);
1480
+ comp_ptr->Set_la(x[i]->master[0]->s->la);
1481
+ comp_ptr->Set_moles(0.);
1482
+ /*
1483
+ * Save element concentrations on surface
1484
+ */
1485
+ count_elts = 0;
1486
+ paren_count = 0;
1487
+ charge = 0.0;
1488
+ for (int j = 0; j < (int)species_list.size(); j++)
1489
+ {
1490
+ if (species_list[j].master_s == x[i]->master[0]->s)
1491
+ {
1492
+ add_elt_list(species_list[j].s->next_elt,
1493
+ species_list[j].s->moles);
1494
+ //add_elt_list_multi_surf(species_list[j].s->next_elt,
1495
+ // species_list[j].s->moles, x[i]->master[0]->elt);
1496
+ charge += species_list[j].s->moles * species_list[j].s->z;
1497
+ }
1498
+ }
1499
+ {
1500
+ cxxNameDouble nd = elt_list_NameDouble();
1501
+ comp_ptr->Set_totals(nd);
1502
+ }
1503
+ comp_ptr->Set_charge_balance(charge);
1504
+ }
1505
+ else if (x[i]->type == SURFACE_CB && (use.Get_surface_ptr()->Get_type() == cxxSurface::DDL || use.Get_surface_ptr()->Get_type() == cxxSurface::CCM))
1506
+ {
1507
+ cxxSurfaceCharge *charge_ptr = temp_surface.Find_charge(x[i]->surface_charge);
1508
+ if (charge_ptr == NULL)
1509
+ continue; // appt in transport with different mobile and stagnant surfaces
1510
+ assert(charge_ptr);
1511
+ charge_ptr->Set_charge_balance(x[i]->f);
1512
+ charge_ptr->Set_la_psi(x[i]->master[0]->s->la);
1513
+ /*
1514
+ * Store moles from diffuse_layer
1515
+ */
1516
+ if (dl_type_x != cxxSurface::NO_DL)
1517
+ {
1518
+ sum_diffuse_layer(charge_ptr);
1519
+ cxxNameDouble nd = elt_list_NameDouble();
1520
+ charge_ptr->Set_diffuse_layer_totals(nd);
1521
+ }
1522
+ }
1523
+ else if (x[i]->type == SURFACE_CB
1524
+ && use.Get_surface_ptr()->Get_type() == cxxSurface::CD_MUSIC)
1525
+ {
1526
+ cxxSurfaceCharge *charge_ptr = temp_surface.Find_charge(x[i]->surface_charge);
1527
+ assert(charge_ptr);
1528
+ if (dl_type_x != cxxSurface::NO_DL)
1529
+ {
1530
+ charge_ptr->Set_charge_balance(
1531
+ (charge_ptr->Get_sigma0() +
1532
+ charge_ptr->Get_sigma1() +
1533
+ charge_ptr->Get_sigma2() +
1534
+ charge_ptr->Get_sigmaddl())
1535
+ * (charge_ptr->Get_specific_area() *
1536
+ charge_ptr->Get_grams()) / F_C_MOL);
1537
+ }
1538
+ else
1539
+ {
1540
+ charge_ptr->Set_charge_balance(
1541
+ (charge_ptr->Get_sigma0() +
1542
+ charge_ptr->Get_sigma1() +
1543
+ charge_ptr->Get_sigma2())
1544
+ * (charge_ptr->Get_specific_area() *
1545
+ charge_ptr->Get_grams()) / F_C_MOL);
1546
+ }
1547
+ charge_ptr->Set_la_psi(x[i]->master[0]->s->la);
1548
+ /*
1549
+ * Store moles from diffuse_layer
1550
+ */
1551
+ if (dl_type_x != cxxSurface::NO_DL)
1552
+ {
1553
+ sum_diffuse_layer(charge_ptr);
1554
+ cxxNameDouble nd = elt_list_NameDouble();
1555
+ charge_ptr->Set_diffuse_layer_totals(nd);
1556
+ }
1557
+ }
1558
+ }
1559
+ if (!(dl_type_x == cxxSurface::NO_DL))
1560
+ {
1561
+ cxxSurface *surface_ptr = &temp_surface;
1562
+ for (size_t i = 0; i < surface_ptr->Get_surface_charges().size(); i++)
1563
+ {
1564
+ cxxSurfaceCharge & charge_ref = surface_ptr->Get_surface_charges()[i];
1565
+ double mass_water_surface = charge_ref.Get_mass_water();
1566
+ for (int j = 0; j < (int)this->s_x.size(); j++)
1567
+ {
1568
+ if (s_x[j]->type > H2O)
1569
+ continue;
1570
+ double molality = under(s_x[j]->lm);
1571
+ double moles_excess = mass_water_aq_x * molality * charge_ref.Get_g_map()[s_x[j]->z].Get_g();
1572
+ double moles_surface = mass_water_surface * molality + moles_excess;
1573
+ charge_ref.Get_dl_species_map()[s_x[j]->number] = moles_surface/mass_water_surface;
1574
+ double g = charge_ref.Get_g_map()[s_x[j]->z].Get_g();
1575
+ //double moles_excess = mass_water_aq_x * molality * (g * s_x[j]->erm_ddl +
1576
+ // mass_water_surface /
1577
+ // mass_water_aq_x * (s_x[j]->erm_ddl - 1));
1578
+
1579
+ //LDBLE g = charge_ptr->Get_g_map()[s_x[j]->z].Get_g();
1580
+ if (s_x[j]->erm_ddl != 1)
1581
+ {
1582
+ LDBLE ratio_aq = mass_water_surface / mass_water_aq_x;
1583
+ LDBLE g2 = g / ratio_aq + 1;
1584
+ g = ratio_aq * (g2 * s_x[j]->erm_ddl - 1);
1585
+ }
1586
+ moles_excess = mass_water_aq_x * molality * g;
1587
+ double c = (mass_water_surface * molality + moles_excess) / mass_water_surface;
1588
+ charge_ref.Get_dl_species_map()[s_x[j]->number] = c;
1589
+ }
1590
+ //charge_ref.Get_dl_species_map()[s_h2o->number] = 0.0;
1591
+ charge_ref.Get_dl_species_map()[s_h2o->number] = 1.0/gfw_water;
1592
+ }
1593
+ }
1594
+
1595
+ /*
1596
+ * Finish up
1597
+ */
1598
+ Rxn_surface_map[n_user] = temp_surface;
1599
+ use.Set_surface_ptr(NULL);
1600
+ return (OK);
1601
+ }
1602
+ /* ---------------------------------------------------------------------- */
1603
+ int Phreeqc::
1604
+ copy_use(int i)
1605
+ /* ---------------------------------------------------------------------- */
1606
+ {
1607
+ /*
1608
+ * Find mixture
1609
+ */
1610
+ if (use.Get_mix_in() == TRUE)
1611
+ {
1612
+ Utilities::Rxn_copy(Rxn_mix_map, use.Get_n_mix_user(), i);
1613
+ }
1614
+ /*
1615
+ * Find solution
1616
+ */
1617
+ if (use.Get_solution_in() == TRUE)
1618
+ {
1619
+ Utilities::Rxn_copy(Rxn_solution_map, use.Get_n_solution_user(), i);
1620
+ }
1621
+ /*
1622
+ * Always save solution to i, mixing or not
1623
+ */
1624
+ save.solution = TRUE;
1625
+ save.n_solution_user = i;
1626
+ save.n_solution_user_end = i;
1627
+ /*
1628
+ * Find pure phase assemblage
1629
+ */
1630
+ if (use.Get_pp_assemblage_in() == TRUE)
1631
+ {
1632
+ Utilities::Rxn_copy(Rxn_pp_assemblage_map, use.Get_n_pp_assemblage_user(), i);
1633
+ save.pp_assemblage = TRUE;
1634
+ save.n_pp_assemblage_user = i;
1635
+ save.n_pp_assemblage_user_end = i;
1636
+ }
1637
+ else
1638
+ {
1639
+ save.pp_assemblage = FALSE;
1640
+ }
1641
+ /*
1642
+ * Find irrev reaction
1643
+ */
1644
+ if (use.Get_reaction_in() == TRUE)
1645
+ {
1646
+ Utilities::Rxn_copy(Rxn_reaction_map, use.Get_n_reaction_user(), i);
1647
+ save.reaction = TRUE;
1648
+ save.n_reaction_user = i;
1649
+ save.n_reaction_user_end = i;
1650
+ }
1651
+ else
1652
+ {
1653
+ save.reaction = FALSE;
1654
+ }
1655
+ /*
1656
+ * Find exchange
1657
+ */
1658
+ if (use.Get_exchange_in() == TRUE)
1659
+ {
1660
+ Utilities::Rxn_copy(Rxn_exchange_map, use.Get_n_exchange_user(), i);
1661
+ save.exchange = TRUE;
1662
+ save.n_exchange_user = i;
1663
+ save.n_exchange_user_end = i;
1664
+ }
1665
+ else
1666
+ {
1667
+ save.exchange = FALSE;
1668
+ }
1669
+ /*
1670
+ * Find kinetics
1671
+ */
1672
+ if (use.Get_kinetics_in() == TRUE)
1673
+ {
1674
+ Utilities::Rxn_copy(Rxn_kinetics_map, use.Get_n_kinetics_user(), i);
1675
+ save.kinetics = TRUE;
1676
+ save.n_kinetics_user = i;
1677
+ save.n_kinetics_user_end = i;
1678
+ }
1679
+ else
1680
+ {
1681
+ save.kinetics = FALSE;
1682
+ }
1683
+ /*
1684
+ * Find surface
1685
+ */
1686
+ dl_type_x = cxxSurface::NO_DL;
1687
+ if (use.Get_surface_in() == TRUE)
1688
+ {
1689
+ Utilities::Rxn_copy(Rxn_surface_map, use.Get_n_surface_user(), i);
1690
+ save.surface = TRUE;
1691
+ save.n_surface_user = i;
1692
+ save.n_surface_user_end = i;
1693
+ }
1694
+ else
1695
+ {
1696
+ save.surface = FALSE;
1697
+ }
1698
+ /*
1699
+ * Find temperature
1700
+ */
1701
+ if (use.Get_temperature_in() == TRUE)
1702
+ {
1703
+ Utilities::Rxn_copy(Rxn_temperature_map, use.Get_n_temperature_user(), i);
1704
+ }
1705
+ /*
1706
+ * Find pressure
1707
+ */
1708
+ if (use.Get_pressure_in() == TRUE)
1709
+ {
1710
+ Utilities::Rxn_copy(Rxn_pressure_map, use.Get_n_pressure_user(), i);
1711
+ }
1712
+ /*
1713
+ * Find gas
1714
+ */
1715
+ if (use.Get_gas_phase_in() == TRUE)
1716
+ {
1717
+ Utilities::Rxn_copy(Rxn_gas_phase_map, use.Get_n_gas_phase_user(), i);
1718
+ save.gas_phase = TRUE;
1719
+ save.n_gas_phase_user = i;
1720
+ save.n_gas_phase_user_end = i;
1721
+ }
1722
+ else
1723
+ {
1724
+ save.gas_phase = FALSE;
1725
+ }
1726
+ /*
1727
+ * Find solid solution
1728
+ */
1729
+ if (use.Get_ss_assemblage_in() == TRUE)
1730
+ {
1731
+ Utilities::Rxn_copy(Rxn_ss_assemblage_map, use.Get_n_ss_assemblage_user(), i);
1732
+ save.ss_assemblage = TRUE;
1733
+ save.n_ss_assemblage_user = i;
1734
+ save.n_ss_assemblage_user_end = i;
1735
+ }
1736
+ else
1737
+ {
1738
+ save.ss_assemblage = FALSE;
1739
+ }
1740
+ return (OK);
1741
+ }
1742
+ /* ---------------------------------------------------------------------- */
1743
+ int Phreeqc::
1744
+ step_save_exch(int n_user)
1745
+ /* ---------------------------------------------------------------------- */
1746
+ {
1747
+ /*
1748
+ * Save exchange composition
1749
+ *
1750
+ * input: n_user is user exchange number of target
1751
+ */
1752
+
1753
+ if (use.Get_exchange_ptr() == NULL)
1754
+ return (OK);
1755
+
1756
+ cxxExchange *temp_ptr = Utilities::Rxn_find(Rxn_exchange_map, use.Get_n_exchange_user());
1757
+ assert(temp_ptr);
1758
+
1759
+ // Set all totals to 0.0
1760
+ cxxExchange temp_exchange = *temp_ptr;
1761
+ {
1762
+ for (size_t i = 0; i < temp_exchange.Get_exchange_comps().size(); i++)
1763
+ {
1764
+ temp_exchange.Get_exchange_comps()[i].Get_totals().multiply(0.0);
1765
+ }
1766
+ }
1767
+
1768
+ // Set exchange total in one component
1769
+ for (int i = 0; i < (int)master.size(); i++)
1770
+ {
1771
+ if (master[i]->s->type != EX)
1772
+ continue;
1773
+ std::string e(master[i]->elt->name);
1774
+ for (size_t j = 0; j < temp_exchange.Get_exchange_comps().size(); j++)
1775
+ {
1776
+ cxxNameDouble *nd = &(temp_exchange.Get_exchange_comps()[j].Get_totals());
1777
+ cxxNameDouble::iterator nd_it = nd->find(e);
1778
+ if (nd_it != nd->end())
1779
+ {
1780
+ LDBLE coef;
1781
+ if (master[i]->total <= MIN_TOTAL)
1782
+ {
1783
+ coef = MIN_TOTAL;
1784
+ }
1785
+ else
1786
+ {
1787
+ coef = master[i]->total;
1788
+ }
1789
+ nd->insert(nd_it->first.c_str(), coef);
1790
+ break;
1791
+ }
1792
+ }
1793
+ }
1794
+
1795
+ Rxn_exchange_map[n_user] = temp_exchange;
1796
+ return (OK);
1797
+ }
1798
+ /* ---------------------------------------------------------------------- */
1799
+ int Phreeqc::
1800
+ step_save_surf(int n_user)
1801
+ /* ---------------------------------------------------------------------- */
1802
+ {
1803
+ /*
1804
+ * Save surface for intermediate calculation
1805
+ * Amt of surface may have changed due to reaction or surface related
1806
+ * to kinetic reactant.
1807
+ *
1808
+ * input: n_user is user solution number of target
1809
+ */
1810
+ if (use.Get_surface_ptr() == NULL)
1811
+ return (OK);
1812
+ Utilities::Rxn_copy(Rxn_surface_map, use.Get_surface_ptr()->Get_n_user(), n_user);
1813
+ cxxSurface *surface_ptr = Utilities::Rxn_find(Rxn_surface_map, n_user);
1814
+ for (int i = 0; i < (int)master.size(); i++)
1815
+ {
1816
+ if (master[i]->s->type != SURF)
1817
+ continue;
1818
+ for (size_t j = 0; j < surface_ptr->Get_surface_comps().size(); j++)
1819
+ {
1820
+ cxxSurfaceComp * comp_ptr = &(surface_ptr->Get_surface_comps()[j]);
1821
+ cxxNameDouble & totals = comp_ptr->Get_totals();
1822
+ if (totals.find(master[i]->elt->name) == totals.end())
1823
+ {
1824
+ continue;
1825
+ }
1826
+ else
1827
+ {
1828
+ LDBLE coef = master[i]->total;
1829
+ if (master[i]->total <= MIN_TOTAL)
1830
+ {
1831
+ coef = MIN_TOTAL;
1832
+ }
1833
+ totals[master[i]->elt->name] = coef;
1834
+ break;
1835
+ }
1836
+ }
1837
+ }
1838
+ /*
1839
+ * Update grams
1840
+ */
1841
+ if ((surface_ptr->Get_type() == cxxSurface::DDL || surface_ptr->Get_type() == cxxSurface::CCM || surface_ptr->Get_type() == cxxSurface::CD_MUSIC)
1842
+ && surface_ptr->Get_related_rate() && use.Get_kinetics_ptr() != NULL)
1843
+ {
1844
+ for (size_t j = 0; j < surface_ptr->Get_surface_comps().size(); j++)
1845
+ {
1846
+ cxxSurfaceComp *surface_comp_ptr = &(surface_ptr->Get_surface_comps()[j]);
1847
+ if (surface_comp_ptr->Get_rate_name().size() > 0)
1848
+ {
1849
+ cxxKinetics *kinetics_ptr = use.Get_kinetics_ptr();
1850
+ for (size_t m = 0; m < kinetics_ptr->Get_kinetics_comps().size(); m++)
1851
+ {
1852
+ cxxKineticsComp * kinetics_comp_ptr = &(kinetics_ptr->Get_kinetics_comps()[m]);
1853
+ if (strcmp_nocase
1854
+ (kinetics_comp_ptr->Get_rate_name().c_str(),
1855
+ surface_comp_ptr->Get_rate_name().c_str()) != 0)
1856
+ continue;
1857
+ cxxSurfaceCharge *charge_ptr = surface_ptr->Find_charge(surface_comp_ptr->Get_charge_name());
1858
+ charge_ptr->Set_grams(kinetics_comp_ptr->Get_m());
1859
+ break;
1860
+ }
1861
+ }
1862
+ }
1863
+ }
1864
+ return (OK);
1865
+ }
1866
+ /* ---------------------------------------------------------------------- */
1867
+ int Phreeqc::
1868
+ copy_entities(void)
1869
+ /* ---------------------------------------------------------------------- */
1870
+ {
1871
+ int return_value;
1872
+ return_value = OK;
1873
+ for (size_t j = 0; j < copy_solution.n_user.size(); j++)
1874
+ {
1875
+ if (Utilities::Rxn_find(Rxn_solution_map, copy_solution.n_user[j]) != NULL)
1876
+ {
1877
+ for (size_t i = copy_solution.start[j]; i <= copy_solution.end[j]; i++)
1878
+ {
1879
+ if (i == copy_solution.n_user[j])
1880
+ continue;
1881
+ Utilities::Rxn_copy(Rxn_solution_map, copy_solution.n_user[j], (int)i);
1882
+ }
1883
+ }
1884
+ }
1885
+ copier_clear(&copy_solution);
1886
+
1887
+ for (size_t j = 0; j < copy_pp_assemblage.n_user.size(); j++)
1888
+ {
1889
+ if (Utilities::Rxn_find(Rxn_pp_assemblage_map, copy_pp_assemblage.n_user[j]) != NULL)
1890
+ {
1891
+ for (size_t i = copy_pp_assemblage.start[j]; i <= copy_pp_assemblage.end[j]; i++)
1892
+ {
1893
+ if (i == copy_pp_assemblage.n_user[j])
1894
+ continue;
1895
+ Utilities::Rxn_copy(Rxn_pp_assemblage_map, copy_pp_assemblage.n_user[j], (int)i);
1896
+ }
1897
+ }
1898
+ }
1899
+ copier_clear(&copy_pp_assemblage);
1900
+
1901
+ for (size_t j = 0; j < copy_reaction.n_user.size(); j++)
1902
+ {
1903
+ if (Utilities::Rxn_find(Rxn_reaction_map, copy_reaction.n_user[j]) != NULL)
1904
+ {
1905
+ for (size_t i = copy_reaction.start[j]; i <= copy_reaction.end[j]; i++)
1906
+ {
1907
+ if (i == copy_reaction.n_user[j])
1908
+ continue;
1909
+ Utilities::Rxn_copy(Rxn_reaction_map, copy_reaction.n_user[j], (int)i);
1910
+ }
1911
+ }
1912
+ }
1913
+ copier_clear(&copy_reaction);
1914
+
1915
+ for (size_t j = 0; j < copy_mix.n_user.size(); j++)
1916
+ {
1917
+ if (Utilities::Rxn_find(Rxn_mix_map, copy_mix.n_user[j]) != NULL)
1918
+ {
1919
+ for (size_t i = copy_mix.start[j]; i <= copy_mix.end[j]; i++)
1920
+ {
1921
+ if (i != copy_mix.n_user[j])
1922
+ {
1923
+ Utilities::Rxn_copy(Rxn_mix_map, copy_mix.n_user[j], (int)i);
1924
+ }
1925
+ }
1926
+ }
1927
+ }
1928
+ copier_clear(&copy_mix);
1929
+
1930
+ for (size_t j = 0; j < copy_exchange.n_user.size(); j++)
1931
+ {
1932
+ if (Utilities::Rxn_find(Rxn_exchange_map, copy_exchange.n_user[j]) != NULL)
1933
+ {
1934
+ for (size_t i = copy_exchange.start[j]; i <= copy_exchange.end[j]; i++)
1935
+ {
1936
+ if (i == copy_exchange.n_user[j]) continue;
1937
+ Utilities::Rxn_copy(Rxn_exchange_map, copy_exchange.n_user[j], (int)i);
1938
+ }
1939
+ }
1940
+ }
1941
+ copier_clear(&copy_exchange);
1942
+
1943
+ for (size_t j = 0; j < copy_surface.n_user.size(); j++)
1944
+ {
1945
+ if (Utilities::Rxn_find(Rxn_surface_map, copy_surface.n_user[j]) != NULL)
1946
+ {
1947
+ for (size_t i = copy_surface.start[j]; i <= copy_surface.end[j]; i++)
1948
+ {
1949
+ if (i == copy_surface.n_user[j])
1950
+ continue;
1951
+ Utilities::Rxn_copy(Rxn_surface_map, copy_surface.n_user[j], (int)i);
1952
+ }
1953
+ }
1954
+ }
1955
+ copier_clear(&copy_surface);
1956
+
1957
+ for (size_t j = 0; j < copy_temperature.n_user.size(); j++)
1958
+ {
1959
+ if (Utilities::Rxn_find(Rxn_temperature_map, copy_temperature.n_user[j]) != NULL)
1960
+ {
1961
+ for (size_t i = copy_temperature.start[j]; i <= copy_temperature.end[j]; i++)
1962
+ {
1963
+ if (i != copy_temperature.n_user[j])
1964
+ {
1965
+ Utilities::Rxn_copy(Rxn_temperature_map, copy_temperature.n_user[j], (int)i);
1966
+ }
1967
+ }
1968
+ }
1969
+ }
1970
+ copier_clear(&copy_temperature);
1971
+
1972
+ for (size_t j = 0; j < copy_pressure.n_user.size(); j++)
1973
+ {
1974
+ if (Utilities::Rxn_find(Rxn_pressure_map, copy_pressure.n_user[j]) != NULL)
1975
+ {
1976
+ for (size_t i = copy_pressure.start[j]; i <= copy_pressure.end[j]; i++)
1977
+ {
1978
+ if (i != copy_pressure.n_user[j])
1979
+ {
1980
+ Utilities::Rxn_copy(Rxn_pressure_map, copy_pressure.n_user[j], (int)i);
1981
+ }
1982
+ }
1983
+ }
1984
+ }
1985
+ copier_clear(&copy_pressure);
1986
+
1987
+ for (size_t j = 0; j < copy_gas_phase.n_user.size(); j++)
1988
+ {
1989
+ if (Utilities::Rxn_find(Rxn_gas_phase_map, copy_gas_phase.n_user[j]) != NULL)
1990
+ {
1991
+ for (size_t i = copy_gas_phase.start[j]; i <= copy_gas_phase.end[j]; i++)
1992
+ {
1993
+ if (i == copy_gas_phase.n_user[j])
1994
+ continue;
1995
+ Utilities::Rxn_copy(Rxn_gas_phase_map, copy_gas_phase.n_user[j], (int)i);
1996
+ }
1997
+ }
1998
+ }
1999
+ copier_clear(&copy_gas_phase);
2000
+
2001
+ for (size_t j = 0; j < copy_kinetics.n_user.size(); j++)
2002
+ {
2003
+ if (Utilities::Rxn_find(Rxn_kinetics_map, copy_kinetics.n_user[j]) != NULL)
2004
+ {
2005
+ for (size_t i = copy_kinetics.start[j]; i <= copy_kinetics.end[j]; i++)
2006
+ {
2007
+ if (i == copy_kinetics.n_user[j])
2008
+ continue;
2009
+ Utilities::Rxn_copy(Rxn_kinetics_map, copy_kinetics.n_user[j], (int)i);
2010
+ }
2011
+ }
2012
+ }
2013
+ copier_clear(&copy_kinetics);
2014
+
2015
+ for (size_t j = 0; j < copy_ss_assemblage.n_user.size(); j++)
2016
+ {
2017
+ if (Utilities::Rxn_find(Rxn_ss_assemblage_map, copy_ss_assemblage.n_user[j]) != NULL)
2018
+ {
2019
+ for (size_t i = copy_ss_assemblage.start[j]; i <= copy_ss_assemblage.end[j]; i++)
2020
+ {
2021
+ if (i == copy_ss_assemblage.n_user[j])
2022
+ continue;
2023
+ Utilities::Rxn_copy(Rxn_ss_assemblage_map, copy_ss_assemblage.n_user[j], (int)i);
2024
+ }
2025
+ }
2026
+ }
2027
+ copier_clear(&copy_ss_assemblage);
2028
+
2029
+ new_copy = FALSE;
2030
+ return return_value;
2031
+ }
2032
+
2033
+ /* ---------------------------------------------------------------------- */
2034
+ int Phreeqc::
2035
+ read_database(void)
2036
+ /* ---------------------------------------------------------------------- */
2037
+ {
2038
+ simulation = 0;
2039
+
2040
+ /*
2041
+ * Prepare error handling
2042
+ */
2043
+ try
2044
+ {
2045
+ set_reading_database(TRUE);
2046
+ dup_print("Reading data base.", TRUE);
2047
+ read_input();
2048
+ tidy_model();
2049
+ status(0, NULL);
2050
+ }
2051
+ catch (const PhreeqcStop&)
2052
+ {
2053
+ return get_input_errors();
2054
+ }
2055
+ set_reading_database(FALSE);
2056
+ return 0;
2057
+ }
2058
+
2059
+ /* ---------------------------------------------------------------------- */
2060
+ int Phreeqc::
2061
+ run_simulations(void)
2062
+ /* ---------------------------------------------------------------------- */
2063
+ {
2064
+ char token[MAX_LENGTH];
2065
+ #if defined(_MSC_VER) && (_MSC_VER < 1900) // removed in vs2015
2066
+ unsigned int old_exponent_format;
2067
+ old_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT);
2068
+ #endif
2069
+ /*
2070
+ * Prepare error handling
2071
+ */
2072
+ try
2073
+ {
2074
+ /*
2075
+ * Read input data for simulation
2076
+ */
2077
+ for (simulation = 1;; simulation++)
2078
+ {
2079
+ #ifdef TEST_COPY_OPERATOR
2080
+ {
2081
+ //int simulation_save = simulation;
2082
+ Phreeqc phreeqc_new;
2083
+ phreeqc_new = *this;
2084
+ PHRQ_io *temp_io = this->phrq_io;
2085
+ std::vector<std::ostream *> so_ostreams;
2086
+ {
2087
+ std::map<int, SelectedOutput>::iterator so_it = this->SelectedOutput_map.begin();
2088
+ for (; so_it != this->SelectedOutput_map.end(); so_it++)
2089
+ {
2090
+ so_ostreams.push_back(so_it->second.Get_punch_ostream());
2091
+ so_it->second.Set_punch_ostream(NULL);
2092
+ }
2093
+ }
2094
+ this->clean_up();
2095
+ this->init();
2096
+ this->initialize();
2097
+ this->phrq_io = temp_io;
2098
+ this->InternalCopy(&phreeqc_new);
2099
+ {
2100
+ size_t i = 0;
2101
+ std::map<int, SelectedOutput>::iterator so_it = this->SelectedOutput_map.begin();
2102
+ for (; so_it != this->SelectedOutput_map.end(); so_it++)
2103
+ {
2104
+ so_it->second.Set_punch_ostream(so_ostreams[i++]);
2105
+ }
2106
+ }
2107
+ //this->simulation = simulation_save;
2108
+ //delete phreeqc_new.Get_phrq_io();
2109
+ }
2110
+ #endif
2111
+ #if defined PHREEQ98
2112
+ AddSeries = !connect_simulations;
2113
+ #endif
2114
+
2115
+ #if defined PHREEQCI_GUI
2116
+ snprintf(token, sizeof(token), "\nSimulation %d\n", simulation);
2117
+ screen_msg(token);
2118
+ #endif
2119
+ snprintf(token, sizeof(token), "Reading input data for simulation %d.", simulation);
2120
+
2121
+ dup_print(token, TRUE);
2122
+ if (read_input() == EOF)
2123
+ break;
2124
+
2125
+ if (title_x.size() > 0)
2126
+ {
2127
+ snprintf(token, sizeof(token), "TITLE");
2128
+ dup_print(token, TRUE);
2129
+ if (pr.headings == TRUE)
2130
+ {
2131
+ output_msg(sformatf("%s\n\n", title_x.c_str()));
2132
+ }
2133
+ }
2134
+ tidy_model();
2135
+ /*
2136
+ * Calculate distribution of species for initial solutions
2137
+ */
2138
+ if (new_solution)
2139
+ {
2140
+ initial_solutions(TRUE);
2141
+ }
2142
+
2143
+ /*
2144
+ * Calculate distribution for exchangers
2145
+ */
2146
+ if (new_exchange)
2147
+ initial_exchangers(TRUE);
2148
+ /*
2149
+ * Calculate distribution for surfaces
2150
+ */
2151
+ if (new_surface)
2152
+ initial_surfaces(TRUE);
2153
+ /*
2154
+ * Calculate initial gas composition
2155
+ */
2156
+ if (new_gas_phase)
2157
+ initial_gas_phases(TRUE);
2158
+ /*
2159
+ * Calculate reactions
2160
+ */
2161
+ reactions();
2162
+ /*
2163
+ * Calculate inverse models
2164
+ */
2165
+ inverse_models();
2166
+ /*
2167
+ * Calculate advection
2168
+ */
2169
+ if (use.Get_advect_in())
2170
+ {
2171
+ dup_print("Beginning of advection calculations.", TRUE);
2172
+ advection();
2173
+ }
2174
+ /*
2175
+ * Calculate transport
2176
+ */
2177
+ if (use.Get_trans_in())
2178
+ {
2179
+ dup_print("Beginning of transport calculations.", TRUE);
2180
+ transport();
2181
+ }
2182
+ /*
2183
+ * run
2184
+ */
2185
+ run_as_cells();
2186
+ /*
2187
+ * Calculate mixes
2188
+ */
2189
+ do_mixes();
2190
+
2191
+ /*
2192
+ * Copy
2193
+ */
2194
+ if (new_copy) copy_entities();
2195
+ /*
2196
+ * dump
2197
+ */
2198
+ dump_entities();
2199
+ /*
2200
+ * delete
2201
+ */
2202
+ delete_entities();
2203
+ /*
2204
+ * End of simulation
2205
+ */
2206
+ dup_print("End of simulation.", TRUE);
2207
+ output_flush();
2208
+ error_flush();
2209
+ }
2210
+ }
2211
+ catch (const PhreeqcStop&)
2212
+ {
2213
+ return get_input_errors();
2214
+ }
2215
+ return 0;
2216
+ }
2217
+
2218
+ /* ---------------------------------------------------------------------- */
2219
+ int Phreeqc::
2220
+ do_initialize(void)
2221
+ /* ---------------------------------------------------------------------- */
2222
+ {
2223
+ /*
2224
+ * Prepare error handling
2225
+ */
2226
+ try {
2227
+
2228
+ state = INITIALIZE;
2229
+
2230
+ initialize();
2231
+ }
2232
+ catch (const PhreeqcStop&)
2233
+ {
2234
+ return get_input_errors();
2235
+ }
2236
+ return 0;
2237
+ }
2238
+
2239
+ /* ---------------------------------------------------------------------- */
2240
+ int Phreeqc::
2241
+ do_status(void)
2242
+ /* ---------------------------------------------------------------------- */
2243
+ {
2244
+ /*
2245
+ * Prepare error handling
2246
+ */
2247
+ try {
2248
+
2249
+ if (pr.status == TRUE)
2250
+ {
2251
+ status(0, "\nDone.");
2252
+ screen_msg("\n");
2253
+ }
2254
+ //pr.headings = TRUE; // set in class_main; not set for IPhreeqc
2255
+ #ifndef TESTING
2256
+ LDBLE ext = (double)clock() / CLOCKS_PER_SEC;
2257
+ dup_print(sformatf("End of Run after %g Seconds.", ext), TRUE);
2258
+ screen_msg(sformatf("\nEnd of Run after %g Seconds.\n", ext));
2259
+ #endif
2260
+ // appt this gives output when the charts are active...
2261
+ phrq_io->output_flush();
2262
+ phrq_io->error_flush();
2263
+ }
2264
+ catch (const PhreeqcStop&)
2265
+ {
2266
+ return get_input_errors();
2267
+ }
2268
+ return 0;
2269
+ }
2270
+ void Phreeqc::
2271
+ save_init(int i)
2272
+ {
2273
+ save.solution = i;
2274
+ save.n_solution_user = i;
2275
+ save.n_solution_user_end = i;
2276
+ save.mix = i;
2277
+ save.n_mix_user = i;
2278
+ save.n_mix_user_end = i;
2279
+ save.reaction = i;
2280
+ save.n_reaction_user = i;
2281
+ save.n_reaction_user_end = i;
2282
+ save.pp_assemblage = i;
2283
+ save.n_pp_assemblage_user = i;
2284
+ save.n_pp_assemblage_user_end = i;
2285
+ save.exchange = i;
2286
+ save.n_exchange_user = i;
2287
+ save.n_exchange_user_end = i;
2288
+ save.kinetics = i;
2289
+ save.n_kinetics_user = i;
2290
+ save.n_kinetics_user_end = i;
2291
+ save.surface = i;
2292
+ save.n_surface_user = i;
2293
+ save.n_surface_user_end = i;
2294
+ save.gas_phase = i;
2295
+ save.n_gas_phase_user = i;
2296
+ save.n_gas_phase_user_end = i;
2297
+ save.ss_assemblage = i;
2298
+ save.n_ss_assemblage_user = i;
2299
+ save.n_ss_assemblage_user_end = i;
2300
+ }
2301
+ void
2302
+ Phreeqc::do_mixes(void)
2303
+ {
2304
+ bool surf, exch, kin, min;
2305
+ surf = (Rxn_surface_mix_map.size() > 0);
2306
+ exch = (Rxn_exchange_mix_map.size() > 0);
2307
+ kin = (Rxn_kinetics_mix_map.size() > 0);
2308
+ min = (Rxn_pp_assemblage_mix_map.size() > 0);
2309
+ Utilities::Rxn_mix(Rxn_solution_mix_map, Rxn_solution_map, this);
2310
+ Utilities::Rxn_mix(Rxn_exchange_mix_map, Rxn_exchange_map, this);
2311
+ Utilities::Rxn_mix(Rxn_gas_phase_mix_map, Rxn_gas_phase_map, this);
2312
+ Utilities::Rxn_mix(Rxn_kinetics_mix_map, Rxn_kinetics_map, this);
2313
+ Utilities::Rxn_mix(Rxn_pp_assemblage_mix_map, Rxn_pp_assemblage_map, this);
2314
+ Utilities::Rxn_mix(Rxn_ss_assemblage_mix_map, Rxn_ss_assemblage_map, this);
2315
+ Utilities::Rxn_mix(Rxn_surface_mix_map, Rxn_surface_map, this);
2316
+ if (exch || kin) update_kin_exchange();
2317
+ if (exch || min) update_min_exchange();
2318
+ if (surf || min) update_min_surface();
2319
+ if (surf || kin) update_kin_surface();
2320
+ }